--- a/schemas/bootstrap.py Wed Apr 07 14:53:35 2010 +0200
+++ b/schemas/bootstrap.py Thu Apr 08 09:07:54 2010 +0200
@@ -311,8 +311,9 @@
def post_build_callback(schema):
"""set attributes permissions for schema/workflow entities"""
from cubicweb.schema import SCHEMA_TYPES, WORKFLOW_TYPES, META_RTYPES
+ wftypes = WORKFLOW_TYPES - set(('TrInfo',))
for eschema in schema.entities():
- if eschema in SCHEMA_TYPES or eschema in WORKFLOW_TYPES:
+ if eschema in SCHEMA_TYPES or eschema in wftypes:
for rschema in eschema.subject_relations():
if rschema.final and not rschema in META_RTYPES:
rdef = eschema.rdef(rschema)
--- a/test/unittest_schema.py Wed Apr 07 14:53:35 2010 +0200
+++ b/test/unittest_schema.py Thu Apr 08 09:07:54 2010 +0200
@@ -241,6 +241,17 @@
self.failUnless('has_text' in schema['CWUser'].subject_relations())
self.failIf('has_text' in schema['EmailAddress'].subject_relations())
+ def test_permission_settings(self):
+ schema = loader.load(config)
+ aschema = schema['TrInfo'].rdef('comment')
+ self.assertEquals(aschema.get_groups('read'),
+ set(('managers', 'users', 'guests')))
+ self.assertEquals(aschema.get_rqlexprs('read'),
+ ())
+ self.assertEquals(aschema.get_groups('update'),
+ set(('managers',)))
+ self.assertEquals([x.expression for x in aschema.get_rqlexprs('update')],
+ ['U has_update_permission X'])
class BadSchemaRQLExprTC(TestCase):
def setUp(self):
@@ -257,16 +268,20 @@
self.assertEquals(str(ex), msg)
def test_rrqlexpr_on_etype(self):
- self._test('rrqlexpr_on_eetype.py', "can't use RRQLExpression on ToTo, use an ERQLExpression")
+ self._test('rrqlexpr_on_eetype.py',
+ "can't use RRQLExpression on ToTo, use an ERQLExpression")
def test_erqlexpr_on_rtype(self):
- self._test('erqlexpr_on_ertype.py', "can't use ERQLExpression on relation ToTo toto TuTu, use a RRQLExpression")
+ self._test('erqlexpr_on_ertype.py',
+ "can't use ERQLExpression on relation ToTo toto TuTu, use a RRQLExpression")
def test_rqlexpr_on_rtype_read(self):
- self._test('rqlexpr_on_ertype_read.py', "can't use rql expression for read permission of relation ToTo toto TuTu")
+ self._test('rqlexpr_on_ertype_read.py',
+ "can't use rql expression for read permission of relation ToTo toto TuTu")
def test_rrqlexpr_on_attr(self):
- self._test('rrqlexpr_on_attr.py', "can't use RRQLExpression on attribute ToTo.attr[String], use an ERQLExpression")
+ self._test('rrqlexpr_on_attr.py',
+ "can't use RRQLExpression on attribute ToTo.attr[String], use an ERQLExpression")
class NormalizeExpressionTC(TestCase):
@@ -277,8 +292,10 @@
class RQLExpressionTC(TestCase):
def test_comparison(self):
- self.assertEquals(ERQLExpression('X is CWUser', 'X', 0), ERQLExpression('X is CWUser', 'X', 0))
- self.assertNotEquals(ERQLExpression('X is CWUser', 'X', 0), ERQLExpression('X is CWGroup', 'X', 0))
+ self.assertEquals(ERQLExpression('X is CWUser', 'X', 0),
+ ERQLExpression('X is CWUser', 'X', 0))
+ self.assertNotEquals(ERQLExpression('X is CWUser', 'X', 0),
+ ERQLExpression('X is CWGroup', 'X', 0))
class GuessRrqlExprMainVarsTC(TestCase):
def test_exists(self):