Drop the need for access tokens to have a session
This commit is contained in:
committed by
Stanko K.R.
parent
660fcff558
commit
895b0e13b8
@@ -1,14 +1,6 @@
|
||||
class Identity::AccessToken < ApplicationRecord
|
||||
belongs_to :identity
|
||||
belongs_to :session
|
||||
|
||||
has_secure_token
|
||||
enum :permission, %w[ read write ].index_by(&:itself), default: :read
|
||||
|
||||
before_validation :build_session, on: :create
|
||||
|
||||
private
|
||||
def build_session
|
||||
self.session = identity.sessions.build(user_agent: "Access Token")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user