[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
--- a/schemas/base.py Mon Feb 07 15:13:04 2011 +0100
+++ b/schemas/base.py Mon Feb 07 15:13:05 2011 +0100
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -260,13 +260,20 @@
})
+ENTITY_MANAGERS_PERMISSIONS = {
+ 'read': ('managers',),
+ 'add': ('managers',),
+ 'update': ('managers',),
+ 'delete': ('managers',),
+ }
+RELATION_MANAGERS_PERMISSIONS = {
+ 'read': ('managers',),
+ 'add': ('managers',),
+ 'delete': ('managers',),
+ }
+
class CWSourceHostConfig(EntityType):
- __permissions__ = {
- 'read': ('managers',),
- 'add': ('managers',),
- 'update': ('managers',),
- 'delete': ('managers',),
- }
+ __permissions__ = ENTITY_MANAGERS_PERMISSIONS
__unique_together__ = [('match_host', 'cw_host_config_of')]
match_host = String(required=True, maxsize=128,
description=_('regexp matching host(s) to which this config applies'))
@@ -282,6 +289,7 @@
class cw_host_config_of(RelationDefinition):
+ __permissions__ = RELATION_MANAGERS_PERMISSIONS
subject = 'CWSourceHostConfig'
object = 'CWSource'
cardinality = '1*'
@@ -297,6 +305,7 @@
subject = '*'
object = 'CWSource'
cardinality = '1*'
+ composite = 'object'
class cw_support(RelationDefinition):
subject = 'CWSource'