summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d20250c)
raw | patch | inline | side by side (parent: d20250c)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 29 Jul 2002 21:53:29 +0000 (21:53 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 29 Jul 2002 21:53:29 +0000 (21:53 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@925 57a73879-2fb5-44c3-a270-3262357dd7e2
doc/customizing.txt | patch | blob | history | |
doc/index.txt | patch | blob | history | |
roundup/security.py | patch | blob | history | |
test/test_security.py | patch | blob | history |
diff --git a/doc/customizing.txt b/doc/customizing.txt
index 073b962ee6c83a6f5c622bf9353555da19ac4145..2f4b9dce9585124fc98e2f005f77bc3a28add531 100644 (file)
--- a/doc/customizing.txt
+++ b/doc/customizing.txt
Customising Roundup
===================
-:Version: $Revision: 1.12 $
+:Version: $Revision: 1.13 $
.. contents::
What You Can Do
---------------
-Customisation of Roundup can take one of three forms:
+Customisation of Roundup can take one of four forms:
1. `instance configuration`_ file changes
-2. `instance schema`_ changes
+2. database, or `instance schema`_ changes
3. "definition" class `database content`_ changes
+4. behavioural changes, through detectors_
The third case is special because it takes two distinctly different forms
depending upon whether the instance has been initialised or not. The other two
Detectors - adding behaviour to your tracker
--------------------------------------------
-.. _`detectors`:
+.. _detectors:
The detectors in your instance fire before (*auditors*) and after (*reactors*)
changes to the contents of your database. They are Python modules that sit in
See the detectors section in the `design document`__ for details of the
interface for detectors.
-__ spec.html
+__ design.html
Sample additional detectors that have been found useful will appear in the
``detectors`` directory of the Roundup distribution:
diff --git a/doc/index.txt b/doc/index.txt
index dda1625de761e738e9bf5409f4164e2c2b0b96bd..2ad0bd3a1ad82529bd48740dcf4d327098428f1c 100644 (file)
--- a/doc/index.txt
+++ b/doc/index.txt
Engelbert Gruber,
Juergen Hermann,
Gordon McMillan,
-Patrick Ohly.
+Patrick Ohly,
+Stefan Seefeld.
License
diff --git a/roundup/security.py b/roundup/security.py
index 0d50318d524cc635e20ae5abab68f8aad54a2b48..f34892ee9701716868545540820c70bc2ed59705 100644 (file)
--- a/roundup/security.py
+++ b/roundup/security.py
'''
if not self.permission.has_key(permission):
raise ValueError, 'No permission "%s" defined'%permission
+
+ # look through all the permissions of the given name
for perm in self.permission[permission]:
+ # if we're passed a classname, the permission must match
if perm.klass is not None and perm.klass == classname:
return perm
+ # otherwise the permission klass must be unset
elif not perm.klass and not classname:
return perm
raise ValueError, 'No permission "%s" defined for "%s"'%(permission,
for rolename in roles.split(','):
if not rolename:
continue
+ # for each of the user's Roles, check the permissions
for perm in self.role[rolename].permissions:
- if perm.klass is None or perm.klass == classname:
- return 1
+ # permission name match?
+ if perm.name == permission:
+ # permission klass match?
+ if perm.klass is None or perm.klass == classname:
+ # we have a winner
+ return 1
return 0
def hasNodePermission(self, classname, nodeid, **propspec):
diff --git a/test/test_security.py b/test/test_security.py
index dce68fdb0d8ea0459f2cbc7ae44baa8471095eab..f55656f76cafb3c6e63e65f9859ca3954811f6ca 100644 (file)
--- a/test/test_security.py
+++ b/test/test_security.py
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
-# $Id: test_security.py,v 1.2 2002-07-26 08:27:00 richard Exp $
+# $Id: test_security.py,v 1.3 2002-07-29 21:53:29 richard Exp $
import os, unittest, shutil
def testAccessControls(self):
self.testDBinit()
- self.testInitialiseSecurity()
+ ei = self.db.security.addPermission(name="Edit", klass="issue",
+ description="User is allowed to edit issues")
+ self.db.security.addPermissionToRole('User', ei)
# test class-level access
userid = self.db.user.lookup('admin')
'issue'), 1)
self.assertEquals(self.db.security.hasPermission('Edit', userid,
'user'), 0)
+ self.assertEquals(self.db.security.hasPermission('View', userid,
+ 'issue'), 0)
# test node-level access
issueid = self.db.issue.create(title='foo', assignedto='admin')
#
# $Log: not supported by cvs2svn $
+# Revision 1.2 2002/07/26 08:27:00 richard
+# Very close now. The cgi and mailgw now use the new security API. The two
+# templates have been migrated to that setup. Lots of unit tests. Still some
+# issue in the web form for editing Roles assigned to users.
+#
# Revision 1.1 2002/07/25 07:14:06 richard
# Bugger it. Here's the current shape of the new security implementation.
# Still to do: