Class: RouteAuthorizer::Permission

Inherits:
Object
  • Object
show all
Includes:
PermissionDSL
Defined in:
lib/route_authorizer/permission.rb

Direct Known Subclasses

Permission

Instance Method Summary collapse

Methods included from PermissionDSL

#permit, #permit_all

Constructor Details

#initialize(role) ⇒ Permission

Returns a new instance of Permission.



5
6
7
# File 'lib/route_authorizer/permission.rb', line 5

def initialize(role)
  @role = role.to_s
end

Instance Method Details

#permit?(controller_path, action_name) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
# File 'lib/route_authorizer/permission.rb', line 9

def permit?(controller_path, action_name)
  permit_action? [
    [:all],
    [controller_path.to_sym, :all],
    [controller_path.to_sym, action_name.to_sym],
  ]
end