Skip to content

Commit ec680e3

Browse files
author
Richard Jones
committed
merge from HEAD
1 parent bf9f76e commit ec680e3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

doc/customizing.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Customising Roundup
33
===================
44

5-
:Version: $Revision: 1.161.2.11 $
5+
:Version: $Revision: 1.161.2.12 $
66

77
.. This document borrows from the ZopeBook section on ZPT. The original is at:
88
http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -4055,6 +4055,16 @@ First up, we create the new Role and Permission structure in
40554055
db.security.addPermissionToRole('Provisional User', 'Web Access')
40564056
db.security.addPermissionToRole('Provisional User', 'Email Access')
40574057

4058+
# make sure they can view & edit their own user record
4059+
def own_record(db, userid, itemid):
4060+
'''Determine whether the userid matches the item being accessed.'''
4061+
return userid == itemid
4062+
p = db.security.addPermission(name='View', klass='user', check=own_record,
4063+
description="User is allowed to view their own user details")
4064+
db.security.addPermissionToRole('Provisional User', p)
4065+
p = db.security.addPermission(name='Edit', klass='user', check=own_record,
4066+
description="User is allowed to edit their own user details")
4067+
db.security.addPermissionToRole('Provisional User', p)
40584068

40594069
Then, in ``config.ini``, we change the Role assigned to newly-registered
40604070
users, replacing the existing ``'User'`` values::

0 commit comments

Comments
 (0)