Module: Aclize::Helper
- Included in:
- ApplicationHelper
- Defined in:
- lib/aclize/helper.rb
Instance Method Summary collapse
- #aclized? ⇒ Boolean
-
#action_allowed?(controller, action) ⇒ Boolean
Check if the user have permission to access the action.
-
#actions_allowed?(controller, actions = []) ⇒ Boolean
Returns a boolean that indicates if the current user have enought permissions to access the specified list of actions.
- #get_current_role ⇒ Object
-
#path_allowed?(path) ⇒ Boolean
Verify if the path could be accessed by the user.
Instance Method Details
#aclized? ⇒ Boolean
4 5 6 |
# File 'lib/aclize/helper.rb', line 4 def aclized? true end |
#action_allowed?(controller, action) ⇒ Boolean
Check if the user have permission to access the action
9 10 11 |
# File 'lib/aclize/helper.rb', line 9 def action_allowed?(controller, action) actions_allowed?(controller, [action]) end |
#actions_allowed?(controller, actions = []) ⇒ Boolean
Returns a boolean that indicates if the current user have enought permissions to access the specified list of actions.
16 17 18 19 |
# File 'lib/aclize/helper.rb', line 16 def actions_allowed?(controller, actions = []) acl = @_aclize_acl.get_acl_for(get_current_role) return acl.controllers.permitted?(controller, actions) end |
#get_current_role ⇒ Object
30 31 32 |
# File 'lib/aclize/helper.rb', line 30 def get_current_role return @_aclize_current_role || :all end |
#path_allowed?(path) ⇒ Boolean
Verify if the path could be accessed by the user. Returns true when the path is accessible
24 25 26 27 |
# File 'lib/aclize/helper.rb', line 24 def path_allowed?(path) acl = @_aclize_acl.get_acl_for(get_current_role) return acl.paths.permitted?(path) end |