Module: Aclize::Helper

Included in:
ApplicationHelper
Defined in:
lib/aclize/helper.rb

Instance Method Summary collapse

Instance Method Details

#aclized?Boolean

Returns:

  • (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

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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_roleObject



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

Returns:

  • (Boolean)


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