summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3cecc01)
raw | patch | inline | side by side (parent: 3cecc01)
author | gmcm <gmcm@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 30 Jul 2002 20:04:39 +0000 (20:04 +0000) | ||
committer | gmcm <gmcm@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 30 Jul 2002 20:04:39 +0000 (20:04 +0000) |
Put some more permission checks in cgi_client.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@935 57a73879-2fb5-44c3-a270-3262357dd7e2
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@935 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/backends/back_metakit.py | patch | blob | history | |
roundup/cgi_client.py | patch | blob | history |
index 01ca6741510f0ff94a42ed9f4400631490b385f0..7d173c1856b134de95d2ea647e688bdf5d3ad5f1 100755 (executable)
self.config = config
self.journaltag = journaltag
self.classes = {}
- self._classes = []
self.dirty = 0
self.lockfile = None
self._db = self.__open()
diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py
index d0b188a935f828814623226f64d90c76c11c66b7..c7a41dc317b418d5cca3f1aa1895f935dd135d0b 100644 (file)
--- a/roundup/cgi_client.py
+++ b/roundup/cgi_client.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: cgi_client.py,v 1.148 2002-07-30 16:09:11 gmcm Exp $
+# $Id: cgi_client.py,v 1.149 2002-07-30 20:04:38 gmcm Exp $
__doc__ = """
WWW request handler (also used in the stand-alone server).
# don't try to set properties if the user has just logged in
if keys and not self.form.has_key('__login_name'):
try:
- props = parsePropsFromForm(self.db, cl, self.form, self.nodeid)
- # make changes to the node
- self._changenode(props)
- # handle linked nodes
- self._post_editnode(self.nodeid)
- # and some nice feedback for the user
- if props:
- message = _('%(changes)s edited ok')%{'changes':
- ', '.join(props.keys())}
- elif self.form.has_key('__note') and self.form['__note'].value:
- message = _('note added')
- elif (self.form.has_key('__file') and
- self.form['__file'].filename):
- message = _('file added')
+ userid = self.db.user.lookup(self.user)
+ if not self.db.security.hasPermission('Edit', userid):
+ message = _('You do not have permission to edit %s' %cn)
else:
- message = _('nothing changed')
+ props = parsePropsFromForm(self.db, cl, self.form, self.nodeid)
+ # make changes to the node
+ self._changenode(props)
+ # handle linked nodes
+ self._post_editnode(self.nodeid)
+ # and some nice feedback for the user
+ if props:
+ message = _('%(changes)s edited ok')%{'changes':
+ ', '.join(props.keys())}
+ elif self.form.has_key('__note') and self.form['__note'].value:
+ message = _('note added')
+ elif (self.form.has_key('__file') and
+ self.form['__file'].filename):
+ message = _('file added')
+ else:
+ message = _('nothing changed')
except:
self.db.rollback()
s = StringIO.StringIO()
if type(value) != type([]): value = [value]
for value in value:
designator, property = value.split(':')
- link, nodeid = roundupdb.splitDesignator(designator)
+ link, nodeid = hyperdb.splitDesignator(designator)
link = self.db.classes[link]
# take a dupe of the list so we're not changing the cache
value = link.get(nodeid, property)[:]
if type(value) != type([]): value = [value]
for value in value:
designator, property = value.split(':')
- link, nodeid = roundupdb.splitDesignator(designator)
+ link, nodeid = hyperdb.splitDesignator(designator)
link = self.db.classes[link]
link.set(nodeid, **{property: nid})
self.db.sessions.set(self.session, user=user, last_use=time.time())
# and commit immediately
- self.db.commit()
+ self.db.sessions.commit()
# expire us in a long, long time
expire = Cookie._getdate(86400*365)
# get the session key from the cookie
self.session = cookie['roundup_user'].value
-
# get the user from the session
try:
# update the lifetime datestamp
# sanity check on the user still being valid
try:
self.db.user.lookup(user)
- except KeyError:
+ except (KeyError, TypeError):
user = 'anonymous'
# make sure the anonymous user is valid if we're using it
#
# $Log: not supported by cvs2svn $
+# Revision 1.148 2002/07/30 16:09:11 gmcm
+# Simple optimization.
+#
# Revision 1.147 2002/07/30 08:22:38 richard
# Session storage in the hyperdb was horribly, horribly inefficient. We use
# a simple anydbm wrapper now - which could be overridden by the metakit