Can this be done from a script? Lets say you have the following directory structure: ROOT/A/B/C/D/E user TEMP is in the acl_user folder in the 'C' directory and hence can log in only at ROOT/A/B/C directory and upwards. lets say he logs in a ROOT/A/B/C/D/E/F I would like to know at which level he was authorized. I am not keen about changing manage user permissions. In otherwords I would like a script that loops back through parents checking to see if folders can be viewed. How can one predict whether a user authorization dialogue will appear. How can one interupt a authorization dialogue from appearing. Thanks Chris
chrisf wrote:
Can this be done from a script?
Lets say you have the following directory structure:
ROOT/A/B/C/D/E
user TEMP is in the acl_user folder in the 'C' directory and hence can log in only at ROOT/A/B/C directory and upwards. lets say he logs in a ROOT/A/B/C/D/E/F I would like to know at which level he was authorized. I am not keen about changing manage user permissions. In otherwords I would like a script that loops back through parents checking to see if folders can be viewed. How can one predict whether a user authorization dialogue will appear. How can one interupt a authorization dialogue from appearing.
Thanks Chris
Unfortunately you didn't tell which kind of script: in dtml: <dtml-in > has the skip_unauthorized attribute <dtml-try> <dtml-except > in python: use try:..except HTH, oliver
Oliver Bleutgen wrote:
chrisf wrote:
Can this be done from a script?
Lets say you have the following directory structure:
ROOT/A/B/C/D/E
user TEMP is in the acl_user folder in the 'C' directory and hence can log in only at ROOT/A/B/C directory and upwards. lets say he logs in a ROOT/A/B/C/D/E/F I would like to know at which level he was authorized. I am not keen about changing manage user permissions. In otherwords I would like a script that loops back through parents checking to see if folders can be viewed. How can one predict whether a user authorization dialogue will appear. How can one interupt a authorization dialogue from appearing.
Thanks Chris
Unfortunately you didn't tell which kind of script:
Script is a python script within a ZCLASS product. skip_unauthorized doesn't work. <dtml-in "REQUEST.PARENTS" skip_unauthorized="1"> <dtml-var id> </dtml-in> Gives me the full root, not what I am authorized to access Ugghh Chris
chrisf wrote:
Can this be done from a script?
Lets say you have the following directory structure:
ROOT/A/B/C/D/E
user TEMP is in the acl_user folder in the 'C' directory and hence can log in only at ROOT/A/B/C directory and upwards. lets say he logs in a ROOT/A/B/C/D/E/F I would like to know at which level he was authorized.
not really possible, other than to say his user object came from the acl_users in the 'C' directory.
I am not keen about changing manage user permissions.
Why do you think you might need to do that?
In otherwords I would like a script that loops back through parents checking to see if folders can be viewed.
Not too hard, but potentially tricky so I won't attempt it here ;-)
How can one predict whether a user authorization dialogue will appear.
urm... that's what you're trying to do by checking which folders can be viewed.
How can one interupt a authorization dialogue from appearing.
You can catch the Unauthorized exception some time after it's raised and some time before it gets to ZPublisher. cheers, Chris
Tried this pythion script from within a ZCLASS product pub = ['changed'] for item in context.ZopeFind(context.Bio,obj_metatypes=['Course_Topic'], search_sub=1): if getattr(item[1],'index_html'):pub.append(item[1].absolute_url()) return pub The getattr line triggers a User Authorization window (user, password). I just want the statement to fail, indicating that current user is not allowed access to that folder. Is that so '****' hard. I have tried skip_unauthorized in every possible syntax. It doesn't work. Maybe because it is being called from within a ZClass product. Who knows. I just want users to log in and be redirected to their 'Base'catalogue
Chris
_______________________________________________ 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 )
chrisf wrote:
Tried this pythion script from within a ZCLASS product
pub = ['changed'] for item in context.ZopeFind(context.Bio,obj_metatypes=['Course_Topic'], search_sub=1): if getattr(item[1],'index_html'):pub.append(item[1].absolute_url()) return pub
The getattr line triggers a User Authorization window (user, password). I just want the statement to fail, indicating that current user is not allowed access to that folder. Is that so '****' hard. I have tried skip_unauthorized in every possible syntax. It doesn't work. Maybe because it is being called from within a ZClass product. Who knows. I just want users to log in and be redirected to their 'Base'catalogue
I'm confused, this is something else like the REQUEST.PARENTS thingy, isn't it? Anyway, as Chris stated, you just have to catch the unauthorized exception: try: if getattr(item[1],'index_html'):pub.append(item[1].absolute_url()) except: pass (or do something) You can further qualify which exception you want to capture, I don't know offhand if ... except Unauthorized: pass works. HTH, oliver
don't do that. just grab the user object and look for its original container, which will give you the user folder. user_obj.aq_inner.aq_parent is what you want. jens On Wednesday, Sep 18, 2002, at 05:27 US/Eastern, chrisf wrote:
Can this be done from a script?
Lets say you have the following directory structure:
ROOT/A/B/C/D/E
user TEMP is in the acl_user folder in the 'C' directory and hence can log in only at ROOT/A/B/C directory and upwards. lets say he logs in a ROOT/A/B/C/D/E/F I would like to know at which level he was authorized. I am not keen about changing manage user permissions. In otherwords I would like a script that loops back through parents checking to see if folders can be viewed. How can one predict whether a user authorization dialogue will appear. How can one interupt a authorization dialogue from appearing.
Thanks Chris
participants (4)
-
Chris Withers -
chrisf -
Jens Vagelpohl -
Oliver Bleutgen