Module: OAuth2::Model::ResourceOwner
- Defined in:
- lib/oauth2/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/oauth2/model/resource_owner.rb', line 5 def self.included(klass) klass.has_many :oauth2_authorizations, :class_name => 'OAuth2::Model::Authorization', :as => :oauth2_resource_owner, :dependent => :destroy end |
Instance Method Details
#grant_access!(client, options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/oauth2/model/resource_owner.rb', line 12 def grant_access!(client, = {}) = .find_by_client_id(client.id) || Model::Authorization.create(:owner => self, :client => client) if scopes = [:scopes] scopes = .scopes + scopes .update_attribute(:scope, scopes.join(' ')) end end |