class Doorkeeper::Application

Public Class 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/application.rb, line 29
def self.authorized_for(resource_owner)
  resource_access_tokens = AccessToken.active_for(resource_owner)
  where(id: resource_access_tokens.select(:application_id).distinct)
end

Private Instance Methods

generate_secret() click to toggle source
# File lib/doorkeeper/orm/active_record/application.rb, line 40
def generate_secret
  self.secret = UniqueToken.generate if secret.blank?
end
generate_uid() click to toggle source
# File lib/doorkeeper/orm/active_record/application.rb, line 36
def generate_uid
  self.uid = UniqueToken.generate if uid.blank?
end