|
2 | 2 | Customising Roundup |
3 | 3 | =================== |
4 | 4 |
|
5 | | -:Version: $Revision: 1.161.2.11 $ |
| 5 | +:Version: $Revision: 1.161.2.12 $ |
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 |
@@ -4055,6 +4055,16 @@ First up, we create the new Role and Permission structure in |
4055 | 4055 | db.security.addPermissionToRole('Provisional User', 'Web Access') |
4056 | 4056 | db.security.addPermissionToRole('Provisional User', 'Email Access') |
4057 | 4057 |
|
| 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) |
4058 | 4068 |
|
4059 | 4069 | Then, in ``config.ini``, we change the Role assigned to newly-registered |
4060 | 4070 | users, replacing the existing ``'User'`` values:: |
|
0 commit comments