El Thursday 23 October 2008 19:23:03 Carl Spitzer escribió:
> 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

Try with config.security.default_permission = the_user and 
the_user.privileges.include?(Admin)
I haven't tried it

-- 
Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
Nicolás Guillén 6, locales 2 y 3. 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

  • Im... Carl Spitzer
    • ... Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.

Reply via email to