Skip to content

Commit 4a72e74

Browse files
author
Richard Jones
committed
allow Anonymous users to log in, and register
(assuming they have the Register permission of course)
1 parent f91ef6f commit 4a72e74

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

roundup/cgi/client.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def handle_xmlrpc(self):
380380
self.determine_language()
381381
# Open the database as the correct user.
382382
self.determine_user()
383-
self.check_web_access()
383+
self.check_anonymous_access()
384384

385385
# Call the appropriate XML-RPC method.
386386
handler = xmlrpc.RoundupDispatcher(self.db,
@@ -441,7 +441,7 @@ def inner_main(self):
441441
# if we've made it this far the context is to a bit of
442442
# Roundup's real web interface (not a file being served up)
443443
# so do the Anonymous Web Acess check now
444-
self.check_web_access()
444+
self.check_anonymous_access()
445445

446446
# possibly handle a form submit action (may change self.classname
447447
# and self.template, and may also append error/ok_messages)
@@ -723,10 +723,22 @@ def determine_user(self):
723723
# reopen the database as the correct user
724724
self.opendb(self.user)
725725

726-
def check_web_access(self):
726+
def check_anonymous_access(self):
727727
"""Check that the Anonymous user is actually allowed to use the web
728728
interface and short-circuit all further processing if they're not.
729729
"""
730+
# allow Anonymous to use the "login" and "register" actions (noting
731+
# that "register" has its own "Register" permission check)
732+
if self.form.has_key(':action'):
733+
action = self.form[':action'].value.lower()
734+
elif self.form.has_key('@action'):
735+
action = self.form['@action'].value.lower()
736+
else:
737+
action = None
738+
if action in ('login', 'register'):
739+
return
740+
741+
# otherwise for everything else
730742
if self.user == 'anonymous':
731743
if not self.db.security.hasPermission('Web Access', self.userid):
732744
raise Unauthorised, self._("Anonymous users are not "
@@ -878,7 +890,7 @@ def serve_file(self, designator, dre=re.compile(r'([^\d]+)(\d+)')):
878890
raise NotFound, str(designator)
879891

880892
# perform the Anonymous user access check
881-
self.check_web_access()
893+
self.check_anonymous_access()
882894

883895
# make sure we have the appropriate properties
884896
props = klass.getprops()

0 commit comments

Comments
 (0)