I have a Rails app that uses ActiveScaffold for the admin interface.
I'm trying to secure the admin interface by only allowing access to a
User who has the "Admin" Privilege (Users habtm Privileges, and
vice-versa).
In my ApplicationController, I've defined my current_user_method as follows:
ActiveScaffold.set_defaults do |config|
config.security.current_user_method = :the_user
end
protected
def the_user
session[:current_login] ? Login.find(session[:current_login]).user : nil
end
I would like to be able to globally turn on and turn off the admin
interface depending on the :current_user's privileges. I thought I
could add a second line to my above code like so:
ActiveScaffold.set_defaults do |config|
config.security.current_user_method = :the_user
config.security.default_permission = current_user.privileges.include?(Admin)
end
But I'm getting a NoMethodError on current_user.
Any clues as to what I'm doing wrong? Or suggestions as to how I
could do it right?
Thanks,
Carl
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---