Change Objects Ownership
Submitted by: runyaga
Last Edited: 2001-09-16
Category: Python(External Method)
|
Average rating is:
4.0 out of 5
|
(1 ratings) |
|
Description:
This recipe allows you to change the ownership of a object through-the-web. since Owned.changeOwnership located in lib/python/AccessControl/Owned.py and is not setup for Through-The-Web callable. we need to explicit set a External Method that allows us to call this functionality through the web.
|
Source (Text):
def custom_changeOwnership(self, username, obj):
""" explicitly setup changeOwnership for TTW """
acl_users = getattr(self, 'acl_users')
user = acl_users.getUser(username).__of__(acl_users)
obj.changeOwnership(user)
|
Explanation:
in ZOPE if something is not accessible through-the-web, its a security
feature, it allows you to explicit open up (restricted) that function to through-the-
web coding (Scripts, and DTML) via External Methods (which are competely
unrestricted).
we have a External Method that calls into our External Method sitting on the filesystem
which given a username and a object reference will call the changeOwnership method (which
is restricted) on the object passed into this function.
the user object is gotten using some acquistion voodoo, getting the user in the context of the
acl_users folder (if I understand that right). basically wraps the user object you get from the
acl_user folder in the acl_users container. if you dont wrap the user in the UserFolder container
changeOwnership will not work.
Acquistion.html:
http://www.ccs.neu.edu/home/lorenz/research/acquisition/ExtensionClass/Acquisition.html
Acquistion Algebra:
http://www.zope.org/Members/jim/Info/IPC8/AcquisitionAlgebra/index.html
|
Comments:
No Comments
|