summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6e48e36)
raw | patch | inline | side by side (parent: 6e48e36)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 29 Jan 2010 05:29:49 +0000 (05:29 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 29 Jan 2010 05:29:49 +0000 (05:29 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4432 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/cgi/templating.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index 1296bdedda8334d00cd5180348249e7fad7b64f4..4a72e3fc7c3336ec18a759dcfd43722f1710f645 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
- Add "flup" setup documentation, thanks Christian Glass
- Fix "Web Access" permission check to allow serving of static files to
Anonymous again
+- Add check for "Web Access" permission in all web templating permission
+ checks
2009-12-21 1.4.11 (r4413)
index fad7952fbef9b83d0dc78239f9cd8d10d7d3f2bb..39166082308eac9e0fa2738583e90ca5c7ed8388 100644 (file)
def is_edit_ok(self):
""" Is the user allowed to Create the current class?
"""
- return self._db.security.hasPermission('Create', self._client.userid,
- self._classname)
+ perm = self._db.security.hasPermission
+ return perm('Web Access', self._client.userid) and perm('Create',
+ self._client.userid, self._classname)
def is_retire_ok(self):
""" Is the user allowed to retire items of the current class?
"""
- return self._db.security.hasPermission('Retire', self._client.userid,
- self._classname)
+ perm = self._db.security.hasPermission
+ return perm('Web Access', self._client.userid) and perm('Retire',
+ self._client.userid, self._classname)
def is_view_ok(self):
""" Is the user allowed to View the current class?
"""
- return self._db.security.hasPermission('View', self._client.userid,
- self._classname)
+ perm = self._db.security.hasPermission
+ return perm('Web Access', self._client.userid) and perm('View',
+ self._client.userid, self._classname)
def is_only_view_ok(self):
""" Is the user only allowed to View (ie. not Create) the current class?
# check perms
check = self._client.db.security.hasPermission
userid = self._client.userid
+ if not check('Web Access', userid):
+ return []
l = [HTMLItem(self._client, self._classname, id) for id in l
if check('View', userid, self._classname, itemid=id)]
writer = csv.writer(s)
writer.writerow(props)
check = self._client.db.security.hasPermission
+ userid = self._client.userid
+ if not check('Web Access', userid):
+ return ''
for nodeid in self._klass.list():
l = []
for name in props:
# check permission to view this property on this item
- if not check('View', self._client.userid, itemid=nodeid,
+ if not check('View', userid, itemid=nodeid,
classname=self._klass.classname, property=name):
raise Unauthorised('view', self._klass.classname,
translator=self._client.translator)
check = self._db.security.hasPermission
userid = self._client.userid
+ if not check('Web Access', userid):
+ return []
l = [HTMLItem(self._client, self.classname, id)
for id in self._klass.filter(None, filterspec, sort, group)
def is_edit_ok(self):
""" Is the user allowed to Edit this item?
"""
- return self._db.security.hasPermission('Edit', self._client.userid,
- self._classname, itemid=self._nodeid)
+ perm = self._db.security.hasPermission
+ return perm('Web Access', self._client.userid) and perm('Edit',
+ self._client.userid, self._classname, itemid=self._nodeid)
def is_retire_ok(self):
""" Is the user allowed to Reture this item?
"""
- return self._db.security.hasPermission('Retire', self._client.userid,
- self._classname, itemid=self._nodeid)
+ perm = self._db.security.hasPermission
+ return perm('Web Access', self._client.userid) and perm('Retire',
+ self._client.userid, self._classname, itemid=self._nodeid)
def is_view_ok(self):
""" Is the user allowed to View this item?
"""
- if self._db.security.hasPermission('View', self._client.userid,
- self._classname, itemid=self._nodeid):
+ perm = self._db.security.hasPermission
+ if perm('Web Access', self._client.userid) and perm('View',
+ self._client.userid, self._classname, itemid=self._nodeid):
return 1
return self.is_edit_ok()
property. Check "Create" for new items, or "Edit" for existing
ones.
"""
+ perm = self._db.security.hasPermission
+ userid = self._client.userid
+ if not perm('Web Access', userid):
+ return False
if self._nodeid:
- return self._db.security.hasPermission('Edit', self._client.userid,
- self._classname, self._name, self._nodeid)
- return self._db.security.hasPermission('Create', self._client.userid,
- self._classname, self._name) or \
- self._db.security.hasPermission('Register', self._client.userid,
- self._classname, self._name)
+ return perm('Edit', userid, self._classname, self._name,
+ self._nodeid)
+ return perm('Create', userid, self._classname, self._name) or \
+ perm('Register', userid, self._classname, self._name)
def is_view_ok(self):
""" Is the user allowed to View the current class?
"""
- if self._db.security.hasPermission('View', self._client.userid,
- self._classname, self._name, self._nodeid):
+ perm = self._db.security.hasPermission
+ if perm('Web Access', self._client.userid) and perm('View',
+ self._client.userid, self._classname, self._name, self._nodeid):
return 1
return self.is_edit_ok()
check = self._db.security.hasPermission
userid = self._client.userid
classname = self._prop.classname
- for value in values:
- if check('View', userid, classname, itemid=value):
- yield HTMLItem(self._client, classname, value)
+ if check('Web Access', userid):
+ for value in values:
+ if check('View', userid, classname, itemid=value):
+ yield HTMLItem(self._client, classname, value)
def __iter__(self):
""" iterate and return a new HTMLItem
def batch(self):
""" Return a batch object for results from the "current search"
"""
+ check = self._client.db.security.hasPermission
+ userid = self._client.userid
+ if not check('Web Access', userid):
+ return Batch(self.client, [], self.pagesize, self.startwith,
+ classname=self.classname)
+
filterspec = self.filterspec
sort = self.sort
group = self.group
matches = None
# filter for visibility
- check = self._client.db.security.hasPermission
- userid = self._client.userid
l = [id for id in klass.filter(matches, filterspec, sort, group)
if check('View', userid, self.classname, itemid=id)]