Skip to content

Commit da9e988

Browse files
author
Alexander Smishlajev
committed
add note about new functionality to Permission class docstring;
remove obsolete permission defaults; fix vim modeline
1 parent 2550199 commit da9e988

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

roundup/security.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,19 @@ class Permission:
1111
- name
1212
- description
1313
- klass (optional)
14+
- property (optional)
15+
- check function (optional)
1416
1517
The klass may be unset, indicating that this permission is not
1618
locked to a particular class. That means there may be multiple
1719
Permissions for the same name for different classes.
20+
21+
If property name is set, permission is restricted to that
22+
property only.
23+
24+
If check function is set, permission is granted only when
25+
the function returns value interpreted as boolean true.
26+
The function is called with arguments db, userid, itemid.
1827
'''
1928
def __init__(self, name='', description='', klass=None,
2029
property=None, check=None):
@@ -90,10 +99,6 @@ def __init__(self, db):
9099
ae = self.addPermission(name="View",
91100
description="User may access everything")
92101
self.addPermissionToRole('Admin', ae)
93-
reg = self.addPermission(name="Register Web",
94-
description="User may register through the web")
95-
reg = self.addPermission(name="Register Email",
96-
description="User may register through the email")
97102

98103
# initialise the permissions and roles needed for the UIs
99104
from roundup.cgi import client
@@ -189,4 +194,4 @@ def addPermissionToRole(self, rolename, permission):
189194
role = self.role[rolename.lower()]
190195
role.permissions.append(permission)
191196

192-
# vim: set filetype=python ts=4 sw=4 et si
197+
# vim: set filetype=python sts=4 sw=4 et si :

0 commit comments

Comments
 (0)