Module: Doorkeeper::Models::Scopes

Included in:
AccessGrantMixin, AccessTokenMixin, ApplicationMixin
Defined in:
lib/doorkeeper/models/concerns/scopes.rb

Instance Method Summary collapse

Instance Method Details

#includes_scope?(*required_scopes) ⇒ Boolean

Returns:

  • (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

#scopesObject


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_stringObject


18
19
20
# File 'lib/doorkeeper/models/concerns/scopes.rb', line 18

def scopes_string
  self[:scopes]
end