Hi! I'm stuck with a problem here and hope someone can help me out ... I try to make a folder & file tree view using the code: DTML-method - show_tree <dtml-tree branches_expr="objectValues(['Folder, 'File'])" sort=meta_type> <dtml-var title_or_id> </dtml-tree> Accessing the show_tree method as manager displays all correctly, but when I try to access the method as another user I get 'authorization failed'. I find this strange since the user has aquired the permissions : 'access contents information' and 'view' to the methods parent folder, the same permission setting is set for the folders and files therein. I can trick it so that the user is proxyed as manager on the method, but thats not what I want - I will block access to all but the authenticated users private files and folders in the future. Please tell me whats I do wrong and how I can fix this. Thanks in advance Sture Lygren
Sture Lygren wrote:
Hi!
I'm stuck with a problem here and hope someone can help me out ...
I try to make a folder & file tree view using the code:
DTML-method - show_tree
<dtml-tree branches_expr="objectValues(['Folder, 'File'])"
Use <dtml-tree branches_expr="objectValues(['Folder', 'File'])" skip_unauthorized=1> -Michel
Hello again! Your answer helped get the method working - thanks! But now I'm stuck with a new problem (as always). I try to use the method quoted below to show private and public folders for a user. Trouble is all I get is the '+' and '-' signs on expandable and collapsabe folders, no icon and no text. Only the manager get the correct icons and text shown. Why is this so? DTML-method show_tree accessed from index_html (also a DTML-method): <dtml-tree branches_expr="objectValues(['Folder','File'])" sort=id skip_unauthorized=1> <dtml-if "AUTHENTICATED_USER.has_role('Owner',_.getitem('id',1)) or AUTHENTICATED_USER.has_permission('View',_.getitem('id',1))"> <dtml-if "meta_type=='Folder'"> <img src="<dtml-var SCRIPT_NAME>/<dtml-var icon>" border="0"> <dtml-var id> <dtml-else> <a href="<dtml-var tree-item-url>"><img src="<dtml-var SCRIPT_NAME>/<dtml-var icon>" border="0"> <dtml-var id></a> </dtml-if> </dtml-if> </dtml-tree> Hope you can help me out here. Thanks in advance. Sture Lygren Michel Pelletier wrote:
Sture Lygren wrote:
Hi!
I'm stuck with a problem here and hope someone can help me out ...
I try to make a folder & file tree view using the code:
DTML-method - show_tree
<dtml-tree branches_expr="objectValues(['Folder, 'File'])"
Use <dtml-tree branches_expr="objectValues(['Folder', 'File'])" skip_unauthorized=1>
-Michel
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(Related lists - please, no cross posts or HTML encoding!
To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
At 21:59 3-10-99 , Sture Lygren wrote:
Hello again!
Your answer helped get the method working - thanks!
But now I'm stuck with a new problem (as always). I try to use the method quoted below to show private and public folders for a user. Trouble is all I get is the '+' and '-' signs on expandable and collapsabe folders, no icon and no text. Only the manager get the correct icons and text shown. Why is this so?
DTML-method show_tree accessed from index_html (also a DTML-method):
<dtml-tree branches_expr="objectValues(['Folder','File'])" sort=id skip_unauthorized=1> <dtml-if "AUTHENTICATED_USER.has_role('Owner',_.getitem('id',1)) or AUTHENTICATED_USER.has_permission('View',_.getitem('id',1))"> <dtml-if "meta_type=='Folder'"> <img src="<dtml-var SCRIPT_NAME>/<dtml-var icon>" border="0"> <dtml-var id> <dtml-else> <a href="<dtml-var tree-item-url>"><img src="<dtml-var SCRIPT_NAME>/<dtml-var icon>" border="0"> <dtml-var id></a> </dtml-if> </dtml-if> </dtml-tree>
That's because you are trying to assess the permissions in the context of _.getitem('id',1), which will return the id of the currently assessed object in the tree. This is a string, not, as it should be, an object. Try this: <dtml-tree branches_expr="objectValues(['Folder','File'])" sort=id skip_unauthorized=1> <dtml-if "AUTHENTICATED_USER.has_role('Owner',this()) or AUTHENTICATED_USER.has_permission('View',this())"> <dtml-if "meta_type=='Folder'"> <img src="<dtml-var SCRIPT_NAME>/<dtml-var icon>" border="0"> <dtml-var id> <dtml-else> <a href="<dtml-var tree-item-url>"><img src="<dtml-var SCRIPT_NAME>/<dtml-var icon>" border="0"> <dtml-var id></a> </dtml-if> </dtml-if> </dtml-tree> but I think you can leave out the has_role test completely, because the skip_unauthorized will only return objects the current visitor has access to anyway. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | T: +31 35 7502100 F: +31 35 7502111 | mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ---------------------------------------------
participants (3)
-
Martijn Pieters -
Michel Pelletier -
Sture Lygren