I have an app that has a very simple authorization scheme. A person can
have
many roles and roles can have many people.
In my app, I’d like to do
before_filter :login_required (since no role name is provided, it
accepts
any users with credentials)
before_filter :login_required (“administrator”) (only accepts those with
role administrator)
before_filter :login_required {“administrator”, “buyer”, “seller”}
(accepts
those with roles admin, buyer, seller)
Now, I know the only way you can achieve this is to use the lambda
function,
but to me it looks very ugly. Right now I have multiple before_filter,
first
checking if they are logged in, then checking their role, etc.
Is there any other way around this that Im not seeing? I tried to come
up
with an answer using sessions, but it got far too complicated.
lovely! I was able to get your acl system running, and its working
smooth as
butter now. I wasn’t being DRY in my code and this really cleaned things
up.
Thank you very much,