Mercurial > p > roundup > code
comparison doc/customizing.txt @ 3260:e41e1540a287
fix provisional user so they can view their own record
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 05 Apr 2005 22:58:31 +0000 |
| parents | 1cbde34afa77 |
| children | 3124e578db02 |
comparison
equal
deleted
inserted
replaced
| 3258:1cbde34afa77 | 3260:e41e1540a287 |
|---|---|
| 1 =================== | 1 =================== |
| 2 Customising Roundup | 2 Customising Roundup |
| 3 =================== | 3 =================== |
| 4 | 4 |
| 5 :Version: $Revision: 1.175 $ | 5 :Version: $Revision: 1.176 $ |
| 6 | 6 |
| 7 .. This document borrows from the ZopeBook section on ZPT. The original is at: | 7 .. This document borrows from the ZopeBook section on ZPT. The original is at: |
| 8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx | 8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx |
| 9 | 9 |
| 10 .. contents:: | 10 .. contents:: |
| 4056 | 4056 |
| 4057 # and give the new users access to the web and email interface | 4057 # and give the new users access to the web and email interface |
| 4058 db.security.addPermissionToRole('Provisional User', 'Web Access') | 4058 db.security.addPermissionToRole('Provisional User', 'Web Access') |
| 4059 db.security.addPermissionToRole('Provisional User', 'Email Access') | 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 Then, in ``config.ini``, we change the Role assigned to newly-registered | 4072 Then, in ``config.ini``, we change the Role assigned to newly-registered |
| 4063 users, replacing the existing ``'User'`` values:: | 4073 users, replacing the existing ``'User'`` values:: |
| 4064 | 4074 |
| 4065 [main] | 4075 [main] |
