Module: RockOAuth::Model::ResourceOwner

Defined in:
lib/rockoauth/model/resource_owner.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



5
6
7
8
9
10
# File 'lib/rockoauth/model/resource_owner.rb', line 5

def self.included(klass)
  klass.has_many :oauth2_authorizations,
  :class_name => Authorization.name,
  :as => :oauth2_resource_owner,
  :dependent => :destroy
end

Instance Method Details

#grant_access!(client, options = {}) ⇒ Object



12
13
14
# File 'lib/rockoauth/model/resource_owner.rb', line 12

def grant_access!(client, options = {})
  Authorization.for(self, client, options)
end

#oauth2_authorization_for(client) ⇒ Object



16
17
18
# File 'lib/rockoauth/model/resource_owner.rb', line 16

def oauth2_authorization_for(client)
  oauth2_authorizations.find_by_client_id(client.id)
end