module Doorkeeper::Orm::ActiveRecord::Mixins::Application::ClassMethods

Public Instance Methods

authorized_for(resource_owner) click to toggle source

Returns Applications associated with active (not revoked) Access Tokens that are owned by the specific Resource Owner.

@param resource_owner [ActiveRecord::Base]

Resource Owner model instance

@return [ActiveRecord::Relation]

Applications authorized for the Resource Owner
# File lib/doorkeeper/orm/active_record/mixins/application.rb, line 192
def authorized_for(resource_owner)
  resource_access_tokens = Doorkeeper.config.access_token_model.active_for(resource_owner)
  where(id: resource_access_tokens.select(:application_id).distinct)
end
revoke_tokens_and_grants_for(id, resource_owner) click to toggle source

Revokes AccessToken and AccessGrant records that have not been revoked and associated with the specific Application and Resource Owner.

@param resource_owner [ActiveRecord::Base]

instance of the Resource Owner model
# File lib/doorkeeper/orm/active_record/mixins/application.rb, line 203
def revoke_tokens_and_grants_for(id, resource_owner)
  Doorkeeper.config.access_token_model.revoke_all_for(id, resource_owner)
  Doorkeeper.config.access_grant_model.revoke_all_for(id, resource_owner)
end

Private Instance Methods

compute_doorkeeper_table_name() click to toggle source
# File lib/doorkeeper/orm/active_record/mixins/application.rb, line 210
def compute_doorkeeper_table_name
  table_name = "oauth_application"
  table_name = table_name.pluralize if pluralize_table_names
  "#{table_name_prefix}#{table_name}#{table_name_suffix}"
end