Re: AW: [Zope3-Users] How to check access on a view?

2008-02-18 Thread Hermann Himmelbauer
Am Sonntag, 17. Februar 2008 12:41 schrieb Roger Ineichen:
> Hi Hermann
>
> > Betreff: Re: [Zope3-Users] How to check access on a view?
>
> [...]
>
> > > Hi,
> > > For a simple menu, I need to check if the current principal has
> > > permissions to access a view. I understand that I can use the
> > > canAccess()/canWrite() function on object attributes but
> >
> > how could I
> >
> > > do this for views?
>
> import zope.security
> zope.security.canAccess(myView, '__call__') should work.
> Or if the view provides a render method, you can check
> zope.security.canAccess(myView, 'render').

Yes, many thanks, this did the trick!

Best Regards,
Hermann

-- 
[EMAIL PROTECTED]
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


AW: [Zope3-Users] How to check access on a view?

2008-02-17 Thread Roger Ineichen
Hi Hermann

> Betreff: Re: [Zope3-Users] How to check access on a view?

[...]

> > Hi,
> > For a simple menu, I need to check if the current principal has 
> > permissions to access a view. I understand that I can use the 
> > canAccess()/canWrite() function on object attributes but 
> how could I 
> > do this for views?

import zope.security
zope.security.canAccess(myView, '__call__') should work.
Or if the view provides a render method, you can check
zope.security.canAccess(myView, 'render').

See zope.viewlet, there we use this pattern in the viewlet manager
zope.viewlet.manager line 85.

Regards
Roger Ineichen

> > Best Regards,
> > Hermann

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] How to check access on a view?

2008-02-16 Thread Randy Crafton

Hermann,

Take a look at z3c.securitytool. I think it's still a work in  
progress, but I'm certain there's something there that will help you  
out.


-Randy



On Feb 16, 2008, at 5:53 PM, Hermann Himmelbauer wrote:


Hi,
For a simple menu, I need to check if the current principal has  
permissions to

access a view. I understand that I can use the canAccess()/canWrite()
function on object attributes but how could I do this for views?

Best Regards,
Hermann

--
[EMAIL PROTECTED]
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users



___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] How to check access on a view?

2008-02-16 Thread Hermann Himmelbauer
Hi,
For a simple menu, I need to check if the current principal has permissions to 
access a view. I understand that I can use the canAccess()/canWrite() 
function on object attributes but how could I do this for views?

Best Regards,
Hermann

-- 
[EMAIL PROTECTED]
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users