1 from cubicweb.schema import format_constraint |
1 from cubicweb.schema import format_constraint |
2 |
2 |
3 class Affaire(WorkflowableEntityType): |
3 class Affaire(WorkflowableEntityType): |
4 permissions = { |
4 permissions = { |
5 'read': ('managers', |
5 'read': ('managers', |
6 ERQLExpression('X owned_by U'), ERQLExpression('X concerne S?, S owned_by U')), |
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')), |
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")')), |
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')), |
9 'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')), |
10 } |
10 } |
11 |
11 |
12 ref = String(fulltextindexed=True, indexed=True, |
12 ref = String(fulltextindexed=True, indexed=True, |
13 constraints=[SizeConstraint(16)]) |
13 constraints=[SizeConstraint(16)]) |
14 sujet = String(fulltextindexed=True, |
14 sujet = String(fulltextindexed=True, |
15 constraints=[SizeConstraint(256)]) |
15 constraints=[SizeConstraint(256)]) |
16 descr_format = String(meta=True, internationalizable=True, |
16 descr_format = String(meta=True, internationalizable=True, |
21 duration = Int() |
21 duration = Int() |
22 invoiced = Int() |
22 invoiced = Int() |
23 |
23 |
24 depends_on = SubjectRelation('Affaire') |
24 depends_on = SubjectRelation('Affaire') |
25 require_permission = SubjectRelation('CWPermission') |
25 require_permission = SubjectRelation('CWPermission') |
26 |
26 |
27 class concerne(RelationType): |
27 class concerne(RelationType): |
28 permissions = { |
28 permissions = { |
29 'read': ('managers', 'users', 'guests'), |
29 'read': ('managers', 'users', 'guests'), |
30 'add': ('managers', RRQLExpression('U has_update_permission S')), |
30 'add': ('managers', RRQLExpression('U has_update_permission S')), |
31 'delete': ('managers', RRQLExpression('O owned_by U')), |
31 'delete': ('managers', RRQLExpression('O owned_by U')), |
32 } |
32 } |
33 |
|
34 |
33 |
|
34 |