On Lunes, 26 de Abril de 2010 07:45:41 stam escribió:
> Hi all,
>
> First of all, great job on building a great plugin.
>
> I had a question regarding the addition of the CRUD security methods
> to the models. I have written a user-roles-premissions framework in
> which an admin can define model level permissions on the fly. When
> such permissions are defined, I would like to add activescaffold
> security methods to the respective model on the fly. Following is how
> I'm trying to set it up at the moment on the model in which I need to
> specify security for the action...
>
> def self.add_column_security(method_name, module_name, action,
> field_name)
> if !method_defined?(method_name)
> logger.info("----> Creating security method - #{method_name}
> (#{module_name}, #{action}, #{field_name})")
> define_method(method_name) do
> logger.info("---->>> #{method_name} CALLED!!")
> current_user.action_allowed_for?(action, module_name,
> field_name)
> end
> end
> end
>
> I do not see the method being called though when I access the scaffold
> of the model. Could you guys point out what I'm doing wrong here, or
> if something like this is possible at all?
>
> Thanks
In development mode that won't work, classes are reloaded in each request.
In production mode I think that will fail when application is restarted.
--
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 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.