I am using acl9 on top of authlogic on one of my projects. I like the approach acl9's approach but I guess I am trying to do something that is just not that simple (not to say impossible).
For reasons of usability I would like to have an inline admin panel. So for example say I got a resource auction and a nested resource auction/bid. When a normal user is on auctions/1 (1=id) he should see the "normal" stuff (description, price...), a privileged user on the same site should have additional links for editing an auction (= auctions/1/edit). And this is where the fun starts.
Maybe I did not look close enough or in the wrong places but I could not find way to determine wether my current user is authorized for the edit action. Obviously I could display the link to everyone and let the edit action reject the normal user, but that is not a viable option. What bugs me here is that the information is already in the system (see the access_control
block below) and I can't seem to find a way to use it. This is not DRY on so many levels.
access_control do
allow :privileged, :to => [:index, :show, :edit, :update]
allow anonymous, :to => [:new, :show, :create]
end
It becomes even worse if I want to determine which rights a user has on auctions/1/bids/2/edit
because this is in a totally different controller.
How can I access that information in advance and then decide whether to display a link to edit at all? Is it just not possible (without changing acl9 itself) or did I not look hard enough? Are there any authorization plugins that meet my requirements better?