1 """ |
|
2 |
|
3 :organization: Logilab |
|
4 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
|
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
|
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
|
7 """ |
|
8 from cubicweb.schema import format_constraint |
|
9 |
|
10 class Affaire(WorkflowableEntityType): |
|
11 permissions = { |
|
12 'read': ('managers', |
|
13 ERQLExpression('X owned_by U'), ERQLExpression('X concerne S?, S owned_by U')), |
|
14 'add': ('managers', ERQLExpression('X concerne S, S owned_by U')), |
|
15 'update': ('managers', 'owners', ERQLExpression('X in_state S, S name in ("pitetre", "en cours")')), |
|
16 'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')), |
|
17 } |
|
18 |
|
19 ref = String(fulltextindexed=True, indexed=True, |
|
20 constraints=[SizeConstraint(16)]) |
|
21 sujet = String(fulltextindexed=True, |
|
22 constraints=[SizeConstraint(256)]) |
|
23 descr_format = String(meta=True, internationalizable=True, |
|
24 default='text/rest', constraints=[format_constraint]) |
|
25 descr = String(fulltextindexed=True, |
|
26 description=_('more detailed description')) |
|
27 |
|
28 duration = Int() |
|
29 invoiced = Int() |
|
30 |
|
31 depends_on = SubjectRelation('Affaire') |
|
32 require_permission = SubjectRelation('CWPermission') |
|
33 |
|
34 class concerne(RelationType): |
|
35 permissions = { |
|
36 'read': ('managers', 'users', 'guests'), |
|
37 'add': ('managers', RRQLExpression('U has_update_permission S')), |
|
38 'delete': ('managers', RRQLExpression('O owned_by U')), |
|
39 } |
|
40 |
|
41 |
|