|
1 from cubicweb.schema import format_constraint |
|
2 |
|
3 class Affaire(EntityType): |
|
4 permissions = { |
|
5 'read': ('managers', |
|
6 ERQLExpression('X owned_by U'), ERQLExpression('X concerne S?, S owned_by U')), |
|
7 'add': ('managers', ERQLExpression('X concerne S, S owned_by U')), |
|
8 'update': ('managers', 'owners', ERQLExpression('X in_state S, S name in ("pitetre", "en cours")')), |
|
9 'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')), |
|
10 } |
|
11 |
|
12 ref = String(fulltextindexed=True, indexed=True, |
|
13 constraints=[SizeConstraint(16)]) |
|
14 sujet = String(fulltextindexed=True, |
|
15 constraints=[SizeConstraint(256)]) |
|
16 in_state = SubjectRelation('State', cardinality='1*', |
|
17 constraints=[RQLConstraint('O state_of ET, ET name "Affaire"')], |
|
18 description=_('account state')) |
|
19 descr_format = String(meta=True, internationalizable=True, |
|
20 default='text/rest', constraints=[format_constraint]) |
|
21 descr = String(fulltextindexed=True, |
|
22 description=_('more detailed description')) |
|
23 |
|
24 wf_info_for = ObjectRelation('TrInfo', cardinality='1*', composite='object') |
|
25 depends_on = SubjectRelation('Affaire') |
|
26 |
|
27 class concerne(RelationType): |
|
28 permissions = { |
|
29 'read': ('managers', 'users', 'guests'), |
|
30 'add': ('managers', RRQLExpression('U has_update_permission S')), |
|
31 'delete': ('managers', RRQLExpression('O owned_by U')), |
|
32 } |
|
33 |
|
34 |