I think it is excellent to use modules, Bruno.

Can you provide some guidance or url where I can learn how to do it in
modules rather than models?

Thank you, I appreciate your suggestions.


On Dec 30, 1:22 pm, Bruno Rocha <rochacbr...@gmail.com> wrote:
> Access control decorators are designed to work in controller actions only,
> because actions define workflow of the application, even if you have code
> in modules, the action is what your user will call.
>
> But, you can always use other methods to check permissions etc..
>
> in modulesyou can do [ auth.has_permission(), auth.has_membership(), if
> auth.user.id: ]
>
> but have in mind that if your Auth instance is created in models, you will
> have to always pass it to the module or use the current object.
>
> I am not using models anymore, so all my objects (db, crud, auth, service)
> are created in modules and I have access to them.
>
> On Fri, Dec 30, 2011 at 12:52 AM, lyn2py <lyn...@gmail.com> wrote:
> > In controllers, it would look like:
>
> > @auth.requires_login()
> > def function():
> >    pass
>
> > How do I implement requires_login (and other auth decorators)
> > correctly in module methods that require access control?
>
> > Thanks!
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]

Reply via email to