|
1 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
|
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
|
3 # |
|
4 # This file is part of CubicWeb. |
|
5 # |
|
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
|
7 # terms of the GNU Lesser General Public License as published by the Free |
|
8 # Software Foundation, either version 2.1 of the License, or (at your option) |
|
9 # any later version. |
|
10 # |
|
11 # logilab-common is distributed in the hope that it will be useful, but WITHOUT |
|
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
|
14 # details. |
|
15 # |
|
16 # You should have received a copy of the GNU Lesser General Public License along |
|
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
1 """core CubicWeb schema necessary for bootstrapping the actual instance's schema |
18 """core CubicWeb schema necessary for bootstrapping the actual instance's schema |
2 |
19 |
3 :organization: Logilab |
|
4 :copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
|
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
|
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
|
7 """ |
20 """ |
8 __docformat__ = "restructuredtext en" |
21 __docformat__ = "restructuredtext en" |
9 _ = unicode |
22 _ = unicode |
10 |
23 |
11 from yams.buildobjs import (EntityType, RelationType, RelationDefinition, |
24 from yams.buildobjs import (EntityType, RelationType, RelationDefinition, |
309 object = 'CWEType' |
322 object = 'CWEType' |
310 |
323 |
311 def post_build_callback(schema): |
324 def post_build_callback(schema): |
312 """set attributes permissions for schema/workflow entities""" |
325 """set attributes permissions for schema/workflow entities""" |
313 from cubicweb.schema import SCHEMA_TYPES, WORKFLOW_TYPES, META_RTYPES |
326 from cubicweb.schema import SCHEMA_TYPES, WORKFLOW_TYPES, META_RTYPES |
|
327 wftypes = WORKFLOW_TYPES - set(('TrInfo',)) |
314 for eschema in schema.entities(): |
328 for eschema in schema.entities(): |
315 if eschema in SCHEMA_TYPES or eschema in WORKFLOW_TYPES: |
329 if eschema in SCHEMA_TYPES or eschema in wftypes: |
316 for rschema in eschema.subject_relations(): |
330 for rschema in eschema.subject_relations(): |
317 if rschema.final and not rschema in META_RTYPES: |
331 if rschema.final and not rschema in META_RTYPES: |
318 rdef = eschema.rdef(rschema) |
332 rdef = eschema.rdef(rschema) |
319 rdef.permissions = PUB_SYSTEM_ATTR_PERMS |
333 rdef.permissions = PUB_SYSTEM_ATTR_PERMS |