Mercurial > p > roundup > code
comparison templates/minimal/schema.py @ 3042:24e31de4f3a1 maint-0.8
merge from HEAD
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 04 Jan 2005 00:55:37 +0000 |
| parents | b9a55628a78d |
| children |
comparison
equal
deleted
inserted
replaced
| 3039:70c9954f619f | 3042:24e31de4f3a1 |
|---|---|
| 35 # Users should be able to edit their own details -- this permission is | 35 # Users should be able to edit their own details -- this permission is |
| 36 # limited to only the situation where the Viewed or Edited item is their own. | 36 # limited to only the situation where the Viewed or Edited item is their own. |
| 37 def own_record(db, userid, itemid): | 37 def own_record(db, userid, itemid): |
| 38 '''Determine whether the userid matches the item being accessed.''' | 38 '''Determine whether the userid matches the item being accessed.''' |
| 39 return userid == itemid | 39 return userid == itemid |
| 40 p = db.security.addPermission(name='View Self', klass='user', check=own_record, | 40 p = db.security.addPermission(name='View', klass='user', check=own_record, |
| 41 description="User is allowed to view their own user details") | 41 description="User is allowed to view their own user details") |
| 42 db.security.addPermissionToRole('User', p) | 42 db.security.addPermissionToRole('User', p) |
| 43 p = db.security.addPermission(name='Edit Self', klass='user', check=own_record, | 43 p = db.security.addPermission(name='Edit', klass='user', check=own_record, |
| 44 description="User is allowed to edit their own user details") | 44 description="User is allowed to edit their own user details") |
| 45 db.security.addPermissionToRole('User', p) | 45 db.security.addPermissionToRole('User', p) |
| 46 | 46 |
| 47 # | 47 # |
| 48 # ANONYMOUS USER PERMISSIONS | 48 # ANONYMOUS USER PERMISSIONS |
