Skip to content

Commit f91ef6f

Browse files
author
Richard Jones
committed
Fix "Web Access" permission check to allow serving of static files to Anonymous again
1 parent 62023dd commit f91ef6f

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Fixes:
1515
intevation for funding the fix.
1616
- Fix documentation on user required to run the tests, fixes
1717
issue2550618, thanks to Chris aka 'radioking'
18+
- Add simple doc about translating customised tracker content
19+
- Add "flup" setup documentation, thanks Christian Glass
20+
- Fix "Web Access" permission check to allow serving of static files to
21+
Anonymous again
1822

1923

2024
2009-12-21 1.4.11 (r4413)

roundup/cgi/client.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +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()
383384

384385
# Call the appropriate XML-RPC method.
385386
handler = xmlrpc.RoundupDispatcher(self.db,
@@ -437,6 +438,11 @@ def inner_main(self):
437438
# figure out the context and desired content template
438439
self.determine_context()
439440

441+
# if we've made it this far the context is to a bit of
442+
# Roundup's real web interface (not a file being served up)
443+
# so do the Anonymous Web Acess check now
444+
self.check_web_access()
445+
440446
# possibly handle a form submit action (may change self.classname
441447
# and self.template, and may also append error/ok_messages)
442448
html = self.handle_action()
@@ -711,15 +717,21 @@ def determine_user(self):
711717
# make sure the anonymous user is valid if we're using it
712718
if user == 'anonymous':
713719
self.make_user_anonymous()
714-
if not self.db.security.hasPermission('Web Access', self.userid):
715-
raise Unauthorised, self._("Anonymous users are not "
716-
"allowed to use the web interface")
717720
else:
718721
self.user = user
719722

720723
# reopen the database as the correct user
721724
self.opendb(self.user)
722725

726+
def check_web_access(self):
727+
"""Check that the Anonymous user is actually allowed to use the web
728+
interface and short-circuit all further processing if they're not.
729+
"""
730+
if self.user == 'anonymous':
731+
if not self.db.security.hasPermission('Web Access', self.userid):
732+
raise Unauthorised, self._("Anonymous users are not "
733+
"allowed to use the web interface")
734+
723735
def opendb(self, username):
724736
"""Open the database and set the current user.
725737
@@ -865,6 +877,8 @@ def serve_file(self, designator, dre=re.compile(r'([^\d]+)(\d+)')):
865877
# The classname was not valid.
866878
raise NotFound, str(designator)
867879

880+
# perform the Anonymous user access check
881+
self.check_web_access()
868882

869883
# make sure we have the appropriate properties
870884
props = klass.getprops()

0 commit comments

Comments
 (0)