Skip to content

Commit 61e0a07

Browse files
author
Richard Jones
committed
fixes to make registration work again
1 parent 5af54f7 commit 61e0a07

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

roundup/cgi/actions.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -840,12 +840,6 @@ def handle(self):
840840
% str(message))
841841
return
842842

843-
# registration isn't allowed to supply roles
844-
user_props = props[('user', None)]
845-
if user_props.has_key('roles'):
846-
raise exceptions.Unauthorised, self._(
847-
"It is not permitted to supply roles at registration.")
848-
849843
# skip the confirmation step?
850844
if self.db.config['INSTANT_REGISTRATION']:
851845
# handle the create now
@@ -923,6 +917,17 @@ def handle(self):
923917
# redirect to the "you're almost there" page
924918
raise exceptions.Redirect, '%suser?@template=rego_progress'%self.base
925919

920+
def newItemPermission(self, props, classname=None):
921+
"""Just check the "Register" permission.
922+
"""
923+
# registration isn't allowed to supply roles
924+
if props.has_key('roles'):
925+
raise exceptions.Unauthorised, self._(
926+
"It is not permitted to supply roles at registration.")
927+
928+
# technically already checked, but here for clarity
929+
return self.hasPermission('Register', classname=classname)
930+
926931
class LogoutAction(Action):
927932
def handle(self):
928933
"""Make us really anonymous - nuke the session too."""

roundup/cgi/client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,12 @@ def check_anonymous_access(self):
738738
if action in ('login', 'register'):
739739
return
740740

741+
# allow Anonymous to view the "user" "register" template if they're
742+
# allowed to register
743+
if (self.db.security.hasPermission('Register', self.userid, 'user')
744+
and self.classname == 'user' and self.template == 'register'):
745+
return
746+
741747
# otherwise for everything else
742748
if self.user == 'anonymous':
743749
if not self.db.security.hasPermission('Web Access', self.userid):

roundup/cgi/templating.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,9 +1304,9 @@ def is_edit_ok(self):
13041304
"""
13051305
perm = self._db.security.hasPermission
13061306
userid = self._client.userid
1307-
if not perm('Web Access', userid):
1308-
return False
13091307
if self._nodeid:
1308+
if not perm('Web Access', userid):
1309+
return False
13101310
return perm('Edit', userid, self._classname, self._name,
13111311
self._nodeid)
13121312
return perm('Create', userid, self._classname, self._name) or \

0 commit comments

Comments
 (0)