[decl_auth] setting permissions for a no-model controller

19 vues
Accéder directement au premier message non lu

John Joseph Bachir

non lue,
29 avr. 2010, 18:15:4429/04/2010
à declarative_...@googlegroups.com
I have a controller which does not operate on a corresponding model

As far as i can tell, has_pemission_on :foos expects Foo to be a model, and not an arbitrary FooController.

 1. Is this correct?
 2. If so, how do I set authorizatio rules on my no-model controller?

Thanks!

John

--
You received this message because you are subscribed to the Google Groups "declarative_authorization" group.
To post to this group, send email to declarative_...@googlegroups.com.
To unsubscribe from this group, send email to declarative_author...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/declarative_authorization?hl=en.

Steffen Bartsch

non lue,
2 mai 2010, 06:10:2302/05/2010
à declarative_...@googlegroups.com
Am Freitag, 30. April 2010 schrieb John Joseph Bachir:
> As far as i can tell, has_pemission_on :foos expects Foo to be a model, and
> not an arbitrary FooController.
>
> 1. Is this correct?
> 2. If so, how do I set authorizatio rules on my no-model controller?

Generally, the context like :foos is just an identifier. Out of convention,
the context is often linked to a model. That helps as e.g.
filter_resource_access may then automatically load objects.

Still, you may explicitly set a different context than the controller name for
filter_resource_access etc. Alternatively, you can use filter_access_to
without object loading with a context that has no corresponding model.

Steffen

John Joseph Bachir

non lue,
6 mai 2010, 16:23:2206/05/2010
à declarative_...@googlegroups.com
2010/5/2 Steffen Bartsch <sbar...@tzi.de>
Still, you may explicitly set a different context than the controller name for
filter_resource_access etc.  Alternatively, you can use filter_access_to
without object loading with a context that has no corresponding model.

:context worked pefectly, thanks!

It occurs to me that I should probably be looking in the README.rdoc more as a table of context to find such things myself.

john
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message