thanks for tips - yes I did have that inserted in the controller.
On Thu, Jul 26, 2012 at 2:01 PM, Anthony wrote:
>> The redirect in:
>> if not any(has_membership):
>> redirect(URL(r=request, c='default', f='index'))
>>
>> will not break the execution of models?
>
>
> Since the original code
>
> The redirect in:
> if not any(has_membership):
> redirect(URL(r=request, c='default', f='index'))
>
> will not break the execution of models?
>
Since the original code did not test for the controller, I assumed it was
inserted at the top of the controller in question, which would allow a
>
> You can do in the way anthony said, but you can do it all in models, no
>> need to touch controller code.
>
>
> Note, I did suggest moving it to a model file to avoid unnecessarily
> executing all the models.
>
The redirect in:
if not any(has_membership):
redirect(URL(r=request, c='default
>
> You can do in the way anthony said, but you can do it all in models, no
> need to touch controller code.
Note, I did suggest moving it to a model file to avoid unnecessarily
executing all the models.
Anthony
--
You can do in the way anthony said, but you can do it all in models, no
need to touch controller code.
models/...py
auth = Auth()
# a dict of controllers as keys, and a list of allowed groups as values
auth_rules = {
"defau
That looks pretty good. If you want to avoid running all your models, you
can put that logic early in your models (obviously somewhere after auth is
defined):
if request.controller == 'secret_stuff' and not auth.has_membership('admin'
):
Anthony
On Wednesday, July 25, 2012 9:14:31 PM UTC-4, Ri
I mean is there a better way than something like:
if not auth.has_membership('admin'):
session.flash = 'You are not part of the admin group'
redirect(URL(r=request, c='default', f='index'))
--
7 matches
Mail list logo