[decl_auth] setting permissions for a no-model controller

20 views
Skip to first unread message

John Joseph Bachir

unread,
Apr 29, 2010, 6:15:44 PM4/29/10
to 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

unread,
May 2, 2010, 6:10:23 AM5/2/10
to 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

unread,
May 6, 2010, 4:23:22 PM5/6/10
to 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
Reply all
Reply to author
Forward
0 new messages