|
2 | 2 | Customising Roundup |
3 | 3 | =================== |
4 | 4 |
|
5 | | -:Version: $Revision: 1.175 $ |
| 5 | +:Version: $Revision: 1.176 $ |
6 | 6 |
|
7 | 7 | .. This document borrows from the ZopeBook section on ZPT. The original is at: |
8 | 8 | 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 |
4058 | 4058 | db.security.addPermissionToRole('Provisional User', 'Web Access') |
4059 | 4059 | db.security.addPermissionToRole('Provisional User', 'Email Access') |
4060 | 4060 |
|
| 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) |
4061 | 4071 |
|
4062 | 4072 | Then, in ``config.ini``, we change the Role assigned to newly-registered |
4063 | 4073 | users, replacing the existing ``'User'`` values:: |
|
0 commit comments