schemas/bootstrap.py
branchstable
changeset 4755 13a5d3a7410e
parent 4754 6bf17f810975
child 5179 f08943f22334
--- a/schemas/bootstrap.py	Tue Mar 02 15:43:26 2010 +0100
+++ b/schemas/bootstrap.py	Tue Mar 02 15:44:26 2010 +0100
@@ -307,3 +307,13 @@
     cardinality = '?*'
     subject = 'CWEType'
     object = 'CWEType'
+
+def post_build_callback(schema):
+    """set attributes permissions for schema/workflow entities"""
+    from cubicweb.schema import SCHEMA_TYPES, WORKFLOW_TYPES, META_RTYPES
+    for eschema in schema.entities():
+        if eschema in SCHEMA_TYPES or eschema in WORKFLOW_TYPES:
+            for rschema in eschema.subject_relations():
+                if rschema.final and not rschema in META_RTYPES:
+                    rdef = eschema.rdef(rschema)
+                    rdef.permissions = PUB_SYSTEM_ATTR_PERMS