author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Tue, 26 Jan 2010 13:36:55 +0100 | |
changeset 4366 | d51f28ba9399 |
parent 4319 | 3b72c7e6149d |
child 4467 | 0e73d299730a |
permissions | -rw-r--r-- |
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2459
diff
changeset
|
1 |
"""core CubicWeb schema necessary for bootstrapping the actual instance's schema |
0 | 2 |
|
3 |
:organization: Logilab |
|
4212
ab6573088b4a
update copyright: welcome 2010
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
4 |
:copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
0 | 5 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1451
diff
changeset
|
6 |
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
0 | 7 |
""" |
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
8 |
__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
|
9 |
_ = unicode |
0 | 10 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
11 |
from yams.buildobjs import (EntityType, RelationType, SubjectRelation, |
2459
d088d0ff48a1
move RichString and co to yams, keeping only a small monkeypatch for cw-page-template here
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2438
diff
changeset
|
12 |
ObjectRelation, RichString, String, Boolean, Int) |
d088d0ff48a1
move RichString and co to yams, keeping only a small monkeypatch for cw-page-template here
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2438
diff
changeset
|
13 |
from cubicweb.schema import RQLConstraint |
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
14 |
from cubicweb.schemas import META_ETYPE_PERMS, META_RTYPE_PERMS |
0 | 15 |
|
16 |
# not restricted since as "is" is handled as other relations, guests need |
|
17 |
# 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
|
18 |
class CWEType(EntityType): |
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2459
diff
changeset
|
19 |
"""define an entity type, used to build the instance schema""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
20 |
__permissions__ = META_ETYPE_PERMS |
0 | 21 |
name = String(required=True, indexed=True, internationalizable=True, |
22 |
unique=True, maxsize=64) |
|
1451 | 23 |
description = RichString(internationalizable=True, |
627
36ade1128af7
use RichString wherever possible in the stdlib
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
24 |
description=_('semantic description of this entity type')) |
0 | 25 |
# necessary to filter using RQL |
26 |
final = Boolean(description=_('automatic')) |
|
27 |
||
28 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
29 |
class CWRType(EntityType): |
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2459
diff
changeset
|
30 |
"""define a relation type, used to build the instance schema""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
31 |
__permissions__ = META_ETYPE_PERMS |
0 | 32 |
name = String(required=True, indexed=True, internationalizable=True, |
33 |
unique=True, maxsize=64) |
|
2129
fbfab570a276
use RichString
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2127
diff
changeset
|
34 |
description = RichString(internationalizable=True, |
fbfab570a276
use RichString
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2127
diff
changeset
|
35 |
description=_('semantic description of this relation type')) |
0 | 36 |
symetric = Boolean(description=_('is this relation equivalent in both direction ?')) |
37 |
inlined = Boolean(description=_('is this relation physically inlined? you should know what you\'re doing if you are changing this!')) |
|
38 |
fulltext_container = String(description=_('if full text content of subject/object entity ' |
|
39 |
'should be added to other side entity (the container).'), |
|
40 |
vocabulary=('', _('subject'), _('object')), |
|
41 |
maxsize=8, default=None) |
|
42 |
final = Boolean(description=_('automatic')) |
|
43 |
||
44 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
45 |
class CWAttribute(EntityType): |
0 | 46 |
"""define a final relation: link a final relation type from a non final |
1451 | 47 |
entity to a final entity type. |
0 | 48 |
|
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2459
diff
changeset
|
49 |
used to build the instance schema |
0 | 50 |
""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
51 |
__permissions__ = META_ETYPE_PERMS |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
52 |
relation_type = SubjectRelation('CWRType', cardinality='1*', |
0 | 53 |
constraints=[RQLConstraint('O final TRUE')], |
54 |
composite='object') |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
55 |
from_entity = SubjectRelation('CWEType', cardinality='1*', |
0 | 56 |
constraints=[RQLConstraint('O final FALSE')], |
57 |
composite='object') |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
58 |
to_entity = SubjectRelation('CWEType', cardinality='1*', |
0 | 59 |
constraints=[RQLConstraint('O final TRUE')], |
60 |
composite='object') |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
61 |
constrained_by = SubjectRelation('CWConstraint', cardinality='*1', composite='subject') |
1451 | 62 |
|
0 | 63 |
cardinality = String(maxsize=2, internationalizable=True, |
1979
daf297034197
remove meaningless cards for attributes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
64 |
vocabulary=[_('?1'), _('11')], |
0 | 65 |
description=_('subject/object cardinality')) |
66 |
ordernum = Int(description=('control subject entity\'s relations order'), default=0) |
|
1451 | 67 |
|
0 | 68 |
indexed = Boolean(description=_('create an index for quick search on this attribute')) |
69 |
fulltextindexed = Boolean(description=_('index this attribute\'s value in the plain text index')) |
|
70 |
internationalizable = Boolean(description=_('is this attribute\'s value translatable')) |
|
71 |
defaultval = String(maxsize=256) |
|
1451 | 72 |
|
2129
fbfab570a276
use RichString
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2127
diff
changeset
|
73 |
description = RichString(internationalizable=True, |
fbfab570a276
use RichString
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2127
diff
changeset
|
74 |
description=_('semantic description of this attribute')) |
1451 | 75 |
|
0 | 76 |
|
1451 | 77 |
CARDINALITY_VOCAB = [_('?*'), _('1*'), _('+*'), _('**'), |
78 |
_('?+'), _('1+'), _('++'), _('*+'), |
|
0 | 79 |
_('?1'), _('11'), _('+1'), _('*1'), |
80 |
_('??'), _('1?'), _('+?'), _('*?')] |
|
81 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
82 |
class CWRelation(EntityType): |
0 | 83 |
"""define a non final relation: link a non final relation type from a non |
1451 | 84 |
final entity to a non final entity type. |
0 | 85 |
|
2476
1294a6bdf3bf
application -> instance where it makes sense
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2459
diff
changeset
|
86 |
used to build the instance schema |
0 | 87 |
""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
88 |
__permissions__ = META_ETYPE_PERMS |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
89 |
relation_type = SubjectRelation('CWRType', cardinality='1*', |
0 | 90 |
constraints=[RQLConstraint('O final FALSE')], |
91 |
composite='object') |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
92 |
from_entity = SubjectRelation('CWEType', cardinality='1*', |
0 | 93 |
constraints=[RQLConstraint('O final FALSE')], |
94 |
composite='object') |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
95 |
to_entity = SubjectRelation('CWEType', cardinality='1*', |
0 | 96 |
constraints=[RQLConstraint('O final FALSE')], |
97 |
composite='object') |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
98 |
constrained_by = SubjectRelation('CWConstraint', cardinality='*1', composite='subject') |
1451 | 99 |
|
0 | 100 |
cardinality = String(maxsize=2, internationalizable=True, |
101 |
vocabulary=CARDINALITY_VOCAB, |
|
102 |
description=_('subject/object cardinality')) |
|
103 |
ordernum = Int(description=_('control subject entity\'s relations order'), |
|
104 |
default=0) |
|
105 |
composite = String(description=_('is the subject/object entity of the relation ' |
|
106 |
'composed of the other ? This implies that when ' |
|
107 |
'the composite is deleted, composants are also ' |
|
108 |
'deleted.'), |
|
109 |
vocabulary=('', _('subject'), _('object')), |
|
110 |
maxsize=8, default=None) |
|
1451 | 111 |
|
2129
fbfab570a276
use RichString
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2127
diff
changeset
|
112 |
description = RichString(internationalizable=True, |
fbfab570a276
use RichString
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2127
diff
changeset
|
113 |
description=_('semantic description of this relation')) |
1451 | 114 |
|
0 | 115 |
|
116 |
# 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
|
117 |
class RQLExpression(EntityType): |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
118 |
"""define a rql expression used to define __permissions__""" |
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
119 |
__permissions__ = META_ETYPE_PERMS |
0 | 120 |
exprtype = String(required=True, vocabulary=['ERQLExpression', 'RRQLExpression']) |
121 |
mainvars = String(maxsize=8, |
|
122 |
description=_('name of the main variables which should be ' |
|
123 |
'used in the selection if necessary (comma ' |
|
124 |
'separated)')) |
|
1451 | 125 |
expression = String(required=True, |
0 | 126 |
description=_('restriction part of a rql query. ' |
127 |
'For entity rql expression, X and U are ' |
|
128 |
'predefined respectivly to the current object and to ' |
|
129 |
'the request user. For relation rql expression, ' |
|
130 |
'S, O and U are predefined respectivly to the current ' |
|
131 |
'relation\'subject, object and to ' |
|
132 |
'the request user. ')) |
|
133 |
||
4319
3b72c7e6149d
fix #636936: read_permission relation should not be mandatory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
134 |
read_permission = ObjectRelation(('CWEType', 'CWAttribute', 'CWRelation'), cardinality='*?', composite='subject', |
0 | 135 |
description=_('rql expression allowing to read entities/relations of this type')) |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
136 |
add_permission = ObjectRelation(('CWEType', 'CWAttribute', 'CWRelation'), cardinality='*?', composite='subject', |
0 | 137 |
description=_('rql expression allowing to add entities/relations of this type')) |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
138 |
delete_permission = ObjectRelation(('CWEType', 'CWAttribute', 'CWRelation'), cardinality='*?', composite='subject', |
0 | 139 |
description=_('rql expression allowing to delete entities/relations of this type')) |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
140 |
update_permission = ObjectRelation('CWEType', cardinality='*?', composite='subject', |
0 | 141 |
description=_('rql expression allowing to update entities of this type')) |
1451 | 142 |
|
0 | 143 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
144 |
class CWConstraint(EntityType): |
0 | 145 |
"""define a schema constraint""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
146 |
__permissions__ = META_ETYPE_PERMS |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
147 |
cstrtype = SubjectRelation('CWConstraintType', cardinality='1*') |
0 | 148 |
value = String(description=_('depends on the constraint type')) |
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 CWConstraintType(EntityType): |
0 | 152 |
"""define a schema constraint type""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
153 |
__permissions__ = META_ETYPE_PERMS |
0 | 154 |
name = String(required=True, indexed=True, internationalizable=True, |
155 |
unique=True, maxsize=64) |
|
156 |
||
157 |
||
158 |
# 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
|
159 |
class CWGroup(EntityType): |
0 | 160 |
"""define a CubicWeb users group""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
161 |
__permissions__ = META_ETYPE_PERMS |
0 | 162 |
name = String(required=True, indexed=True, internationalizable=True, |
163 |
unique=True, maxsize=64) |
|
164 |
||
4319
3b72c7e6149d
fix #636936: read_permission relation should not be mandatory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
165 |
read_permission = ObjectRelation(('CWEType', 'CWAttribute', 'CWRelation'), cardinality='**', |
0 | 166 |
description=_('groups allowed to read entities/relations of this type')) |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
167 |
add_permission = ObjectRelation(('CWEType', 'CWAttribute', 'CWRelation'), |
0 | 168 |
description=_('groups allowed to add entities/relations of this type')) |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
169 |
delete_permission = ObjectRelation(('CWEType', 'CWAttribute', 'CWRelation'), |
0 | 170 |
description=_('groups allowed to delete entities/relations of this type')) |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
171 |
update_permission = ObjectRelation('CWEType', |
0 | 172 |
description=_('groups allowed to update entities of this type')) |
1451 | 173 |
|
174 |
||
175 |
||
3392
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
176 |
class CWProperty(EntityType): |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
177 |
"""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
|
178 |
can't change the key. |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
179 |
""" |
4003
b9436fe77c9e
fix bad merge
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
3890
diff
changeset
|
180 |
__permissions__ = { |
3392
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
181 |
'read': ('managers', 'users', 'guests'), |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
182 |
'add': ('managers', 'users',), |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
183 |
'update': ('managers', 'owners',), |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
184 |
'delete': ('managers', 'owners',), |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
185 |
} |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
186 |
# 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
|
187 |
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
|
188 |
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
|
189 |
'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
|
190 |
'value')) |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2476
diff
changeset
|
191 |
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
|
192 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
193 |
class relation_type(RelationType): |
0 | 194 |
"""link a relation definition to its relation type""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
195 |
__permissions__ = META_RTYPE_PERMS |
0 | 196 |
inlined = True |
1451 | 197 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
198 |
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
|
199 |
"""link a relation definition to its subject entity type""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
200 |
__permissions__ = META_RTYPE_PERMS |
0 | 201 |
inlined = True |
202 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
203 |
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
|
204 |
"""link a relation definition to its object entity type""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
205 |
__permissions__ = META_RTYPE_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
|
206 |
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
|
207 |
|
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
208 |
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
|
209 |
"""constraints applying on this relation""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
210 |
__permissions__ = META_RTYPE_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
|
211 |
|
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
212 |
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
|
213 |
"""constraint factory""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
214 |
__permissions__ = META_RTYPE_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
|
215 |
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
|
216 |
|
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
217 |
class read_permission(RelationType): |
0 | 218 |
"""core relation giving to a group the permission to read an entity or |
219 |
relation type |
|
220 |
""" |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
221 |
__permissions__ = META_RTYPE_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
|
222 |
|
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
223 |
class add_permission(RelationType): |
0 | 224 |
"""core relation giving to a group the permission to add an entity or |
225 |
relation type |
|
226 |
""" |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
227 |
__permissions__ = META_RTYPE_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
|
228 |
|
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
229 |
class delete_permission(RelationType): |
0 | 230 |
"""core relation giving to a group the permission to delete an entity or |
231 |
relation type |
|
232 |
""" |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
233 |
__permissions__ = META_RTYPE_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
|
234 |
|
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
235 |
class update_permission(RelationType): |
0 | 236 |
"""core relation giving to a group the permission to update an entity type |
237 |
""" |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
238 |
__permissions__ = META_RTYPE_PERMS |
0 | 239 |
|
240 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
241 |
class is_(RelationType): |
0 | 242 |
"""core relation indicating the type of an entity |
243 |
""" |
|
244 |
name = 'is' |
|
245 |
# don't explicitly set composite here, this is handled anyway |
|
246 |
#composite = 'object' |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
247 |
__permissions__ = { |
0 | 248 |
'read': ('managers', 'users', 'guests'), |
249 |
'add': (), |
|
250 |
'delete': (), |
|
251 |
} |
|
252 |
cardinality = '1*' |
|
2438
576f4d51f826
[cleanup] fix deprecation warnings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2140
diff
changeset
|
253 |
subject = '*' |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
254 |
object = 'CWEType' |
0 | 255 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
256 |
class is_instance_of(RelationType): |
0 | 257 |
"""core relation indicating the types (including specialized types) |
258 |
of an entity |
|
259 |
""" |
|
260 |
# don't explicitly set composite here, this is handled anyway |
|
261 |
#composite = 'object' |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
262 |
__permissions__ = { |
0 | 263 |
'read': ('managers', 'users', 'guests'), |
264 |
'add': (), |
|
265 |
'delete': (), |
|
266 |
} |
|
267 |
cardinality = '+*' |
|
2438
576f4d51f826
[cleanup] fix deprecation warnings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2140
diff
changeset
|
268 |
subject = '*' |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
269 |
object = 'CWEType' |
0 | 270 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2129
diff
changeset
|
271 |
class specializes(RelationType): |
0 | 272 |
name = 'specializes' |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2476
diff
changeset
|
273 |
__permissions__ = { |
0 | 274 |
'read': ('managers', 'users', 'guests'), |
275 |
'add': ('managers',), |
|
276 |
'delete': ('managers',), |
|
277 |
} |
|
278 |
cardinality = '?*' |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
279 |
subject = 'CWEType' |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
628
diff
changeset
|
280 |
object = 'CWEType' |