class Garage::TokenScope
Public Class Methods
ability(user, scopes)
click to toggle source
# File lib/garage/token_scope.rb, line 28 def self.ability(user, scopes) scopes = scopes.map(&:to_sym) scopes = [:public] if scopes.empty? # backward compatiblity for scopes without any scope, assuming public Ability.new(user, configuration.scopes.slice(*scopes).values) end
all_scopes()
click to toggle source
# File lib/garage/token_scope.rb, line 12 def self.all_scopes configuration.scopes.values end
configuration()
click to toggle source
# File lib/garage/token_scope.rb, line 8 def self.configuration @config or raise "Garage::TokenScope.configure must be called in initializer" end
configure(&block)
click to toggle source
# File lib/garage/token_scope.rb, line 3 def self.configure(&block) @config = Config.new @config.instance_eval(&block) end
optional_scopes()
click to toggle source
# File lib/garage/token_scope.rb, line 16 def self.optional_scopes configuration.scopes.values.select(&:optional?) end
revealed_scopes()
click to toggle source
# File lib/garage/token_scope.rb, line 20 def self.revealed_scopes configuration.scopes.values.reject(&:hidden?) end