changeset 4146:42331c201b02

Fix issue2550553.
author Stefan Seefeld <stefan@seefeld.name>
date Tue, 30 Jun 2009 01:41:11 +0000
parents c15fcee3d8a1
children 5da27b8894d2
files roundup/cgi/actions.py roundup/cgi/templating.py share/roundup/templates/classic/html/page.html share/roundup/templates/classic/schema.py share/roundup/templates/minimal/html/page.html share/roundup/templates/minimal/schema.py
diffstat 6 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/cgi/actions.py	Tue Jun 30 01:32:06 2009 +0000
+++ b/roundup/cgi/actions.py	Tue Jun 30 01:41:11 2009 +0000
@@ -820,7 +820,7 @@
 
 class RegisterAction(RegoCommon, EditCommon):
     name = 'register'
-    permissionType = 'Create'
+    permissionType = 'Register'
 
     def handle(self):
         """Attempt to create a new user based on the contents of the form
--- a/roundup/cgi/templating.py	Tue Jun 30 01:32:06 2009 +0000
+++ b/roundup/cgi/templating.py	Tue Jun 30 01:41:11 2009 +0000
@@ -1268,7 +1268,9 @@
             return self._db.security.hasPermission('Edit', self._client.userid,
                 self._classname, self._name, self._nodeid)
         return self._db.security.hasPermission('Create', self._client.userid,
-            self._classname, self._name)
+            self._classname, self._name) or \
+            self._db.security.hasPermission('Register', self._client.userid,
+                                            self._classname, self._name)
 
     def is_view_ok(self):
         """ Is the user allowed to View the current class?
--- a/share/roundup/templates/classic/html/page.html	Tue Jun 30 01:32:06 2009 +0000
+++ b/share/roundup/templates/classic/html/page.html	Tue Jun 30 01:41:11 2009 +0000
@@ -136,7 +136,7 @@
     <input type="hidden" name="__came_from" tal:attributes="value string:${request/base}${request/env/PATH_INFO}">
     <span tal:replace="structure request/indexargs_form" />
     <a href="user?@template=register"
-       tal:condition="python:request.user.hasPermission('Create', 'user')"
+       tal:condition="python:request.user.hasPermission('Register', 'user')"
      i18n:translate="">Register</a><br>
     <a href="user?@template=forgotten" i18n:translate="">Lost&nbsp;your&nbsp;login?</a><br>
    </p>
--- a/share/roundup/templates/classic/schema.py	Tue Jun 30 01:32:06 2009 +0000
+++ b/share/roundup/templates/classic/schema.py	Tue Jun 30 01:41:11 2009 +0000
@@ -47,6 +47,8 @@
                 roles=String(),     # comma-separated string of Role names
                 timezone=String())
 user.setkey("username")
+db.security.addPermission(name='Register', klass='user',
+                          description='User is allowed to register new user')
 
 # FileClass automatically gets this property in addition to the Class ones:
 #   content = String()    [saved to disk in <tracker home>/db/files/]
@@ -154,7 +156,7 @@
 # Assign the appropriate permissions to the anonymous user's Anonymous
 # Role. Choices here are:
 # - Allow anonymous users to register
-db.security.addPermissionToRole('Anonymous', 'Create', 'user')
+db.security.addPermissionToRole('Anonymous', 'Register', 'user')
 
 # Allow anonymous users access to view issues (and the related, linked
 # information)
--- a/share/roundup/templates/minimal/html/page.html	Tue Jun 30 01:32:06 2009 +0000
+++ b/share/roundup/templates/minimal/html/page.html	Tue Jun 30 01:41:11 2009 +0000
@@ -135,7 +135,7 @@
     <input type="hidden" name="__came_from" tal:attributes="value string:${request/base}${request/env/PATH_INFO}">
     <span tal:replace="structure request/indexargs_form" />
     <a href="user?@template=register"
-       tal:condition="python:request.user.hasPermission('Create', 'user')"
+       tal:condition="python:request.user.hasPermission('Register', 'user')"
      i18n:translate="">Register</a><br>
     <a href="user?@template=forgotten" i18n:translate="">Lost&nbsp;your&nbsp;login?</a><br>
    </p>
--- a/share/roundup/templates/minimal/schema.py	Tue Jun 30 01:32:06 2009 +0000
+++ b/share/roundup/templates/minimal/schema.py	Tue Jun 30 01:41:11 2009 +0000
@@ -60,6 +60,6 @@
 # Assign the appropriate permissions to the anonymous user's
 # Anonymous Role. Choices here are:
 # - Allow anonymous users to register
-db.security.addPermissionToRole('Anonymous', 'Create', 'user')
+db.security.addPermissionToRole('Anonymous', 'Register', 'user')
 
 # vim: set et sts=4 sw=4 :

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