Skip to content

Commit 8cff659

Browse files
author
Richard Jones
committed
Better handling of unauth attempt to edit stuff
1 parent df00655 commit 8cff659

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

roundup/cgi_client.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: cgi_client.py,v 1.128 2002-06-12 21:28:25 gmcm Exp $
18+
# $Id: cgi_client.py,v 1.129 2002-06-20 23:52:11 richard Exp $
1919

2020
__doc__ = """
2121
WWW request handler (also used in the stand-alone server).
@@ -75,7 +75,16 @@ def __init__(self, instance, request, env, form=None):
7575
self.indexer = RoundupIndexer('%s/db'%instance.INSTANCE_HOME)
7676

7777
def getuid(self):
78-
return self.db.user.lookup(self.user)
78+
try:
79+
return self.db.user.lookup(self.user)
80+
except KeyError:
81+
if self.user is None:
82+
# user is not logged in and username 'anonymous' doesn't
83+
# exist in the database
84+
err = _('anonymous users have read-only access only')
85+
else:
86+
err = _("sanity check: unknown user name `%s'")%self.user
87+
raise Unauthorised, errmsg
7988

8089
def header(self, headers=None):
8190
'''Put up the appropriate header.
@@ -1366,6 +1375,10 @@ def parsePropsFromForm(db, cl, form, nodeid=0):
13661375

13671376
#
13681377
# $Log: not supported by cvs2svn $
1378+
# Revision 1.128 2002/06/12 21:28:25 gmcm
1379+
# Allow form to set user-properties on a Fileclass.
1380+
# Don't assume that a Fileclass is named "files".
1381+
#
13691382
# Revision 1.127 2002/06/11 06:38:24 richard
13701383
# . #565996 ] The "Attach a File to this Issue" fails
13711384
#

0 commit comments

Comments
 (0)