i have this code in a module file. (module LoginSystem)
def module_backend_required(the_module = “test”,the_action = “test”)
p “-----------------------”
p “the_module” + the_module
p “the_action” + the_action
p “-----------------------”
if not protect?(action_name)
return true
end
if @session[:backend] and authorize?(@session[:backend])
return true
end
# store current location so that we can
# come back after the user logged in
store_location
# call overwriteable reaction to unauthorized access
access_denied
return false
end
an user has a role, and a role has many modulepermissions
like module: books , actions: create, read, edit, …
in my controller i have this
before_filter :module_backend_required(‘users’,‘update’), :only => [
:edit, :update ]
=>> syntax error on ‘users’,‘update’
when i do before_filter :module_backend_required(), :only => [ :edit,
:update ]
the controle prints
the_moduletest
the_actiontest
How can i get the 2 parameters? so i dont need to make a lot functions
for each module/action.
Thanks