[Zope] Confusion over Acquisition, permissions, etc.

Samir Mishra SamirMishra@cbuae.gov.ae
Mon, 17 Feb 2003 13:49:44 +0400


After playing around with this a bit more, it seems I can create a folder in
"child" ONLY if a folder with that name does not exist in "parent". I can
create the folders I need in "parent" only AFTER they're first created in
"child". 

I'd provided partial code in my last email, only to keep things simple. I
may be better off providing all of the script. The actual code for
"add1folder" is as below (it's an adaptation of code found elsewhere) -


"""
Add single folder along with manager/user programmatically to current folder
"""

folderName = folderList[0] #folderList is a parameter being passed to script
folderTitle = folderList[1]

currentFolder = context

## I suspect the test below is what's giving me the problem...
if not hasattr(curFolder, folderName):
    currentFolder.manage_addFolder(folderName, folderTitle, 1, 1)
    ## create the folder
    newFolder = getattr(currentFolder, folderName)
    ## create new manager in folder
    managerName = "".join([folderName, "_mgr"])
    managerPass = "".join([folderName, "#mgr"])
    newFolder.acl_users.userFolderAddUser(managerName, managerPass,
["Manager"], [])
    ## AND I also want to define a new role here, something else I haven't
    ## been able to figure out
    return 1
else:
    return 0



Thanks very much.

-----Original Message-----
From: Samir Mishra [mailto:SamirMishra@cbuae.gov.ae]
Sent: Monday, February 17, 2003 13:10
To: 'zope@zope.org'
Subject: [Zope] Confusion over Acquisition, permissions, etc.


Hello all,

I have /parent/child defined as 2 folders off root.

I have the following script named "add1folder" in /parent. 
    context.manage_addFolder(folderName, folderTitle, 1, 1)

I call the script through a DTML method named "add_folder".

So when I access the URL /parent/add_folder, it creates the appropriate
folder for me.

I log in as Manager in /parent/child (different acl_users folder in child)
and try and run the above script as /parent/child/add_folder to create the
same set of folders but it doesn't work. 

What do I need to do to get this to work the way I want, i.e., call
"add1folder" while in /parent/child?

TIA

Samir

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )