lib/prx_auth/rails/token.rb in prx_auth-rails-4.1.0 vs lib/prx_auth/rails/token.rb in prx_auth-rails-4.2.0
- old
+ new
@@ -1,24 +1,24 @@
-require 'rack/prx_auth'
+require "rack/prx_auth"
class PrxAuth::Rails::Token
def initialize(token_data)
@token_data = token_data
@namespace = PrxAuth::Rails.configuration.namespace
end
- def authorized?(resource, namespace=nil, scope=nil)
+ def authorized?(resource, namespace = nil, scope = nil)
namespace, scope = @namespace, namespace if scope.nil? && !namespace.nil?
@token_data.authorized?(resource, namespace, scope)
end
- def globally_authorized?(namespace, scope=nil)
+ def globally_authorized?(namespace, scope = nil)
namespace, scope = @namespace, namespace if scope.nil?
@token_data.globally_authorized?(namespace, scope)
end
- def resources(namespace=nil, scope=nil)
+ def resources(namespace = nil, scope = nil)
namespace, scope = @namespace, namespace if scope.nil? && !namespace.nil?
@token_data.resources(namespace, scope)
end
def scopes
@@ -29,7 +29,20 @@
@token_data.user_id
end
def authorized_account_ids(scope)
@token_data.authorized_account_ids(scope)
+ end
+
+ def except!(*resources)
+ @token_data = @token_data.except(*resources)
+ self
+ end
+
+ def except(*resources)
+ dup.except!(*resources)
+ end
+
+ def empty_resources?
+ @token_data.empty_resources?
end
end