Hello Alessandro,
thank you for the fast answer. That seems to be exactly what I am
looking for. I have just confirmed that I am on TG2.2.2 and my code
looks like this now:
@expose('json')
@require(Any(has_any_permission('manage', 'web_json'), msg=u"not
allowed"), smart_denial=True)
def treegrid_data(self, *args, **kwargs):
...
The controller class itself does not have a @require
but unfortunately I still get Status 200 and the login-page. I am
testing with the RESTClient-Plugin for Firefox.
The only "special" thing I have done with authorization is that I
added BasicAuthPlugin to app_cfg.py.
Is there anything else I might have misconfigured?
Christian
2013/2/28 Alessandro Molina <[email protected]>:
> With TG2.2.2 setting smart_denial=True to the @require decorator and
> exposing 'json' should do what you are looking for.
>
>
> On Thu, Feb 28, 2013 at 12:19 PM, Christian Schanz
> <[email protected]> wrote:
>>
>> Hello,
>>
>> for some functions I need the HTTP return status 401 if the user tries
>> to access a function which has a @require decorator.
>> Currently I get back the Status 200 and the login-page.
>>
>> Is there any way to do this? I had a look at the denial_handler
>> argument of @require but have not managed to do what I want.
>>
>> Thanks,
>> Christian
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "TurboGears" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/turbogears?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/turbogears?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.