Class: ApiValve::PermissionHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/api_valve/permission_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(env, options = {}) ⇒ PermissionHandler

Returns a new instance of PermissionHandler.



3
4
5
6
# File 'lib/api_valve/permission_handler.rb', line 3

def initialize(env, options = {})
  @env = env
  @options = options.with_indifferent_access
end

Instance Method Details

#allowed?Boolean

Run permission checks Simple implementation is always true. Override in your implementation.

Returns:

  • (Boolean)


10
11
12
# File 'lib/api_valve/permission_handler.rb', line 10

def allowed?
  true
end

#messageObject

Returns string message why access was denied Rendered on the API. Override in your implementation.



17
18
19
# File 'lib/api_valve/permission_handler.rb', line 17

def message
  'Insufficient permissions'
end