22Customising Roundup
33===================
44
5- :Version: $Revision: 1.161.2.12 $
5+ :Version: $Revision: 1.161.2.13 $
66
77.. This document borrows from the ZopeBook section on ZPT. The original is at:
88 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -18,7 +18,7 @@ Before you get too far, it's probably worth having a quick read of the Roundup
1818
1919Customisation of Roundup can take one of six forms:
2020
21- 1. `tracker configuration`_ file changes
21+ 1. `tracker configuration`_ changes
22222. database, or `tracker schema`_ changes
23233. "definition" class `database content`_ changes
24244. behavioural changes, through detectors_
@@ -58,6 +58,12 @@ Tracker Configuration
5858The ``config.ini`` located in your tracker home contains the basic
5959configuration for the web and e-mail components of roundup's interfaces.
6060
61+ Changes to the data captured by your tracker is controlled by the `tracker
62+ schema`_. Some configuration is also performed using permissions - see the
63+ `security / access controls`_ section. For example, to allow users to
64+ automatically register through the email interface, you must grant the
65+ "Anonymous" Role the "Email Access" Permission.
66+
6167The following is taken from the `Python Library Reference`__ (May 20, 2004)
6268section "ConfigParser -- Configuration file parser":
6369
@@ -79,11 +85,6 @@ section "ConfigParser -- Configuration file parser":
7985
8086__ http://docs.python.org/lib/module-ConfigParser.html
8187
82- Configuration variables may be referred to in lower or upper case. In code,
83- variables not in the "main" section are referred to using their section and
84- name, so "domain" in the section "mail" becomes MAIL_DOMAIN. The
85- configuration variables available are:
86-
8788Section **main**
8889 database -- ``db``
8990 Database directory path. The path may be either absolute or relative
@@ -282,6 +283,11 @@ Section **nosy**
282283You may generate a new default config file using the ``roundup-admin
283284genconfig`` command.
284285
286+ Configuration variables may be referred to in lower or upper case. In code,
287+ variables not in the "main" section are referred to using their section and
288+ name, so "domain" in the section "mail" becomes MAIL_DOMAIN. The
289+ configuration variables available are:
290+
285291
286292Tracker Schema
287293==============
@@ -740,22 +746,28 @@ A set of Permissions is built into the security module by default:
740746- Edit (everything)
741747- View (everything)
742748
743- Every Class you define in your tracker's schema also gets an Create, Edit
744- and View Permission of its own.
745-
746- The default interfaces define:
747-
748- - Web Registration
749- - Web Access
750- - Web Roles
751- - Email Registration
752- - Email Access
749+ These are assigned to the "Admin" Role by default, and allow a user to do
750+ anything. Every Class you define in your `tracker schema`_ also gets an
751+ Create, Edit and View Permission of its own. The web and email interfaces
752+ also define:
753+
754+ *Email Access*
755+ If defined, the user may use the email interface. Used by default to deny
756+ Anonymous users access to the email interface. When granted to the
757+ Anonymous user, they will be automatically registered by the email
758+ interface (see also the ``new_email_user_roles`` configuration option).
759+ *Web Access*
760+ If defined, the user may use the web interface. All users are able to see
761+ the login form, regardless of this setting (thus enabling logging in).
762+ *Web Roles*
763+ Controls user access to editing the "roles" property of the "user" class.
764+ TODO: deprecate in favour of a property-based control.
753765
754766These are hooked into the default Roles:
755767
756768- Admin (Create, Edit, View and everything; Web Roles)
757769- User (Web Access; Email Access)
758- - Anonymous (Web Registration; Email Registration )
770+ - Anonymous (Web Access )
759771
760772And finally, the "admin" user gets the "Admin" Role, and the "anonymous"
761773user gets "Anonymous" assigned when the tracker is installed.
@@ -765,10 +777,11 @@ For the "User" Role, the "classic" tracker defines:
765777- Create, Edit and View issue, file, msg, query, keyword
766778- View priority, status
767779- View user
768- - Edit their own record
780+ - Edit their own user record
769781
770782And the "Anonymous" Role is defined as:
771783
784+ - Web interface access
772785- Create user (for registration)
773786- View issue, file, msg, query, keyword, priority, status
774787
@@ -784,37 +797,31 @@ Put together, these settings appear in the tracker's ``schema.py`` file::
784797 # REGULAR USERS
785798 #
786799 # Give the regular users access to the web and email interface
787- p = db.security.getPermission('Web Access')
788- db.security.addPermissionToRole('User', p)
789- p = db.security.getPermission('Email Access')
790- db.security.addPermissionToRole('User', p)
800+ db.security.addPermissionToRole('User', 'Web Access')
801+ db.security.addPermissionToRole('User', 'Email Access')
791802
792803 # Assign the access and edit Permissions for issue, file and message
793804 # to regular users now
794805 for cl in 'issue', 'file', 'msg', 'query', 'keyword':
795- p = db.security.getPermission('View', cl)
796- db.security.addPermissionToRole('User', p)
797- p = db.security.getPermission('Edit', cl)
798- db.security.addPermissionToRole('User', p)
799- p = db.security.getPermission('Create', cl)
800- db.security.addPermissionToRole('User', p)
806+ db.security.addPermissionToRole('User', 'View', cl)
807+ db.security.addPermissionToRole('User', 'Edit', cl)
808+ db.security.addPermissionToRole('User', 'Create', cl)
801809 for cl in 'priority', 'status':
802- p = db.security.getPermission('View', cl)
803- db.security.addPermissionToRole('User', p)
810+ db.security.addPermissionToRole('User', 'View', cl)
804811
805812 # May users view other user information? Comment these lines out
806813 # if you don't want them to
807- p = db.security.getPermission('View', 'user')
808- db.security.addPermissionToRole('User', p)
814+ db.security.addPermissionToRole('User', 'View', 'user')
809815
810- # Users should be able to edit their own details. Note that this
811- # permission is limited to only the situation where the Viewed or
812- # Edited item is their own.
816+ # Users should be able to edit their own details -- this permission
817+ # is limited to only the situation where the Viewed or Edited item
818+ # is their own.
813819 def own_record(db, userid, itemid):
814820 '''Determine whether the userid matches the item being accessed.'''
815821 return userid == itemid
816822 p = db.security.addPermission(name='View', klass='user', check=own_record,
817823 description="User is allowed to view their own user details")
824+ db.security.addPermissionToRole('User', p)
818825 p = db.security.addPermission(name='Edit', klass='user', check=own_record,
819826 description="User is allowed to edit their own user details")
820827 db.security.addPermissionToRole('User', p)
@@ -825,35 +832,31 @@ Put together, these settings appear in the tracker's ``schema.py`` file::
825832 # Let anonymous users access the web interface. Note that almost all
826833 # trackers will need this Permission. The only situation where it's not
827834 # required is in a tracker that uses an HTTP Basic Authenticated front-end.
828- p = db.security.getPermission('Web Access')
829- db.security.addPermissionToRole('Anonymous', p)
835+ db.security.addPermissionToRole('Anonymous', 'Web Access')
830836
831837 # Let anonymous users access the email interface (note that this implies
832838 # that they will be registered automatically, hence they will need the
833839 # "Create" user Permission below)
834- p = db.security.getPermission('Email Access')
835- db.security.addPermissionToRole('Anonymous', p)
840+ # This is disabled by default to stop spam from auto-registering users on
841+ # public trackers.
842+ #db.security.addPermissionToRole('Anonymous', 'Email Access')
836843
837844 # Assign the appropriate permissions to the anonymous user's Anonymous
838845 # Role. Choices here are:
839846 # - Allow anonymous users to register
840- p = db.security.getPermission('Create', 'user')
841- db.security.addPermissionToRole('Anonymous', p)
847+ db.security.addPermissionToRole('Anonymous', 'Create', 'user')
842848
843849 # Allow anonymous users access to view issues (and the related, linked
844850 # information)
845851 for cl in 'issue', 'file', 'msg', 'keyword', 'priority', 'status':
846- p = db.security.getPermission('View', cl)
847- db.security.addPermissionToRole('Anonymous', p)
852+ db.security.addPermissionToRole('Anonymous', 'View', cl)
848853
849854 # [OPTIONAL]
850855 # Allow anonymous users access to create or edit "issue" items (and the
851856 # related file and message items)
852857 #for cl in 'issue', 'file', 'msg':
853- # p = db.security.getPermission('Create', cl)
854- # db.security.addPermissionToRole('Anonymous', p)
855- # p = db.security.getPermission('Edit', cl)
856- # db.security.addPermissionToRole('Anonymous', p)
858+ # db.security.addPermissionToRole('Anonymous', 'Create', cl)
859+ # db.security.addPermissionToRole('Anonymous', 'Edit', cl)
857860
858861
859862Automatic Permission Checks
@@ -887,6 +890,9 @@ New users are assigned the Roles defined in the config file as:
887890- NEW_WEB_USER_ROLES
888891- NEW_EMAIL_USER_ROLES
889892
893+ The `users may only edit their issues`_ example shows customisation of
894+ these parameters.
895+
890896
891897Changing Access Controls
892898------------------------
0 commit comments