author | sylvain.thenault@logilab.fr |
Wed, 13 May 2009 17:21:35 +0200 | |
branch | tls-sprint |
changeset 1797 | c2a80130b06d |
parent 1398 | 5fe84a5f7035 |
child 1802 | d628defebc17 |
permissions | -rw-r--r-- |
0 | 1 |
from cubicweb.schema import format_constraint |
2 |
||
629
59b6542f5729
provide a new WorkflowableEntityType base class (will be refactored later, maybe with schema interfaces)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
341
diff
changeset
|
3 |
class Affaire(WorkflowableEntityType): |
0 | 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 |
descr_format = String(meta=True, internationalizable=True, |
|
17 |
default='text/rest', constraints=[format_constraint]) |
|
18 |
descr = String(fulltextindexed=True, |
|
19 |
description=_('more detailed description')) |
|
332
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
0
diff
changeset
|
20 |
|
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
0
diff
changeset
|
21 |
duration = Int() |
86b8d58664eb
backport msplanner test from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
0
diff
changeset
|
22 |
invoiced = Int() |
629
59b6542f5729
provide a new WorkflowableEntityType base class (will be refactored later, maybe with schema interfaces)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
341
diff
changeset
|
23 |
|
0 | 24 |
depends_on = SubjectRelation('Affaire') |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
629
diff
changeset
|
25 |
require_permission = SubjectRelation('CWPermission') |
0 | 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 |