[Zope] Ticking Security boxes via Python
Peter Bengtsson
mail@peterbe.com
Mon, 8 Oct 2001 03:17:08 +0200
When an object (sub class to my new product I'm working on) is created I =
in it, create a user folder and user in there with the role "TimeTable =
User".
Suppose that I create this container, click "Security" and makes the =
following settings:
1) View is NOT acquired
2) To get View you have to be either "Manager", "TimeTable User" or =
"TimeTable Manager"
little ticked boxes across the View permission.
How can I do this with python??
I have tried this:
def __init__(self):
bla
bla
# do stuff via python instead of the ZMI
self.manage_permission('View',
roles=3D['Manager','TimeTable =
User','TimeTable Manager'],=20
acquire=3D0)
This throws an error:
Error Type: AttributeError
Error Value: aq_acquire
Traceback (innermost last):
File lib\python\ZPublisher\Publish.py, line 223, in publish_module
File lib\python\ZPublisher\Publish.py, line 187, in publish
File C:\Program\zope240\lib\python\Zope\__init__.py, line 226, in =
zpublisher_exception_hook
(Object: LockableItem)
File lib\python\ZPublisher\Publish.py, line 171, in publish
File C:\Program\zope240\lib\python\ZPublisher\mapply.py, line 160, in =
mapply
(Object: addTimeTableAccount)
File lib\python\ZPublisher\Publish.py, line 112, in call_object
(Object: addTimeTableAccount)
File C:\Program\zope240\lib\python\Products\TimeTable\TimeTable.py, =
line 84, in addTimeTableAccount
(Object: LockableItem)
File C:\Program\zope240\lib\python\Products\TimeTable\TimeTable.py, =
line 145, in __init__
(Object: LockableItem)
File C:\Program\zope240\lib\python\AccessControl\Role.py, line 234, in =
manage_permission
(Object: LockableItem)
File C:\Program\zope240\lib\python\AccessControl\Role.py, line 152, in =
ac_inherited_permissions
(Object: LockableItem)
File C:\Program\zope240\lib\python\OFS\ObjectManager.py, line 256, in =
_subobject_permissions
(Object: LockableItem)
AttributeError: (see above)
Basically, how do I go into the ZMI, -> Security and tick boxes with =
python code?
peter