Module: Doorkeeper::Models::Scopes
- Included in:
- AccessGrantMixin, AccessTokenMixin, ApplicationMixin
- Defined in:
- lib/doorkeeper/models/concerns/scopes.rb
Instance Method Summary collapse
- #includes_scope?(*required_scopes) ⇒ Boolean
- #scopes ⇒ Object
- #scopes=(value) ⇒ Object
- #scopes_string ⇒ Object
Instance Method Details
#includes_scope?(*required_scopes) ⇒ Boolean
22 23 24 |
# File 'lib/doorkeeper/models/concerns/scopes.rb', line 22 def includes_scope?(*required_scopes) required_scopes.blank? || required_scopes.any? { |scope| scopes.exists?(scope.to_s) } end |
#scopes ⇒ Object
6 7 8 |
# File 'lib/doorkeeper/models/concerns/scopes.rb', line 6 def scopes OAuth::Scopes.from_string(scopes_string) end |
#scopes=(value) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/doorkeeper/models/concerns/scopes.rb', line 10 def scopes=(value) if value.is_a?(Array) super(Doorkeeper::OAuth::Scopes.from_array(value).to_s) else super(Doorkeeper::OAuth::Scopes.from_string(value.to_s).to_s) end end |
#scopes_string ⇒ Object
18 19 20 |
# File 'lib/doorkeeper/models/concerns/scopes.rb', line 18 def scopes_string self[:scopes] end |