Module: Doorkeeper::OAuth::Helpers::ScopeChecker

Defined in:
lib/doorkeeper/oauth/helpers/scope_checker.rb

Class Method Summary collapse

Class Method Details

.matches?(current_scopes, scopes) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
# File 'lib/doorkeeper/oauth/helpers/scope_checker.rb', line 5

def self.matches?(current_scopes, scopes)
  return false if current_scopes.nil? || scopes.nil?
  current_scopes == scopes
end

.valid?(scope, server_scopes) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
# File 'lib/doorkeeper/oauth/helpers/scope_checker.rb', line 10

def self.valid?(scope, server_scopes)
  scope.present? &&
  scope !~ /[\n|\r|\t]/ &&
  server_scopes.has_scopes?(Doorkeeper::OAuth::Scopes.from_string(scope))
end