Skip to content

Commit 6ef2f0c

Browse files
author
Richard Jones
committed
fix provisional user so they can view their own record
1 parent fb941be commit 6ef2f0c

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.175 $
5+
:Version: $Revision: 1.176 $
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
@@ -4058,6 +4058,16 @@ First up, we create the new Role and Permission structure in
40584058
db.security.addPermissionToRole('Provisional User', 'Web Access')
40594059
db.security.addPermissionToRole('Provisional User', 'Email Access')
40604060

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

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

0 commit comments

Comments
 (0)