Skip to content

Commit 09c9a42

Browse files
author
Richard Jones
committed
security fixes and doc updates
1 parent 2c086dc commit 09c9a42

File tree

7 files changed

+79
-28
lines changed

7 files changed

+79
-28
lines changed

doc/customizing.txt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Customising Roundup
33
===================
44

5-
:Version: $Revision: 1.118 $
5+
:Version: $Revision: 1.119 $
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
@@ -613,6 +613,9 @@ A set of Permissions is built into the security module by default:
613613
- Edit (everything)
614614
- View (everything)
615615

616+
Every Class you define in your tracker's schema also gets an Edit and View
617+
Permission of its own.
618+
616619
The default interfaces define:
617620

618621
- Web Registration
@@ -643,13 +646,6 @@ settings appear in the ``open()`` function of the tracker ``dbinit.py``
643646
#
644647
# SECURITY SETTINGS
645648
#
646-
# new permissions for this schema
647-
for cl in ('user', ):
648-
db.security.addPermission(name="Edit", klass=cl,
649-
description="User is allowed to edit "+cl)
650-
db.security.addPermission(name="View", klass=cl,
651-
description="User is allowed to access "+cl)
652-
653649
# and give the regular users access to the web and email interface
654650
p = db.security.getPermission('Web Access')
655651
db.security.addPermissionToRole('User', p)
@@ -697,7 +693,13 @@ Adding a new Permission
697693

698694
When adding a new Permission, you will need to:
699695

700-
1. add it to your tracker's dbinit so it is created
696+
1. add it to your tracker's dbinit so it is created, using
697+
``security.addPermission``, for example::
698+
699+
self.security.addPermission(name="View", klass='frozzle',
700+
description="User is allowed to access frozzles")
701+
702+
will set up a new "View" permission on the Class "frozzle".
701703
2. enable it for the Roles that should have it (verify with
702704
"``roundup-admin security``")
703705
3. add it to the relevant HTML interface templates

doc/upgrading.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,47 @@ accordingly. Note that there is information about upgrade procedures in the
1111
Migrating from 0.6 to 0.7
1212
=========================
1313

14+
0.7.0 Permission setup
15+
----------------------
16+
17+
0.7 automatically sets up the Edit and View Permissions for all classes,
18+
thus you don't need to do so. Feel free to remove the code::
19+
20+
# Add new Permissions for this schema
21+
for cl in 'issue', 'file', 'msg', 'user', 'query', 'keyword':
22+
db.security.addPermission(name="Edit", klass=cl,
23+
description="User is allowed to edit "+cl)
24+
db.security.addPermission(name="View", klass=cl,
25+
description="User is allowed to access "+cl)
26+
27+
from your ``dbinit.py``.
28+
29+
30+
0.7.0 Permission assignments
31+
----------------------------
32+
33+
Due to a change in the rendering of web widgets, permissions are now
34+
checked on Classes where they previously weren't (this is a good thing).
35+
36+
You will need to add some additional Permission assignments for your
37+
regular users, or some displays will break. After the following in your
38+
tracker's ``dbinit.py``::
39+
40+
# Assign the access and edit Permissions for issue, file and message
41+
# to regular users now
42+
for cl in 'issue', 'file', 'msg', 'query', 'keyword':
43+
p = db.security.getPermission('View', cl)
44+
db.security.addPermissionToRole('User', p)
45+
p = db.security.getPermission('Edit', cl)
46+
db.security.addPermissionToRole('User', p)
47+
48+
add::
49+
50+
for cl in 'priority', 'status':
51+
p = db.security.getPermission('View', cl)
52+
db.security.addPermissionToRole('User', p)
53+
54+
1455
0.7.0 Extending the cgi interface
1556
---------------------------------
1657

