Mercurial > p > roundup > code
comparison roundup/cgi/actions.py @ 3074:a64ca23531d1 maint-0.7
fix permission lookup in query editing
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 05 Jan 2005 22:10:28 +0000 |
| parents | fa49f3fe6afa |
| children |
comparison
equal
deleted
inserted
replaced
| 3072:c2f9cd78f12f | 3074:a64ca23531d1 |
|---|---|
| 1 #$Id: actions.py,v 1.27.2.8 2004-12-15 00:07:58 richard Exp $ | 1 #$Id: actions.py,v 1.27.2.9 2005-01-05 22:09:04 richard Exp $ |
| 2 | 2 |
| 3 import re, cgi, StringIO, urllib, Cookie, time, random | 3 import re, cgi, StringIO, urllib, Cookie, time, random |
| 4 | 4 |
| 5 from roundup import hyperdb, token, date, password, rcsv, exceptions | 5 from roundup import hyperdb, token, date, password, rcsv, exceptions |
| 6 from roundup.i18n import _ | 6 from roundup.i18n import _ |
| 50 not self.hasPermission(self.permissionType)): | 50 not self.hasPermission(self.permissionType)): |
| 51 info = {'action': self.name, 'classname': self.classname} | 51 info = {'action': self.name, 'classname': self.classname} |
| 52 raise Unauthorised, _('You do not have permission to ' | 52 raise Unauthorised, _('You do not have permission to ' |
| 53 '%(action)s the %(classname)s class.')%info | 53 '%(action)s the %(classname)s class.')%info |
| 54 | 54 |
| 55 def hasPermission(self, permission): | 55 _marker = [] |
| 56 def hasPermission(self, permission, classname=_marker): | |
| 56 """Check whether the user has 'permission' on the current class.""" | 57 """Check whether the user has 'permission' on the current class.""" |
| 58 if classname is self._marker: | |
| 59 classname = self.client.classname | |
| 57 return self.db.security.hasPermission(permission, self.client.userid, | 60 return self.db.security.hasPermission(permission, self.client.userid, |
| 58 self.client.classname) | 61 classname) |
| 59 | 62 |
| 60 class ShowAction(Action): | 63 class ShowAction(Action): |
| 61 def handle(self, typere=re.compile('[@:]type'), | 64 def handle(self, typere=re.compile('[@:]type'), |
| 62 numre=re.compile('[@:]number')): | 65 numre=re.compile('[@:]number')): |
| 63 """Show a node of a particular class/id.""" | 66 """Show a node of a particular class/id.""" |
