Re: Checking permission using route name?

2011-11-14 Thread Mike Orr
I'm not sure it's appropriate to check permissions based on route names. I haven't done this yet in Pyramid, but in Pylons I used external knowledge to decide if the user should see certain links, and passed a boolean to the template: true => show the links, false => don't show them. If the user so

Re: Checking permission using route name?

2011-11-14 Thread Michael Merickel
You can use pyramid.security.has_permission() to check access to a particular permission. view_execution_permitted is traversal-only. For has_permission() you just need to be sure to pass in the context that contains the correct ACLs for that view. On Mon, Nov 14, 2011 at 12:18 PM, Mark Erbaugh

Re: Checking permission using route name?

2011-11-14 Thread Mark Erbaugh
On Nov 14, 2011, at 10:29 AM, Mattias wrote: > Is there anyway to check if the user have the required permissions > when I only know the route_name? > > def main(global_config, **settings): > [snip] > config.add_route('administrations', '/administrations') > > class Administration(o

Checking permission using route name?

2011-11-14 Thread Mattias
Is there anyway to check if the user have the required permissions when I only know the route_name? def main(global_config, **settings): [snip] config.add_route('administrations', '/administrations') class Administration(object): def __init__(self, request):