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 |
175 |
175 |
176 class relation_type(RelationType): |
176 class relation_type(RelationType): |
177 """link a relation definition to its relation type""" |
177 """link a relation definition to its relation type""" |
178 permissions = META_RTYPE_PERMS |
178 __permissions__ = META_RTYPE_PERMS |
179 inlined = True |
179 inlined = True |
180 |
180 |
181 class from_entity(RelationType): |
181 class from_entity(RelationType): |
182 """link a relation definition to its subject entity type""" |
182 """link a relation definition to its subject entity type""" |
183 permissions = META_RTYPE_PERMS |
183 __permissions__ = META_RTYPE_PERMS |
184 inlined = True |
184 inlined = True |
185 |
185 |
186 class to_entity(RelationType): |
186 class to_entity(RelationType): |
187 """link a relation definition to its object entity type""" |
187 """link a relation definition to its object entity type""" |
188 permissions = META_RTYPE_PERMS |
188 __permissions__ = META_RTYPE_PERMS |
189 inlined = True |
189 inlined = True |
190 |
190 |
191 class constrained_by(RelationType): |
191 class constrained_by(RelationType): |
192 """constraints applying on this relation""" |
192 """constraints applying on this relation""" |
193 permissions = META_RTYPE_PERMS |
193 __permissions__ = META_RTYPE_PERMS |
194 |
194 |
195 class cstrtype(RelationType): |
195 class cstrtype(RelationType): |
196 """constraint factory""" |
196 """constraint factory""" |
197 permissions = META_RTYPE_PERMS |
197 __permissions__ = META_RTYPE_PERMS |
198 inlined = True |
198 inlined = True |
199 |
199 |
200 class read_permission(RelationType): |
200 class read_permission(RelationType): |
201 """core relation giving to a group the permission to read an entity or |
201 """core relation giving to a group the permission to read an entity or |
202 relation type |
202 relation type |
203 """ |
203 """ |
204 permissions = META_RTYPE_PERMS |
204 __permissions__ = META_RTYPE_PERMS |
205 |
205 |
206 class add_permission(RelationType): |
206 class add_permission(RelationType): |
207 """core relation giving to a group the permission to add an entity or |
207 """core relation giving to a group the permission to add an entity or |
208 relation type |
208 relation type |
209 """ |
209 """ |
210 permissions = META_RTYPE_PERMS |
210 __permissions__ = META_RTYPE_PERMS |
211 |
211 |
212 class delete_permission(RelationType): |
212 class delete_permission(RelationType): |
213 """core relation giving to a group the permission to delete an entity or |
213 """core relation giving to a group the permission to delete an entity or |
214 relation type |
214 relation type |
215 """ |
215 """ |
216 permissions = META_RTYPE_PERMS |
216 __permissions__ = META_RTYPE_PERMS |
217 |
217 |
218 class update_permission(RelationType): |
218 class update_permission(RelationType): |
219 """core relation giving to a group the permission to update an entity type |
219 """core relation giving to a group the permission to update an entity type |
220 """ |
220 """ |
221 permissions = META_RTYPE_PERMS |
221 __permissions__ = META_RTYPE_PERMS |
222 |
222 |
223 |
223 |
224 class is_(RelationType): |
224 class is_(RelationType): |
225 """core relation indicating the type of an entity |
225 """core relation indicating the type of an entity |
226 """ |
226 """ |
227 name = 'is' |
227 name = 'is' |
228 # don't explicitly set composite here, this is handled anyway |
228 # don't explicitly set composite here, this is handled anyway |
229 #composite = 'object' |
229 #composite = 'object' |
230 permissions = { |
230 __permissions__ = { |
231 'read': ('managers', 'users', 'guests'), |
231 'read': ('managers', 'users', 'guests'), |
232 'add': (), |
232 'add': (), |
233 'delete': (), |
233 'delete': (), |
234 } |
234 } |
235 cardinality = '1*' |
235 cardinality = '1*' |