manage_access: show permissions for a user
G'Day! How can I get to the source of "manage_access"? That's the link if you click on the security tab and does exactely what I want to do: Checking in DTML if user X has permission Y to access file Z. In my opinion, it should be something like: <!--#call show_permission('View', 'Manager') --> but this call does not exist, and with manage_permission I can only change permissions, but not display them. Any help out there? Please reply to me directly, hence I am not always reading the mailing list. Thanks, Floyd -- http://floyd.va.com.au
On Wed, Jul 28, 1999 at 01:04:43AM +0200, Florian Mueller wrote:
G'Day!
How can I get to the source of "manage_access"? That's the link if you click on the security tab and does exactely what I want to do: Checking in DTML if user X has permission Y to access file Z.
wallace$ pwd /extra/src/Zope/lib wallace$ find . -name \*.py -o -name -*.dtml | xargs grep 'def manage_access'./python/AccessControl/Role.py: def manage_access( wallace$ So, {ZOPE_INSTALL}/lib/python/AccessControl is the place to look, in particular, in Role.py. Remember that any method beginning with _ cannot be called from DTML. Ross -- Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> NSBRI Research Scientist/Programmer Computer and Information Technology Institute Rice University, 6100 S. Main St., Houston, TX 77005
Unfortunately, I do not have telnet access to the zope installation, so I cannot look it up the way you suggested. So once again, how can I check in DTML if user X has permission Y to access file Z? In my opinion, it should be something like: <!--#call show_permission('View', 'Manager') --> but this call does not exist, and with manage_permission I can only change permissions, but not display them. Any help out there? Please reply to me directly, hence I am not always reading the mailing list. Thanks, Floyd "Ross J. Reedstrom" wrote:
On Wed, Jul 28, 1999 at 01:04:43AM +0200, Florian Mueller wrote:
G'Day!
How can I get to the source of "manage_access"? That's the link if you click on the security tab and does exactely what I want to do: Checking in DTML if user X has permission Y to access file Z.
wallace$ pwd /extra/src/Zope/lib wallace$ find . -name \*.py -o -name -*.dtml | xargs grep 'def manage_access'./python/AccessControl/Role.py: def manage_access( wallace$
So, {ZOPE_INSTALL}/lib/python/AccessControl is the place to look, in particular, in Role.py. Remember that any method beginning with _ cannot be called from DTML.
Ross -- Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> NSBRI Research Scientist/Programmer Computer and Information Technology Institute Rice University, 6100 S. Main St., Houston, TX 77005
At 09:44 PM 7/29/99 +0200, Florian Mueller wrote:
Unfortunately, I do not have telnet access to the zope installation, so I cannot look it up the way you suggested. So once again, how can I check in DTML if user X has permission Y to access file Z?
In my opinion, it should be something like: <!--#call show_permission('View', 'Manager') --> but this call does not exist, and with manage_permission I can only change permissions, but not display them.
I believe that this came up on the list a little while ago. Take a look at OFS.AccessControl.User.has_permission and User.has_role def has_permission(self, permission, object): """Check to see if a user has a given permission on an object.""" def has_role(self, roles, object=None): """Check to see if a user has a given role or roles.""" Here's an example, <!--#if "AUTHENTICATED_USER.has_permission(myFile,'View')"--> <a href="./myFile">View the file</a> <!--#else--> You are not authorized to see the file. <!--#/if--> -Amos
Thanks for the hint! I got the .has_role to work, but the AUTHENTICATED_USER.has_permission(myFile,'View') is not working for me: I think I have to write ('View',myFile) but still, I have no clue what to replace myFile with. I want to check the permission of the actual file, i.e. the file which contains this code, and also the permission settings of the folder containing this file. Any help would be highly appreciated. Cheers, Floyd Amos Latteier wrote:
At 09:44 PM 7/29/99 +0200, Florian Mueller wrote:
Unfortunately, I do not have telnet access to the zope installation, so I cannot look it up the way you suggested. So once again, how can I check in DTML if user X has permission Y to access file Z?
In my opinion, it should be something like: <!--#call show_permission('View', 'Manager') --> but this call does not exist, and with manage_permission I can only change permissions, but not display them.
I believe that this came up on the list a little while ago.
Take a look at OFS.AccessControl.User.has_permission and User.has_role
def has_permission(self, permission, object): """Check to see if a user has a given permission on an object."""
def has_role(self, roles, object=None): """Check to see if a user has a given role or roles."""
Here's an example,
<!--#if "AUTHENTICATED_USER.has_permission(myFile,'View')"--> <a href="./myFile">View the file</a> <!--#else--> You are not authorized to see the file. <!--#/if-->
-Amos
participants (3)
-
Amos Latteier -
Florian Mueller -
Ross J. Reedstrom