annotate share/roundup/templates/minimal/schema.py @ 7531:913a73b9fab5 2.3.0

Update for 2.3.0 release
author John Rouillard <rouilj@ieee.org>
date Wed, 12 Jul 2023 23:00:25 -0400
parents c087ad45bf4d
children 984bc9f94ec6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4069
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
1 #
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
2 # TRACKER SCHEMA
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
3 #
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
4
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
5 # Class automatically gets these properties:
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
6 # creation = Date()
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
7 # activity = Date()
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
8 # creator = Link('user')
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
9 # actor = Link('user')
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
10
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
11 # The "Minimal" template gets only one class, the required "user"
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
12 # class. That's it. And even that has the bare minimum of properties.
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
13
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
14 # Note: roles is a comma-separated string of Role names
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
15 user = Class(db, "user", username=String(), password=Password(),
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
16 address=String(), alternate_addresses=String(), roles=String())
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
17 user.setkey("username")
4735
0c54c846ea6a Fix minimal template, which was failing with:
anatoly techtonik <techtonik@gmail.com>
parents: 4308
diff changeset
18 db.security.addPermission(name='Register', klass='user',
0c54c846ea6a Fix minimal template, which was failing with:
anatoly techtonik <techtonik@gmail.com>
parents: 4308
diff changeset
19 description='User is allowed to register new user')
4069
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
20 #
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
21 # TRACKER SECURITY SETTINGS
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
22 #
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
23 # See the configuration and customisation document for information
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
24 # about security setup.
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
25
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
26 #
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
27 # REGULAR USERS
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
28 #
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
29 # Give the regular users access to the web and email interface
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
30 db.security.addPermissionToRole('User', 'Web Access')
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
31 db.security.addPermissionToRole('User', 'Email Access')
5879
94a7669677ae add permissions to control user of rest and xmlrpc API interfaces.
John Rouillard <rouilj@ieee.org>
parents: 4902
diff changeset
32 db.security.addPermissionToRole('User', 'Rest Access')
94a7669677ae add permissions to control user of rest and xmlrpc API interfaces.
John Rouillard <rouilj@ieee.org>
parents: 4902
diff changeset
33 db.security.addPermissionToRole('User', 'Xmlrpc Access')
4069
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
34
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
35 # May users view other user information?
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
36 # Comment these lines out if you don't want them to
4902
a403c29ffaf9 Security fix default user permissions
Ralf Schlatterbeck <rsc@runtux.com>
parents: 4735
diff changeset
37 p = db.security.addPermission(name='View', klass='user',
a403c29ffaf9 Security fix default user permissions
Ralf Schlatterbeck <rsc@runtux.com>
parents: 4735
diff changeset
38 properties=('id', 'username'))
a403c29ffaf9 Security fix default user permissions
Ralf Schlatterbeck <rsc@runtux.com>
parents: 4735
diff changeset
39 db.security.addPermissionToRole('User', p)
4069
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
40
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
41 # Users should be able to edit their own details -- this permission is
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
42 # limited to only the situation where the Viewed or Edited item is their own.
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
43 def own_record(db, userid, itemid):
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
44 '''Determine whether the userid matches the item being accessed.'''
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
45 return userid == itemid
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
46 p = db.security.addPermission(name='View', klass='user', check=own_record,
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
47 description="User is allowed to view their own user details")
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
48 db.security.addPermissionToRole('User', p)
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
49 p = db.security.addPermission(name='Edit', klass='user', check=own_record,
4308
b30bdfae4461 Fix security hole allowing user permission escalation
Richard Jones <richard@users.sourceforge.net>
parents: 4146
diff changeset
50 properties=('username', 'password', 'address', 'alternate_addresses'),
4069
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
51 description="User is allowed to edit their own user details")
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
52 db.security.addPermissionToRole('User', p)
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
53
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
54 #
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
55 # ANONYMOUS USER PERMISSIONS
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
56 #
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
57 # Let anonymous users access the web interface. Note that almost all
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
58 # trackers will need this Permission. The only situation where it's not
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
59 # required is in a tracker that uses an HTTP Basic Authenticated front-end.
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
60 db.security.addPermissionToRole('Anonymous', 'Web Access')
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
61
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
62 # Let anonymous users access the email interface (note that this implies
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
63 # that they will be registered automatically, hence they will need the
7132
c087ad45bf4d update Anonymous Create user to Register user permissions
John Rouillard <rouilj@ieee.org>
parents: 5879
diff changeset
64 # "Register" user Permission below)
4069
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
65 db.security.addPermissionToRole('Anonymous', 'Email Access')
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
66
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
67 # Assign the appropriate permissions to the anonymous user's
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
68 # Anonymous Role. Choices here are:
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
69 # - Allow anonymous users to register
4146
42331c201b02 Fix issue2550553.
Stefan Seefeld <stefan@seefeld.name>
parents: 4069
diff changeset
70 db.security.addPermissionToRole('Anonymous', 'Register', 'user')
4069
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
71
a6fdaaa3a8bd Move templates/ to share/roundup/templates/
Stefan Seefeld <stefan@seefeld.name>
parents:
diff changeset
72 # vim: set et sts=4 sw=4 :

Roundup Issue Tracker: http://roundup-tracker.org/