diff --git a/test/test_security.py b/test/test_security.py
index dce68fdb0d8ea0459f2cbc7ae44baa8471095eab..97e759f7a58e3da873a4395062c9c6fb0ae97fc5 100644 (file)
--- a/test/test_security.py
+++ b/test/test_security.py
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
-# $Id: test_security.py,v 1.2 2002-07-26 08:27:00 richard Exp $
+# $Id: test_security.py,v 1.5 2002-09-20 05:08:00 richard Exp $
import os, unittest, shutil
import os, unittest, shutil
if os.path.exists(config.DATABASE):
shutil.rmtree(config.DATABASE)
os.makedirs(config.DATABASE + '/files')
if os.path.exists(config.DATABASE):
shutil.rmtree(config.DATABASE)
os.makedirs(config.DATABASE + '/files')
- self.db = anydbm.Database(config, 'test')
+ self.db = anydbm.Database(config, 'admin')
setupSchema(self.db, 1, anydbm)
def testInterfaceSecurity(self):
setupSchema(self.db, 1, anydbm)
def testInterfaceSecurity(self):
self.db.security.getPermission('View', 'issue')
def testDBinit(self):
self.db.security.getPermission('View', 'issue')
def testDBinit(self):
- self.db.user.create(username="admin", roles='Admin')
self.db.user.create(username="anonymous", roles='User')
def testAccessControls(self):
self.testDBinit()
self.db.user.create(username="anonymous", roles='User')
def testAccessControls(self):
self.testDBinit()
- self.testInitialiseSecurity()
+ ei = self.db.security.addPermission(name="Edit", klass="issue",
+ description="User is allowed to edit issues")
+ self.db.security.addPermissionToRole('User', ei)
# test class-level access
userid = self.db.user.lookup('admin')
# test class-level access
userid = self.db.user.lookup('admin')
'issue'), 1)
self.assertEquals(self.db.security.hasPermission('Edit', userid,
'user'), 0)
'issue'), 1)
self.assertEquals(self.db.security.hasPermission('Edit', userid,
'user'), 0)
+ self.assertEquals(self.db.security.hasPermission('View', userid,
+ 'issue'), 0)
# test node-level access
issueid = self.db.issue.create(title='foo', assignedto='admin')
# test node-level access
issueid = self.db.issue.create(title='foo', assignedto='admin')
return unittest.makeSuite(PermissionTest)
return unittest.makeSuite(PermissionTest)
-#
-# $Log: not supported by cvs2svn $
-# Revision 1.1 2002/07/25 07:14:06 richard
-# Bugger it. Here's the current shape of the new security implementation.
-# Still to do:
-# . call the security funcs from cgi and mailgw
-# . change shipped templates to include correct initialisation and remove
-# the old config vars
-# ... that seems like a lot. The bulk of the work has been done though. Honest :)
-#
-# Revision 1.1 2002/07/10 06:40:01 richard
-# ehem, forgot to add
-#
-#
-#
# vim: set filetype=python ts=4 sw=4 et si
# vim: set filetype=python ts=4 sw=4 et si