@@ -24,6 +65,7 @@ password validation source`__ example.
2465
__ customizing.html#defining-new-web-actions
2566
__ customizing.html#using-an-external-password-validation-source
2667

68+
2769
0.7.0 Getting the current user id
2870
---------------------------------
2971

roundup/backends/back_anydbm.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_anydbm.py,v 1.135 2004-02-11 23:55:08 richard Exp $
18+
#$Id: back_anydbm.py,v 1.136 2004-03-12 05:36:26 richard Exp $
1919
'''This module defines a backend that saves the hyperdatabase in a
2020
database chosen by anydbm. It is guaranteed to always be available in python
2121
versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several
@@ -131,6 +131,12 @@ def addclass(self, cl):
131131
raise ValueError, cn
132132
self.classes[cn] = cl
133133

134+
# add default Edit and View permissions
135+
self.security.addPermission(name="Edit", klass=cn,
136+
description="User is allowed to edit "+cn)
137+
self.security.addPermission(name="View", klass=cn,
138+
description="User is allowed to access "+cn)
139+
134140
def getclasses(self):
135141
'''Return a list of the names of all existing classes.'''
136142
if __debug__:

roundup/backends/back_metakit.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: back_metakit.py,v 1.60 2004-02-23 17:19:09 wc2so1 Exp $
1+
# $Id: back_metakit.py,v 1.61 2004-03-12 05:36:26 richard Exp $
22
'''Metakit backend for Roundup, originally by Gordon McMillan.
33
44
Known Current Bugs:
@@ -169,6 +169,13 @@ def addclass(self, cl):
169169
self.classes[cl.classname] = cl
170170
if self.tables.find(name=cl.classname) < 0:
171171
self.tables.append(name=cl.classname)
172+
173+
# add default Edit and View permissions
174+
self.security.addPermission(name="Edit", klass=cl.classname,
175+
description="User is allowed to edit "+cl.classname)
176+
self.security.addPermission(name="View", klass=cl.classname,
177+
description="User is allowed to access "+cl.classname)
178+
172179
def addjournal(self, tablenm, nodeid, action, params, creator=None,
173180
creation=None):
174181
''' Journal the Action

roundup/backends/rdbms_common.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: rdbms_common.py,v 1.77 2004-03-12 04:08:59 richard Exp $
1+
# $Id: rdbms_common.py,v 1.78 2004-03-12 05:36:26 richard Exp $
22
''' Relational database (SQL) backend common code.
33
44
Basics:
@@ -509,6 +509,12 @@ def addclass(self, cl):
509509
raise ValueError, cn
510510
self.classes[cn] = cl
511511

512+
# add default Edit and View permissions
513+
self.security.addPermission(name="Edit", klass=cn,
514+
description="User is allowed to edit "+cn)
515+
self.security.addPermission(name="View", klass=cn,
516+
description="User is allowed to access "+cn)
517+
512518
def getclasses(self):
513519
''' Return a list of the names of all existing classes.
514520
'''

templates/classic/dbinit.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: dbinit.py,v 1.3 2004-01-19 23:57:47 richard Exp $
18+
# $Id: dbinit.py,v 1.4 2004-03-12 05:36:26 richard Exp $
1919

2020
import os
2121

@@ -98,20 +98,15 @@ def open(name=None):
9898
#
9999
# See the configuration and customisation document for information
100100
# about security setup.
101-
# Add new Permissions for this schema
102-
for cl in 'issue', 'file', 'msg', 'user', 'query', 'keyword':
103-
db.security.addPermission(name="Edit", klass=cl,
104-
description="User is allowed to edit "+cl)
105-
db.security.addPermission(name="View", klass=cl,
106-
description="User is allowed to access "+cl)
107-
108101
# Assign the access and edit Permissions for issue, file and message
109102
# to regular users now
110103
for cl in 'issue', 'file', 'msg', 'query', 'keyword':
111104
p = db.security.getPermission('View', cl)
112105
db.security.addPermissionToRole('User', p)
113106
p = db.security.getPermission('Edit', cl)
114107
db.security.addPermissionToRole('User', p)
108+
for cl in 'priority', 'status':
109+
p = db.security.getPermission('View', cl)
115110

116111
# and give the regular users access to the web and email interface
117112
p = db.security.getPermission('Web Access')

templates/minimal/dbinit.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: dbinit.py,v 1.1 2003-04-17 03:27:27 richard Exp $
18+
# $Id: dbinit.py,v 1.2 2004-03-12 05:36:26 richard Exp $
1919

2020
import os
2121

@@ -49,13 +49,6 @@ def open(name=None):
4949
#
5050
# SECURITY SETTINGS
5151
#
52-
# new permissions for this schema
53-
for cl in ('user', ):
54-
db.security.addPermission(name="Edit", klass=cl,
55-
description="User is allowed to edit "+cl)
56-
db.security.addPermission(name="View", klass=cl,
57-
description="User is allowed to access "+cl)
58-
5952
# and give the regular users access to the web and email interface
6053
p = db.security.getPermission('Web Access')
6154
db.security.addPermissionToRole('User', p)

0 commit comments

Comments
 (0)