Fix settings application controller writing role

This commit is contained in:
Fosco Marotto 2021-02-14 14:05:03 -05:00
parent 0341cd8572
commit 09ba5c9be8
1 changed files with 7 additions and 5 deletions

View File

@ -213,6 +213,7 @@ class User < ApplicationRecord
def token_for_app(a) def token_for_app(a)
return nil if a.nil? || a.owner != self return nil if a.nil? || a.owner != self
ActiveRecord::Base.connected_to(role: :writing) do
Doorkeeper::AccessToken Doorkeeper::AccessToken
.find_or_create_by(application_id: a.id, resource_owner_id: id) do |t| .find_or_create_by(application_id: a.id, resource_owner_id: id) do |t|
@ -221,6 +222,7 @@ class User < ApplicationRecord
t.use_refresh_token = Doorkeeper.configuration.refresh_token_enabled? t.use_refresh_token = Doorkeeper.configuration.refresh_token_enabled?
end end
end end
end
def activate_session(request) def activate_session(request)
session_activations.activate(session_id: SecureRandom.hex, session_activations.activate(session_id: SecureRandom.hex,