Module: OAuth2::Provider::Models::Authorization
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/oauth2/provider/models/authorization.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #has_scope?(s) ⇒ Boolean
- #resource_owner ⇒ Object
- #resource_owner=(ro) ⇒ Object
- #resource_owner_class ⇒ Object
- #revoke ⇒ Object
Instance Method Details
#has_scope?(s) ⇒ Boolean
11 12 13 |
# File 'lib/oauth2/provider/models/authorization.rb', line 11 def has_scope?(s) scope && scope.split(" ").include?(s) end |
#resource_owner ⇒ Object
26 27 28 |
# File 'lib/oauth2/provider/models/authorization.rb', line 26 def resource_owner resource_owner_id && resource_owner_class.find(resource_owner_id) end |
#resource_owner=(ro) ⇒ Object
21 22 23 24 |
# File 'lib/oauth2/provider/models/authorization.rb', line 21 def resource_owner=(ro) self.resource_owner_id = ro && ro.id self.resource_owner_type = ro && ro.class.name end |
#resource_owner_class ⇒ Object
30 31 32 |
# File 'lib/oauth2/provider/models/authorization.rb', line 30 def resource_owner_class resource_owner_type.constantize end |
#revoke ⇒ Object
15 16 17 18 19 |
# File 'lib/oauth2/provider/models/authorization.rb', line 15 def revoke .destroy_all access_tokens.destroy_all destroy end |