author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Mon, 29 Jul 2013 16:00:40 +0200 | |
branch | stable |
changeset 9197 | 9905d9efa4a3 |
parent 8945 | ba9e3fbfa5a5 |
child 9299 | c5eed908117d |
permissions | -rw-r--r-- |
8945
ba9e3fbfa5a5
[schemaserial] serialize additional yams parameter for customs type
Vincent Michel <vincent.michel@logilab.fr>
parents:
6815
diff
changeset
|
1 |
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5179
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5179
diff
changeset
|
3 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5179
diff
changeset
|
4 |
# This file is part of CubicWeb. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5179
diff
changeset
|
5 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5179
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5179
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5179
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5179
diff
changeset
|
9 |
# any later version. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5179
diff
changeset
|
10 |
# |
5424
8ecbcbff9777
replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5421
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5179
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5179
diff
changeset
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5179
diff
changeset
|
14 |
# details. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5179
diff
changeset
|
15 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5179
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5179
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2459
diff
changeset
|
18 |
"""core CubicWeb schema necessary for bootstrapping the actual instance's schema |
5782
8ff48d1a319f
[rql2sql] when using HAVING to by-pass rql limitation (not to filter on result of an aggregat function), we should emit SQL that doesn't use HAVING to avoid potential backend error because variables are not grouped. Closes #1061603.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
19 |
""" |
0 | 20 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
21 |
__docformat__ = "restructuredtext en" |
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
22 |
_ = unicode |
0 | 23 |
|
8945
ba9e3fbfa5a5
[schemaserial] serialize additional yams parameter for customs type
Vincent Michel <vincent.michel@logilab.fr>
parents:
6815
diff
changeset
|
24 |
from yams.buildobjs import (EntityType, RelationType, RelationDefinition, Bytes, |
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
25 |
SubjectRelation, RichString, String, Boolean, Int) |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
26 |
from cubicweb.schema import ( |
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
27 |
RQLConstraint, |
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
28 |
PUB_SYSTEM_ENTITY_PERMS, PUB_SYSTEM_REL_PERMS, PUB_SYSTEM_ATTR_PERMS |
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
29 |
) |
0 | 30 |
|
31 |
# not restricted since as "is" is handled as other relations, guests need |
|
32 |
# access to this |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
33 |
class CWEType(EntityType): |
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2459
diff
changeset
|
34 |
"""define an entity type, used to build the instance schema""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
35 |
__permissions__ = PUB_SYSTEM_ENTITY_PERMS |
0 | 36 |
name = String(required=True, indexed=True, internationalizable=True, |
37 |
unique=True, maxsize=64) |
|
1451 | 38 |
description = RichString(internationalizable=True, |
627
36ade1128af7
use RichString wherever possible in the stdlib
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
39 |
description=_('semantic description of this entity type')) |
0 | 40 |
# necessary to filter using RQL |
41 |
final = Boolean(description=_('automatic')) |
|
42 |
||
43 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
44 |
class CWRType(EntityType): |
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2459
diff
changeset
|
45 |
"""define a relation type, used to build the instance schema""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
46 |
__permissions__ = PUB_SYSTEM_ENTITY_PERMS |
0 | 47 |
name = String(required=True, indexed=True, internationalizable=True, |
48 |
unique=True, maxsize=64) |
|
2129
fbfab570a276
use RichString
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2127
diff
changeset
|
49 |
description = RichString(internationalizable=True, |
fbfab570a276
use RichString
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2127
diff
changeset
|
50 |
description=_('semantic description of this relation type')) |
4467
0e73d299730a
fix long-waiting symetric typo: should be spelled symmetric. Add auto database migration on schema deserialization
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4319
diff
changeset
|
51 |
symmetric = Boolean(description=_('is this relation equivalent in both direction ?')) |
0 | 52 |
inlined = Boolean(description=_('is this relation physically inlined? you should know what you\'re doing if you are changing this!')) |
53 |
fulltext_container = String(description=_('if full text content of subject/object entity ' |
|
54 |
'should be added to other side entity (the container).'), |
|
55 |
vocabulary=('', _('subject'), _('object')), |
|
56 |
maxsize=8, default=None) |
|
57 |
final = Boolean(description=_('automatic')) |
|
58 |
||
59 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
60 |
class CWAttribute(EntityType): |
0 | 61 |
"""define a final relation: link a final relation type from a non final |
1451 | 62 |
entity to a final entity type. |
0 | 63 |
|
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2459
diff
changeset
|
64 |
used to build the instance schema |
0 | 65 |
""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
66 |
__permissions__ = PUB_SYSTEM_ENTITY_PERMS |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
67 |
relation_type = SubjectRelation('CWRType', cardinality='1*', |
0 | 68 |
constraints=[RQLConstraint('O final TRUE')], |
69 |
composite='object') |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
70 |
from_entity = SubjectRelation('CWEType', cardinality='1*', |
0 | 71 |
constraints=[RQLConstraint('O final FALSE')], |
72 |
composite='object') |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
73 |
to_entity = SubjectRelation('CWEType', cardinality='1*', |
0 | 74 |
constraints=[RQLConstraint('O final TRUE')], |
75 |
composite='object') |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
76 |
constrained_by = SubjectRelation('CWConstraint', cardinality='*1', composite='subject') |
1451 | 77 |
|
0 | 78 |
cardinality = String(maxsize=2, internationalizable=True, |
1979
daf297034197
remove meaningless cards for attributes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
79 |
vocabulary=[_('?1'), _('11')], |
0 | 80 |
description=_('subject/object cardinality')) |
81 |
ordernum = Int(description=('control subject entity\'s relations order'), default=0) |
|
1451 | 82 |
|
0 | 83 |
indexed = Boolean(description=_('create an index for quick search on this attribute')) |
84 |
fulltextindexed = Boolean(description=_('index this attribute\'s value in the plain text index')) |
|
85 |
internationalizable = Boolean(description=_('is this attribute\'s value translatable')) |
|
86 |
defaultval = String(maxsize=256) |
|
8945
ba9e3fbfa5a5
[schemaserial] serialize additional yams parameter for customs type
Vincent Michel <vincent.michel@logilab.fr>
parents:
6815
diff
changeset
|
87 |
extra_props = Bytes(description=_('additional type specific properties')) |
1451 | 88 |
|
2129
fbfab570a276
use RichString
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2127
diff
changeset
|
89 |
description = RichString(internationalizable=True, |
fbfab570a276
use RichString
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2127
diff
changeset
|
90 |
description=_('semantic description of this attribute')) |
1451 | 91 |
|
0 | 92 |
|
1451 | 93 |
CARDINALITY_VOCAB = [_('?*'), _('1*'), _('+*'), _('**'), |
94 |
_('?+'), _('1+'), _('++'), _('*+'), |
|
0 | 95 |
_('?1'), _('11'), _('+1'), _('*1'), |
96 |
_('??'), _('1?'), _('+?'), _('*?')] |
|
97 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
98 |
class CWRelation(EntityType): |
0 | 99 |
"""define a non final relation: link a non final relation type from a non |
1451 | 100 |
final entity to a non final entity type. |
0 | 101 |
|
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2459
diff
changeset
|
102 |
used to build the instance schema |
0 | 103 |
""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
104 |
__permissions__ = PUB_SYSTEM_ENTITY_PERMS |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
105 |
relation_type = SubjectRelation('CWRType', cardinality='1*', |
0 | 106 |
constraints=[RQLConstraint('O final FALSE')], |
107 |
composite='object') |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
108 |
from_entity = SubjectRelation('CWEType', cardinality='1*', |
0 | 109 |
constraints=[RQLConstraint('O final FALSE')], |
110 |
composite='object') |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
111 |
to_entity = SubjectRelation('CWEType', cardinality='1*', |
0 | 112 |
constraints=[RQLConstraint('O final FALSE')], |
113 |
composite='object') |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
114 |
constrained_by = SubjectRelation('CWConstraint', cardinality='*1', composite='subject') |
1451 | 115 |
|
0 | 116 |
cardinality = String(maxsize=2, internationalizable=True, |
117 |
vocabulary=CARDINALITY_VOCAB, |
|
118 |
description=_('subject/object cardinality')) |
|
119 |
ordernum = Int(description=_('control subject entity\'s relations order'), |
|
120 |
default=0) |
|
121 |
composite = String(description=_('is the subject/object entity of the relation ' |
|
122 |
'composed of the other ? This implies that when ' |
|
123 |
'the composite is deleted, composants are also ' |
|
124 |
'deleted.'), |
|
125 |
vocabulary=('', _('subject'), _('object')), |
|
126 |
maxsize=8, default=None) |
|
1451 | 127 |
|
2129
fbfab570a276
use RichString
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2127
diff
changeset
|
128 |
description = RichString(internationalizable=True, |
fbfab570a276
use RichString
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2127
diff
changeset
|
129 |
description=_('semantic description of this relation')) |
1451 | 130 |
|
0 | 131 |
|
132 |
# not restricted since it has to be read when checking allowed transitions |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
133 |
class RQLExpression(EntityType): |
4535
71c86a315a9a
update translatable docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4467
diff
changeset
|
134 |
"""define a rql expression used to define permissions""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
135 |
__permissions__ = PUB_SYSTEM_ENTITY_PERMS |
0 | 136 |
exprtype = String(required=True, vocabulary=['ERQLExpression', 'RRQLExpression']) |
137 |
mainvars = String(maxsize=8, |
|
138 |
description=_('name of the main variables which should be ' |
|
139 |
'used in the selection if necessary (comma ' |
|
140 |
'separated)')) |
|
1451 | 141 |
expression = String(required=True, |
0 | 142 |
description=_('restriction part of a rql query. ' |
143 |
'For entity rql expression, X and U are ' |
|
144 |
'predefined respectivly to the current object and to ' |
|
145 |
'the request user. For relation rql expression, ' |
|
146 |
'S, O and U are predefined respectivly to the current ' |
|
147 |
'relation\'subject, object and to ' |
|
148 |
'the request user. ')) |
|
149 |
||
150 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
151 |
class CWConstraint(EntityType): |
0 | 152 |
"""define a schema constraint""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
153 |
__permissions__ = PUB_SYSTEM_ENTITY_PERMS |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
154 |
cstrtype = SubjectRelation('CWConstraintType', cardinality='1*') |
0 | 155 |
value = String(description=_('depends on the constraint type')) |
156 |
||
157 |
||
6208
07b176640a8c
unique_together integration in CW (alf+syt)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
5782
diff
changeset
|
158 |
class CWUniqueTogetherConstraint(EntityType): |
07b176640a8c
unique_together integration in CW (alf+syt)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
5782
diff
changeset
|
159 |
"""defines a sql-level multicolumn unique index""" |
07b176640a8c
unique_together integration in CW (alf+syt)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
5782
diff
changeset
|
160 |
__permissions__ = PUB_SYSTEM_ENTITY_PERMS |
07b176640a8c
unique_together integration in CW (alf+syt)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
5782
diff
changeset
|
161 |
constraint_of = SubjectRelation('CWEType', cardinality='1*', composite='object', |
6209 | 162 |
inlined=True) |
6815
a84190d4e78c
[schema] fix pb with ambiguous relation used within UniqueTogetherConstraint by having CWUniqueTogetherConstraint.relation targeting CWRType instead of CWAttribute/CWRelation. This fixes 3.10.7 migration.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6209
diff
changeset
|
163 |
relations = SubjectRelation('CWRType', cardinality='+*', |
a84190d4e78c
[schema] fix pb with ambiguous relation used within UniqueTogetherConstraint by having CWUniqueTogetherConstraint.relation targeting CWRType instead of CWAttribute/CWRelation. This fixes 3.10.7 migration.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6209
diff
changeset
|
164 |
constraints=[RQLConstraint( |
a84190d4e78c
[schema] fix pb with ambiguous relation used within UniqueTogetherConstraint by having CWUniqueTogetherConstraint.relation targeting CWRType instead of CWAttribute/CWRelation. This fixes 3.10.7 migration.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6209
diff
changeset
|
165 |
'S constraint_of ET, RDEF relation_type O, RDEF from_entity ET, ' |
a84190d4e78c
[schema] fix pb with ambiguous relation used within UniqueTogetherConstraint by having CWUniqueTogetherConstraint.relation targeting CWRType instead of CWAttribute/CWRelation. This fixes 3.10.7 migration.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6209
diff
changeset
|
166 |
'O final TRUE OR (O final FALSE AND O inlined TRUE)')]) |
6208
07b176640a8c
unique_together integration in CW (alf+syt)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
5782
diff
changeset
|
167 |
|
07b176640a8c
unique_together integration in CW (alf+syt)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
5782
diff
changeset
|
168 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
169 |
class CWConstraintType(EntityType): |
0 | 170 |
"""define a schema constraint type""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
171 |
__permissions__ = PUB_SYSTEM_ENTITY_PERMS |
0 | 172 |
name = String(required=True, indexed=True, internationalizable=True, |
173 |
unique=True, maxsize=64) |
|
174 |
||
175 |
||
176 |
# not restricted since it has to be read when checking allowed transitions |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
177 |
class CWGroup(EntityType): |
0 | 178 |
"""define a CubicWeb users group""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
179 |
__permissions__ = PUB_SYSTEM_ENTITY_PERMS |
0 | 180 |
name = String(required=True, indexed=True, internationalizable=True, |
181 |
unique=True, maxsize=64) |
|
182 |
||
1451 | 183 |
|
3392
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
184 |
class CWProperty(EntityType): |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
185 |
"""used for cubicweb configuration. Once a property has been created you |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
186 |
can't change the key. |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
187 |
""" |
4003
b9436fe77c9e
fix bad merge
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
3890
diff
changeset
|
188 |
__permissions__ = { |
3392
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
189 |
'read': ('managers', 'users', 'guests'), |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
190 |
'add': ('managers', 'users',), |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
191 |
'update': ('managers', 'owners',), |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
192 |
'delete': ('managers', 'owners',), |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
193 |
} |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
194 |
# key is a reserved word for mysql |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
195 |
pkey = String(required=True, internationalizable=True, maxsize=256, |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
196 |
description=_('defines what\'s the property is applied for. ' |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
197 |
'You must select this first to be able to set ' |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
198 |
'value')) |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
199 |
value = String(internationalizable=True, maxsize=256) |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
200 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
201 |
class relation_type(RelationType): |
0 | 202 |
"""link a relation definition to its relation type""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
203 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
0 | 204 |
inlined = True |
1451 | 205 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
206 |
class from_entity(RelationType): |
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
207 |
"""link a relation definition to its subject entity type""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
208 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
0 | 209 |
inlined = True |
210 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
211 |
class to_entity(RelationType): |
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
212 |
"""link a relation definition to its object entity type""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
213 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
214 |
inlined = True |
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
215 |
|
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
216 |
class constrained_by(RelationType): |
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
217 |
"""constraints applying on this relation""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
218 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
219 |
|
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
220 |
class cstrtype(RelationType): |
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
221 |
"""constraint factory""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
222 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
223 |
inlined = True |
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
224 |
|
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
225 |
|
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
226 |
class read_permission_cwgroup(RelationDefinition): |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
227 |
"""groups allowed to read entities/relations of this type""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
228 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
229 |
name = 'read_permission' |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
230 |
subject = ('CWEType', 'CWAttribute', 'CWRelation') |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
231 |
object = 'CWGroup' |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
232 |
cardinality = '**' |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
233 |
|
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
234 |
class add_permission_cwgroup(RelationDefinition): |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
235 |
"""groups allowed to add entities/relations of this type""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
236 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
237 |
name = 'add_permission' |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
238 |
subject = ('CWEType', 'CWRelation') |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
239 |
object = 'CWGroup' |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
240 |
cardinality = '**' |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
241 |
|
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
242 |
class delete_permission_cwgroup(RelationDefinition): |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
243 |
"""groups allowed to delete entities/relations of this type""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
244 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
245 |
name = 'delete_permission' |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
246 |
subject = ('CWEType', 'CWRelation') |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
247 |
object = 'CWGroup' |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
248 |
cardinality = '**' |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
249 |
|
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
250 |
class update_permission_cwgroup(RelationDefinition): |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
251 |
"""groups allowed to update entities/relations of this type""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
252 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
253 |
name = 'update_permission' |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
254 |
subject = ('CWEType', 'CWAttribute') |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
255 |
object = 'CWGroup' |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
256 |
cardinality = '**' |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
257 |
|
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
258 |
class read_permission_rqlexpr(RelationDefinition): |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
259 |
"""rql expression allowing to read entities/relations of this type""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
260 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
261 |
name = 'read_permission' |
4570
ede247bbbf62
follow yams api change: attributes permissions are now defined for
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4535
diff
changeset
|
262 |
subject = ('CWEType', 'CWAttribute', 'CWRelation') |
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
263 |
object = 'RQLExpression' |
4570
ede247bbbf62
follow yams api change: attributes permissions are now defined for
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4535
diff
changeset
|
264 |
cardinality = '*?' |
ede247bbbf62
follow yams api change: attributes permissions are now defined for
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4535
diff
changeset
|
265 |
composite = 'subject' |
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
266 |
|
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
267 |
class add_permission_rqlexpr(RelationDefinition): |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
268 |
"""rql expression allowing to add entities/relations of this type""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
269 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
270 |
name = 'add_permission' |
4570
ede247bbbf62
follow yams api change: attributes permissions are now defined for
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4535
diff
changeset
|
271 |
subject = ('CWEType', 'CWRelation') |
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
272 |
object = 'RQLExpression' |
4570
ede247bbbf62
follow yams api change: attributes permissions are now defined for
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4535
diff
changeset
|
273 |
cardinality = '*?' |
ede247bbbf62
follow yams api change: attributes permissions are now defined for
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4535
diff
changeset
|
274 |
composite = 'subject' |
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
275 |
|
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
276 |
class delete_permission_rqlexpr(RelationDefinition): |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
277 |
"""rql expression allowing to delete entities/relations of this type""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
278 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
279 |
name = 'delete_permission' |
4570
ede247bbbf62
follow yams api change: attributes permissions are now defined for
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4535
diff
changeset
|
280 |
subject = ('CWEType', 'CWRelation') |
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
281 |
object = 'RQLExpression' |
4570
ede247bbbf62
follow yams api change: attributes permissions are now defined for
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4535
diff
changeset
|
282 |
cardinality = '*?' |
ede247bbbf62
follow yams api change: attributes permissions are now defined for
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4535
diff
changeset
|
283 |
composite = 'subject' |
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
284 |
|
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
285 |
class update_permission_rqlexpr(RelationDefinition): |
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
286 |
"""rql expression allowing to update entities/relations of this type""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4588
diff
changeset
|
287 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
288 |
name = 'update_permission' |
4570
ede247bbbf62
follow yams api change: attributes permissions are now defined for
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4535
diff
changeset
|
289 |
subject = ('CWEType', 'CWAttribute') |
4588
36b700c00d38
fix *_permissions schema: using the same cardinality/composite properties for cwgroup/rqlexpr leads to important pbs...
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4570
diff
changeset
|
290 |
object = 'RQLExpression' |
4570
ede247bbbf62
follow yams api change: attributes permissions are now defined for
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4535
diff
changeset
|
291 |
cardinality = '*?' |
ede247bbbf62
follow yams api change: attributes permissions are now defined for
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4535
diff
changeset
|
292 |
composite = 'subject' |
0 | 293 |
|
294 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
295 |
class is_(RelationType): |
0 | 296 |
"""core relation indicating the type of an entity |
297 |
""" |
|
298 |
name = 'is' |
|
299 |
# don't explicitly set composite here, this is handled anyway |
|
300 |
#composite = 'object' |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
301 |
__permissions__ = { |
0 | 302 |
'read': ('managers', 'users', 'guests'), |
303 |
'add': (), |
|
304 |
'delete': (), |
|
305 |
} |
|
306 |
cardinality = '1*' |
|
2438
576f4d51f826
[cleanup] fix deprecation warnings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2140
diff
changeset
|
307 |
subject = '*' |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
308 |
object = 'CWEType' |
0 | 309 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
310 |
class is_instance_of(RelationType): |
0 | 311 |
"""core relation indicating the types (including specialized types) |
312 |
of an entity |
|
313 |
""" |
|
314 |
# don't explicitly set composite here, this is handled anyway |
|
315 |
#composite = 'object' |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
316 |
__permissions__ = { |
0 | 317 |
'read': ('managers', 'users', 'guests'), |
318 |
'add': (), |
|
319 |
'delete': (), |
|
320 |
} |
|
321 |
cardinality = '+*' |
|
2438
576f4d51f826
[cleanup] fix deprecation warnings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2140
diff
changeset
|
322 |
subject = '*' |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
323 |
object = 'CWEType' |
0 | 324 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
325 |
class specializes(RelationType): |
0 | 326 |
name = 'specializes' |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
327 |
__permissions__ = { |
0 | 328 |
'read': ('managers', 'users', 'guests'), |
329 |
'add': ('managers',), |
|
330 |
'delete': ('managers',), |
|
331 |
} |
|
332 |
cardinality = '?*' |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
333 |
subject = 'CWEType' |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
334 |
object = 'CWEType' |
4755
13a5d3a7410e
[schema] tweaks meta-relations and schema/workflow entities attributes permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4754
diff
changeset
|
335 |
|
13a5d3a7410e
[schema] tweaks meta-relations and schema/workflow entities attributes permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4754
diff
changeset
|
336 |
def post_build_callback(schema): |
13a5d3a7410e
[schema] tweaks meta-relations and schema/workflow entities attributes permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4754
diff
changeset
|
337 |
"""set attributes permissions for schema/workflow entities""" |
13a5d3a7410e
[schema] tweaks meta-relations and schema/workflow entities attributes permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4754
diff
changeset
|
338 |
from cubicweb.schema import SCHEMA_TYPES, WORKFLOW_TYPES, META_RTYPES |
5179
f08943f22334
[schema] #847739: test and fix bad permission on TrInfo.comment
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4755
diff
changeset
|
339 |
wftypes = WORKFLOW_TYPES - set(('TrInfo',)) |
4755
13a5d3a7410e
[schema] tweaks meta-relations and schema/workflow entities attributes permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4754
diff
changeset
|
340 |
for eschema in schema.entities(): |
5179
f08943f22334
[schema] #847739: test and fix bad permission on TrInfo.comment
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4755
diff
changeset
|
341 |
if eschema in SCHEMA_TYPES or eschema in wftypes: |
4755
13a5d3a7410e
[schema] tweaks meta-relations and schema/workflow entities attributes permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4754
diff
changeset
|
342 |
for rschema in eschema.subject_relations(): |
13a5d3a7410e
[schema] tweaks meta-relations and schema/workflow entities attributes permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4754
diff
changeset
|
343 |
if rschema.final and not rschema in META_RTYPES: |
13a5d3a7410e
[schema] tweaks meta-relations and schema/workflow entities attributes permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4754
diff
changeset
|
344 |
rdef = eschema.rdef(rschema) |
13a5d3a7410e
[schema] tweaks meta-relations and schema/workflow entities attributes permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4754
diff
changeset
|
345 |
rdef.permissions = PUB_SYSTEM_ATTR_PERMS |