Methods
Included Modules
- Helper
Attributes
| [R] | project_modules | |
| [R] | roles |
Public Instance methods
Globally allow an action of a controller for the current role
[ show source ]
# File lib/access_control/base.rb, line 94
94: def allow_action(path)
95: @allowed << recognize_path(path)
96: end
Globally allow all actions from a controller for the current role
[ show source ]
# File lib/access_control/base.rb, line 104
104: def allow_all_actions(path)
105: @allowed << { :controller => recognize_path(path)[:controller] }
106: end
Return allowed actions/controllers
[ show source ]
# File lib/access_control/base.rb, line 119
119: def allowed
120: # I know is a double check but is better 2 times that no one.
121: if allowed?
122: @project_modules.each { |pm| @allowed.concat pm.allowed }
123: @allowed.uniq
124: else
125: []
126: end
127: end
Return true if current_account role is included in given roles
[ show source ]
# File lib/access_control/base.rb, line 114
114: def allowed?
115: @roles.any? { |r| r.to_s.downcase == Account.find(@account_id).role.downcase }
116: end
Return denied actions/controllers
[ show source ]
# File lib/access_control/base.rb, line 130
130: def denied
131: @denied.uniq
132: end
Globally deny an action of a controllerfor the current role
[ show source ]
# File lib/access_control/base.rb, line 99
99: def deny_action(path)
100: @denied << recognize_path(path)
101: end
Globally denty all actions from a controller for the current role
[ show source ]
# File lib/access_control/base.rb, line 109
109: def deny_all_actions(path)
110: @denied << { :controller => recognize_path(path)[:controller] }
111: end
Create a new project module
[ show source ]
# File lib/access_control/base.rb, line 89
89: def project_module(name, controller=nil, &block)
90: @project_modules << ProjectModule.new(name, controller, &block)
91: end