RE: [Zope] Getting user permissions
I do this all over the place in a python product: user = getSecurityManager().getUser() if user.has_permission('Foo', ob) This is of course the same as your sample (if the user is a normal zope user object). So I would look somewhere else for the problem. -Randy
-----Original Message----- From: Andy McKay [mailto:andym@ActiveState.com] Sent: Wednesday, May 16, 2001 11:18 AM To: Steve Drees; zope@zope.org Subject: Re: [Zope] Getting user permissions
SecurityGetUser is the blessed way to get a user object.
I thought that was just for DTML? Thats inside /AccessControl/DTML.py... This is a Zope product.
Hmm I tried
s = getSecurityManager() for p in ['Foo',]: print s.checkPermission(p, parent)
and still get 1 for everyting. I would have thought as a default I would get 0 at the least. Oh this is weird.
Cheers. -- Andy McKay.
----- Original Message ----- From: "Steve Drees" <drees@the-bridge.net> To: "Andy McKay" <andym@activestate.com>; <zope@zope.org> Sent: Wednesday, May 16, 2001 11:06 AM Subject: RE: [Zope] Getting user permissions
user = self.REQUEST['AUTHENTICATED_USER'] for p in ['Foo',]: print user.has_permission(p, parent)
SecurityGetUser is the blessed way to get a user object.
I get 1 for everything. Is has_permission the correct call?
That I'm not sure of.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Have I found a bug? Lobbing in the collector it goes... The user account I was checking has the Manager permission. And according to ...AccessControl\PermissionRole.py def rolesForPermissionOn(perm, object, default=('Manager',)): Every permission defaults to having the Manager role on it, if not already sent. Meaning I cant seem to check the Manager role correctly. I changed this to def rolesForPermissionOn(perm, object, default=()): and it works exactly as I would expect, returning 1 for roles I have a right to and 0 for ones I dont. Im sure there is a reason for this but its weird. Cheers. -- Andy McKay. ----- Original Message ----- From: "Randall F. Kern" <randy@spoke.net> To: "Andy McKay" <andym@activestate.com>; "Steve Drees" <drees@the-bridge.net>; <zope@zope.org> Sent: Wednesday, May 16, 2001 11:39 AM Subject: RE: [Zope] Getting user permissions
I do this all over the place in a python product:
user = getSecurityManager().getUser() if user.has_permission('Foo', ob)
This is of course the same as your sample (if the user is a normal zope user object). So I would look somewhere else for the problem.
-Randy
-----Original Message----- From: Andy McKay [mailto:andym@ActiveState.com] Sent: Wednesday, May 16, 2001 11:18 AM To: Steve Drees; zope@zope.org Subject: Re: [Zope] Getting user permissions
SecurityGetUser is the blessed way to get a user object.
I thought that was just for DTML? Thats inside /AccessControl/DTML.py... This is a Zope product.
Hmm I tried
s = getSecurityManager() for p in ['Foo',]: print s.checkPermission(p, parent)
and still get 1 for everyting. I would have thought as a default I would get 0 at the least. Oh this is weird.
Cheers. -- Andy McKay.
----- Original Message ----- From: "Steve Drees" <drees@the-bridge.net> To: "Andy McKay" <andym@activestate.com>; <zope@zope.org> Sent: Wednesday, May 16, 2001 11:06 AM Subject: RE: [Zope] Getting user permissions
user = self.REQUEST['AUTHENTICATED_USER'] for p in ['Foo',]: print user.has_permission(p, parent)
SecurityGetUser is the blessed way to get a user object.
I get 1 for everything. Is has_permission the correct call?
That I'm not sure of.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Another (newer) way to do this is: from AccessControl import getSecurityManager getSecurityManager().checkPermission('Foo', ob) ----- Original Message ----- From: "Randall F. Kern" <randy@spoke.net> To: "Andy McKay" <andym@ActiveState.com>; "Steve Drees" <drees@the-bridge.net>; <zope@zope.org> Sent: Wednesday, May 16, 2001 2:39 PM Subject: RE: [Zope] Getting user permissions I do this all over the place in a python product: user = getSecurityManager().getUser() if user.has_permission('Foo', ob) This is of course the same as your sample (if the user is a normal zope user object). So I would look somewhere else for the problem. -Randy
-----Original Message----- From: Andy McKay [mailto:andym@ActiveState.com] Sent: Wednesday, May 16, 2001 11:18 AM To: Steve Drees; zope@zope.org Subject: Re: [Zope] Getting user permissions
SecurityGetUser is the blessed way to get a user object.
I thought that was just for DTML? Thats inside /AccessControl/DTML.py... This is a Zope product.
Hmm I tried
s = getSecurityManager() for p in ['Foo',]: print s.checkPermission(p, parent)
and still get 1 for everyting. I would have thought as a default I would get 0 at the least. Oh this is weird.
Cheers. -- Andy McKay.
----- Original Message ----- From: "Steve Drees" <drees@the-bridge.net> To: "Andy McKay" <andym@activestate.com>; <zope@zope.org> Sent: Wednesday, May 16, 2001 11:06 AM Subject: RE: [Zope] Getting user permissions
user = self.REQUEST['AUTHENTICATED_USER'] for p in ['Foo',]: print user.has_permission(p, parent)
SecurityGetUser is the blessed way to get a user object.
I get 1 for everything. Is has_permission the correct call?
That I'm not sure of.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Yep. The result is the same and its caused by Manager being the default role for any permission. Cheers. -- Andy McKay. ----- Original Message ----- From: "Chris McDonough" <chrism@digicool.com> To: "Randall F. Kern" <randy@spoke.net>; "Andy McKay" <andym@activestate.com>; "Steve Drees" <drees@the-bridge.net>; <zope@zope.org> Sent: Wednesday, May 16, 2001 12:29 PM Subject: Re: [Zope] Getting user permissions
Another (newer) way to do this is:
from AccessControl import getSecurityManager getSecurityManager().checkPermission('Foo', ob)
----- Original Message ----- From: "Randall F. Kern" <randy@spoke.net> To: "Andy McKay" <andym@ActiveState.com>; "Steve Drees" <drees@the-bridge.net>; <zope@zope.org> Sent: Wednesday, May 16, 2001 2:39 PM Subject: RE: [Zope] Getting user permissions
I do this all over the place in a python product:
user = getSecurityManager().getUser() if user.has_permission('Foo', ob)
This is of course the same as your sample (if the user is a normal zope user object). So I would look somewhere else for the problem.
-Randy
-----Original Message----- From: Andy McKay [mailto:andym@ActiveState.com] Sent: Wednesday, May 16, 2001 11:18 AM To: Steve Drees; zope@zope.org Subject: Re: [Zope] Getting user permissions
SecurityGetUser is the blessed way to get a user object.
I thought that was just for DTML? Thats inside /AccessControl/DTML.py... This is a Zope product.
Hmm I tried
s = getSecurityManager() for p in ['Foo',]: print s.checkPermission(p, parent)
and still get 1 for everyting. I would have thought as a default I would get 0 at the least. Oh this is weird.
Cheers. -- Andy McKay.
----- Original Message ----- From: "Steve Drees" <drees@the-bridge.net> To: "Andy McKay" <andym@activestate.com>; <zope@zope.org> Sent: Wednesday, May 16, 2001 11:06 AM Subject: RE: [Zope] Getting user permissions
user = self.REQUEST['AUTHENTICATED_USER'] for p in ['Foo',]: print user.has_permission(p, parent)
SecurityGetUser is the blessed way to get a user object.
I get 1 for everything. Is has_permission the correct call?
That I'm not sure of.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hello : I´m using gvibDA to use Interbase, and every thing was fine until now. I have to insert a long text inside a BLOB field. The text is capture inside a HTML form and then it is send to my Z SQL method. Some body have an idea how to do the INSERT. Thanks Victor Gimeno
Andy McKay wrote:
Yep. The result is the same and its caused by Manager being the default role for any permission.
I think Brian may have fixed this in CVS, but report it anyway, 'cos it might be somethign different (I reported that 'Manager' is always checked on the Security tab, which is wrong) cheers, Chris
participants (5)
-
Andy McKay -
Chris McDonough -
Chris Withers -
Randall F. Kern -
vgimeno@seguridata.com