Displaying 2 results from an estimated 2 matches for "authorize_user".
2006 Jul 14
4
sending additional parameters to before_filter
i am trying to create a system so that different users have different
priviliges on my application. i was going to modify my authorize
function so that i could pass the required role to it and have it check
the current user for that role.
i am using before_filter and would like to have just one function
instead of writing one for each role like so:
authorize(role)
instead of:
2009 May 15
0
[PATCH server] final cleanup for service layer refactoring.
...re_edit
- end
- def tmp_authorize_admin
- authorize_admin
- end
- def pre_create
- end
- def pre_show
- end
-
- # These authorize_XXX methods should go away once we're fully converted to
- # the service layer
- def authorize_view
- authorize_action(Privilege::VIEW)
- end
- def authorize_user
- authorize_action(Privilege::VM_CONTROL)
- end
- def authorize_admin
- authorize_action(Privilege::MODIFY)
- end
- def authorize_action(privilege)
- authorized!(privilege)
- true
- end
-
def handle_perm_error(error)
handle_error(:error => error, :status => :forbidden...