15 |
15 |
16 # not restricted since as "is" is handled as other relations, guests need |
16 # not restricted since as "is" is handled as other relations, guests need |
17 # access to this |
17 # access to this |
18 class CWEType(EntityType): |
18 class CWEType(EntityType): |
19 """define an entity type, used to build the instance schema""" |
19 """define an entity type, used to build the instance schema""" |
20 permissions = META_ETYPE_PERMS |
20 __permissions__ = META_ETYPE_PERMS |
21 name = String(required=True, indexed=True, internationalizable=True, |
21 name = String(required=True, indexed=True, internationalizable=True, |
22 unique=True, maxsize=64) |
22 unique=True, maxsize=64) |
23 description = RichString(internationalizable=True, |
23 description = RichString(internationalizable=True, |
24 description=_('semantic description of this entity type')) |
24 description=_('semantic description of this entity type')) |
25 # necessary to filter using RQL |
25 # necessary to filter using RQL |
26 final = Boolean(description=_('automatic')) |
26 final = Boolean(description=_('automatic')) |
27 |
27 |
28 |
28 |
29 class CWRType(EntityType): |
29 class CWRType(EntityType): |
30 """define a relation type, used to build the instance schema""" |
30 """define a relation type, used to build the instance schema""" |
31 permissions = META_ETYPE_PERMS |
31 __permissions__ = META_ETYPE_PERMS |
32 name = String(required=True, indexed=True, internationalizable=True, |
32 name = String(required=True, indexed=True, internationalizable=True, |
33 unique=True, maxsize=64) |
33 unique=True, maxsize=64) |
34 description = RichString(internationalizable=True, |
34 description = RichString(internationalizable=True, |
35 description=_('semantic description of this relation type')) |
35 description=_('semantic description of this relation type')) |
36 symetric = Boolean(description=_('is this relation equivalent in both direction ?')) |
36 symetric = Boolean(description=_('is this relation equivalent in both direction ?')) |
129 'the request user. For relation rql expression, ' |
129 'the request user. For relation rql expression, ' |
130 'S, O and U are predefined respectivly to the current ' |
130 'S, O and U are predefined respectivly to the current ' |
131 'relation\'subject, object and to ' |
131 'relation\'subject, object and to ' |
132 'the request user. ')) |
132 'the request user. ')) |
133 |
133 |
134 read_permission = ObjectRelation(('CWEType', 'CWRType'), cardinality='+?', composite='subject', |
134 read_permission = ObjectRelation(('CWEType', 'CWAttribute', 'CWRelation'), cardinality='+?', composite='subject', |
135 description=_('rql expression allowing to read entities/relations of this type')) |
135 description=_('rql expression allowing to read entities/relations of this type')) |
136 add_permission = ObjectRelation(('CWEType', 'CWRType'), cardinality='*?', composite='subject', |
136 add_permission = ObjectRelation(('CWEType', 'CWAttribute', 'CWRelation'), cardinality='*?', composite='subject', |
137 description=_('rql expression allowing to add entities/relations of this type')) |
137 description=_('rql expression allowing to add entities/relations of this type')) |
138 delete_permission = ObjectRelation(('CWEType', 'CWRType'), cardinality='*?', composite='subject', |
138 delete_permission = ObjectRelation(('CWEType', 'CWAttribute', 'CWRelation'), cardinality='*?', composite='subject', |
139 description=_('rql expression allowing to delete entities/relations of this type')) |
139 description=_('rql expression allowing to delete entities/relations of this type')) |
140 update_permission = ObjectRelation('CWEType', cardinality='*?', composite='subject', |
140 update_permission = ObjectRelation('CWEType', cardinality='*?', composite='subject', |
141 description=_('rql expression allowing to update entities of this type')) |
141 description=_('rql expression allowing to update entities of this type')) |
142 |
142 |
143 |
143 |
144 class CWConstraint(EntityType): |
144 class CWConstraint(EntityType): |
145 """define a schema constraint""" |
145 """define a schema constraint""" |
146 permissions = META_ETYPE_PERMS |
146 __permissions__ = META_ETYPE_PERMS |
147 cstrtype = SubjectRelation('CWConstraintType', cardinality='1*') |
147 cstrtype = SubjectRelation('CWConstraintType', cardinality='1*') |
148 value = String(description=_('depends on the constraint type')) |
148 value = String(description=_('depends on the constraint type')) |
149 |
149 |
150 |
150 |
151 class CWConstraintType(EntityType): |
151 class CWConstraintType(EntityType): |
152 """define a schema constraint type""" |
152 """define a schema constraint type""" |
153 permissions = META_ETYPE_PERMS |
153 __permissions__ = META_ETYPE_PERMS |
154 name = String(required=True, indexed=True, internationalizable=True, |
154 name = String(required=True, indexed=True, internationalizable=True, |
155 unique=True, maxsize=64) |
155 unique=True, maxsize=64) |
156 |
156 |
157 |
157 |
158 # not restricted since it has to be read when checking allowed transitions |
158 # not restricted since it has to be read when checking allowed transitions |
159 class CWGroup(EntityType): |
159 class CWGroup(EntityType): |
160 """define a CubicWeb users group""" |
160 """define a CubicWeb users group""" |
161 permissions = META_ETYPE_PERMS |
161 __permissions__ = META_ETYPE_PERMS |
162 name = String(required=True, indexed=True, internationalizable=True, |
162 name = String(required=True, indexed=True, internationalizable=True, |
163 unique=True, maxsize=64) |
163 unique=True, maxsize=64) |
164 |
164 |
165 read_permission = ObjectRelation(('CWEType', 'CWRType'), cardinality='+*', |
165 read_permission = ObjectRelation(('CWEType', 'CWAttribute', 'CWRelation'), cardinality='+*', |
166 description=_('groups allowed to read entities/relations of this type')) |
166 description=_('groups allowed to read entities/relations of this type')) |
167 add_permission = ObjectRelation(('CWEType', 'CWRType'), |
167 add_permission = ObjectRelation(('CWEType', 'CWAttribute', 'CWRelation'), |
168 description=_('groups allowed to add entities/relations of this type')) |
168 description=_('groups allowed to add entities/relations of this type')) |
169 delete_permission = ObjectRelation(('CWEType', 'CWRType'), |
169 delete_permission = ObjectRelation(('CWEType', 'CWAttribute', 'CWRelation'), |
170 description=_('groups allowed to delete entities/relations of this type')) |
170 description=_('groups allowed to delete entities/relations of this type')) |
171 update_permission = ObjectRelation('CWEType', |
171 update_permission = ObjectRelation('CWEType', |
172 description=_('groups allowed to update entities of this type')) |
172 description=_('groups allowed to update entities of this type')) |
173 |
173 |
174 |
174 |
190 'value')) |
190 'value')) |
191 value = String(internationalizable=True, maxsize=256) |
191 value = String(internationalizable=True, maxsize=256) |
192 |
192 |
193 class relation_type(RelationType): |
193 class relation_type(RelationType): |
194 """link a relation definition to its relation type""" |
194 """link a relation definition to its relation type""" |
195 permissions = META_RTYPE_PERMS |
195 __permissions__ = META_RTYPE_PERMS |
196 inlined = True |
196 inlined = True |
197 |
197 |
198 class from_entity(RelationType): |
198 class from_entity(RelationType): |
199 """link a relation definition to its subject entity type""" |
199 """link a relation definition to its subject entity type""" |
200 permissions = META_RTYPE_PERMS |
200 __permissions__ = META_RTYPE_PERMS |
201 inlined = True |
201 inlined = True |
202 |
202 |
203 class to_entity(RelationType): |
203 class to_entity(RelationType): |
204 """link a relation definition to its object entity type""" |
204 """link a relation definition to its object entity type""" |
205 permissions = META_RTYPE_PERMS |
205 __permissions__ = META_RTYPE_PERMS |
206 inlined = True |
206 inlined = True |
207 |
207 |
208 class constrained_by(RelationType): |
208 class constrained_by(RelationType): |
209 """constraints applying on this relation""" |
209 """constraints applying on this relation""" |
210 permissions = META_RTYPE_PERMS |
210 __permissions__ = META_RTYPE_PERMS |
211 |
211 |
212 class cstrtype(RelationType): |
212 class cstrtype(RelationType): |
213 """constraint factory""" |
213 """constraint factory""" |
214 permissions = META_RTYPE_PERMS |
214 __permissions__ = META_RTYPE_PERMS |
215 inlined = True |
215 inlined = True |
216 |
216 |
217 class read_permission(RelationType): |
217 class read_permission(RelationType): |
218 """core relation giving to a group the permission to read an entity or |
218 """core relation giving to a group the permission to read an entity or |
219 relation type |
219 relation type |
220 """ |
220 """ |
221 permissions = META_RTYPE_PERMS |
221 __permissions__ = META_RTYPE_PERMS |
222 |
222 |
223 class add_permission(RelationType): |
223 class add_permission(RelationType): |
224 """core relation giving to a group the permission to add an entity or |
224 """core relation giving to a group the permission to add an entity or |
225 relation type |
225 relation type |
226 """ |
226 """ |
227 permissions = META_RTYPE_PERMS |
227 __permissions__ = META_RTYPE_PERMS |
228 |
228 |
229 class delete_permission(RelationType): |
229 class delete_permission(RelationType): |
230 """core relation giving to a group the permission to delete an entity or |
230 """core relation giving to a group the permission to delete an entity or |
231 relation type |
231 relation type |
232 """ |
232 """ |
233 permissions = META_RTYPE_PERMS |
233 __permissions__ = META_RTYPE_PERMS |
234 |
234 |
235 class update_permission(RelationType): |
235 class update_permission(RelationType): |
236 """core relation giving to a group the permission to update an entity type |
236 """core relation giving to a group the permission to update an entity type |
237 """ |
237 """ |
238 permissions = META_RTYPE_PERMS |
238 __permissions__ = META_RTYPE_PERMS |
239 |
239 |
240 |
240 |
241 class is_(RelationType): |
241 class is_(RelationType): |
242 """core relation indicating the type of an entity |
242 """core relation indicating the type of an entity |
243 """ |
243 """ |
244 name = 'is' |
244 name = 'is' |
245 # don't explicitly set composite here, this is handled anyway |
245 # don't explicitly set composite here, this is handled anyway |
246 #composite = 'object' |
246 #composite = 'object' |
247 permissions = { |
247 __permissions__ = { |
248 'read': ('managers', 'users', 'guests'), |
248 'read': ('managers', 'users', 'guests'), |
249 'add': (), |
249 'add': (), |
250 'delete': (), |
250 'delete': (), |
251 } |
251 } |
252 cardinality = '1*' |
252 cardinality = '1*' |
257 """core relation indicating the types (including specialized types) |
257 """core relation indicating the types (including specialized types) |
258 of an entity |
258 of an entity |
259 """ |
259 """ |
260 # don't explicitly set composite here, this is handled anyway |
260 # don't explicitly set composite here, this is handled anyway |
261 #composite = 'object' |
261 #composite = 'object' |
262 permissions = { |
262 __permissions__ = { |
263 'read': ('managers', 'users', 'guests'), |
263 'read': ('managers', 'users', 'guests'), |
264 'add': (), |
264 'add': (), |
265 'delete': (), |
265 'delete': (), |
266 } |
266 } |
267 cardinality = '+*' |
267 cardinality = '+*' |
268 subject = '*' |
268 subject = '*' |
269 object = 'CWEType' |
269 object = 'CWEType' |
270 |
270 |
271 class specializes(RelationType): |
271 class specializes(RelationType): |
272 name = 'specializes' |
272 name = 'specializes' |
273 permissions = { |
273 __permissions__ = { |
274 'read': ('managers', 'users', 'guests'), |
274 'read': ('managers', 'users', 'guests'), |
275 'add': ('managers',), |
275 'add': ('managers',), |
276 'delete': ('managers',), |
276 'delete': ('managers',), |
277 } |
277 } |
278 cardinality = '?*' |
278 cardinality = '?*' |