Perfect. Thanks, Anthony.

On Wednesday, October 8, 2014 10:31:32 AM UTC-5, Anthony wrote:
>
> In a model file (after auth has been defined), you can do:
>
> auth.has_membership('admin') or redirect(auth.settings.login_url)
>
> If you want the usual behavior of the @auth.requires_membership() 
> decorator (i.e., automatic redirect with _next, flash message, etc.), then 
> you can instead do something like:
>
> if not (request.url == auth.settings.login_url):
>     auth.requires_membership('admin')(lambda: None)()
>
> The advantage of these methods (over delegating to the admin app) is that 
> you can provide access to users who should not have complete admin app 
> privileges.
>
> Anthony
>
> On Wednesday, October 8, 2014 10:06:36 AM UTC-4, Spokes wrote:
>>
>> Individual views can be password protected with decorators, but I was 
>> wondering if there's a quick and convenient way to password-protect an 
>> entire web2py site. My intention is to only give access to people involved 
>> in the site's development. Thank you.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to