Revision acfbc458
Added by Marek Hulán about 10 years ago
app/helpers/common_parameters_helper.rb | ||
---|---|---|
module CommonParametersHelper
|
||
# Return true if user is authorized for controller/action OR controller/action@type, otherwise false
|
||
def authorized_via_my_scope(controller, action)
|
||
return true if authorized_for(controller, action)
|
||
|
||
operation = "#{action}_my_#{controller.singularize}".to_sym
|
||
User.current.allowed_to?(operation) and User.current.send(controller).include?(instance_variable_get("@#{controller.singularize}"))
|
||
# third argument may be specific object (usually for edit and destroy actions)
|
||
def authorized_via_my_scope(controller, action, object = nil)
|
||
authorized_for(:controller => controller, :action => action, :auth_object => object)
|
||
end
|
||
|
||
def parameters_title
|
Also available in: Unified diff
fixes #812 - new permissions model, user group role and nest support, role filters for better granularity
Contributions from: