[Zope] confused on permissions and roles

John Hunter jdhunter at ace.bsd.uchicago.edu
Thu Jul 1 11:19:41 EDT 2004


>>>>> "Roché" == Roché Compaan <roche at upfrontsystems.co.za> writes:

    Roché> Yes, all classes subclassing RoleManager has a
    Roché> manage_permission method that can be used to change
    Roché> permissions. You could for instance put the following in
    Roché> manage_afterAdd of your class to give only Manager and
    Roché> Administrator the 'View' permission and prevent this
    Roché> permission from being acquired:

Next problem:

I have a class (derived from folder) MyFolder that I am instantiating
from the web interface.  In the manage_afterAdd function of that
class, I am instantiating several other objects (MyObject) that reside
in MyFolder.  These objects are not meant to be instantiated by users,
and will only be instantiated by MyFolder when it created.

I also want to set the default permissions and roles for MyObject.  If
I define manage_afterAdd in MyObject, the function is not called,
presumably because I am not instantiating MyObject from the manager
interface.  In MyFolder.manage_afterAdd, I do

        o = MyObject(oid)
        self._setObject(oid, o)

>From product code, is there a way to add a MyObject instance to
MyFolder so that MyObject.manage_afterAdd(self, item, container) will
be called with self properly wrapped to make the role manager
manage_permissions calls?

Thanks again,
John Hunter
zope 2.7


More information about the Zope mailing list