schemas/workflow.py
author Katia Saurfelt <katia.saurfelt@logilab.fr>
Mon, 14 Sep 2009 16:24:01 +0200
branchstable
changeset 3211 7918d4a5cdbf
parent 2602 7bfa83772d90
child 2920 64322aa83a1d
permissions -rw-r--r--
[forms] avoid to create superfluous add_new_relation_link in create form
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     1
"""workflow related schemas
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     2
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     3
:organization: Logilab
1977
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1572
diff changeset
     4
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     5
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
1977
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1572
diff changeset
     6
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     7
"""
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
     8
__docformat__ = "restructuredtext en"
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
     9
_ = unicode
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    10
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    11
from yams.buildobjs import (EntityType, RelationType, SubjectRelation,
2459
d088d0ff48a1 move RichString and co to yams, keeping only a small monkeypatch for cw-page-template here
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2234
diff changeset
    12
                            ObjectRelation, RichString, String)
d088d0ff48a1 move RichString and co to yams, keeping only a small monkeypatch for cw-page-template here
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2234
diff changeset
    13
from cubicweb.schema import RQLConstraint
2501
fa86d99c2c3a test and fix wf history security
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2459
diff changeset
    14
from cubicweb.schemas import META_ETYPE_PERMS, META_RTYPE_PERMS, HOOKS_RTYPE_PERMS
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    15
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    16
class State(EntityType):
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    17
    """used to associate simple states to an entity type and/or to define
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    18
    workflows
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    19
    """
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    20
    permissions = META_ETYPE_PERMS
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    21
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    22
    name = String(required=True, indexed=True, internationalizable=True,
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    23
                  maxsize=256)
798
0015b33a7336 fix State's RichString definition: 'default' was used instead of 'default_format'
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 628
diff changeset
    24
    description = RichString(fulltextindexed=True, default_format='text/rest',
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    25
                             description=_('semantic description of this state'))
1572
469787f6ea2b delete-trailing-whitespaces
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    26
1398
5fe84a5f7035 rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents: 798
diff changeset
    27
    state_of = SubjectRelation('CWEType', cardinality='+*',
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    28
                    description=_('entity types which may use this state'),
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    29
                    constraints=[RQLConstraint('O final FALSE')])
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    30
    allowed_transition = SubjectRelation('Transition', cardinality='**',
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    31
                                         constraints=[RQLConstraint('S state_of ET, O transition_of ET')],
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    32
                                         description=_('allowed transitions from this state'))
1572
469787f6ea2b delete-trailing-whitespaces
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    33
1398
5fe84a5f7035 rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents: 798
diff changeset
    34
    initial_state = ObjectRelation('CWEType', cardinality='?*',
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    35
                                   # S initial_state O, O state_of S
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    36
                                   constraints=[RQLConstraint('O state_of S')],
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    37
                                   description=_('initial state for entities of this type'))
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    38
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    39
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    40
class Transition(EntityType):
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    41
    """use to define a transition from one or multiple states to a destination
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    42
    states in workflow's definitions.
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    43
    """
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    44
    permissions = META_ETYPE_PERMS
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    45
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    46
    name = String(required=True, indexed=True, internationalizable=True,
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    47
                  maxsize=256)
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    48
    description = RichString(fulltextindexed=True,
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    49
                         description=_('semantic description of this transition'))
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    50
    condition = SubjectRelation('RQLExpression', cardinality='*?', composite='subject',
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    51
                                description=_('a RQL expression which should return some results, '
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    52
                                              'else the transition won\'t be available. '
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    53
                                              'This query may use X and U variables '
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    54
                                              'that will respectivly represents '
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    55
                                              'the current entity and the current user'))
1572
469787f6ea2b delete-trailing-whitespaces
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    56
1398
5fe84a5f7035 rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents: 798
diff changeset
    57
    require_group = SubjectRelation('CWGroup', cardinality='**',
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    58
                                    description=_('group in which a user should be to be '
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    59
                                                  'allowed to pass this transition'))
1398
5fe84a5f7035 rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents: 798
diff changeset
    60
    transition_of = SubjectRelation('CWEType', cardinality='+*',
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    61
                                    description=_('entity types which may use this transition'),
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    62
                                    constraints=[RQLConstraint('O final FALSE')])
2229
edf20a9ca376 destination_state should be mandatory
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    63
    destination_state = SubjectRelation('State', cardinality='1*',
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    64
                                        constraints=[RQLConstraint('S transition_of ET, O state_of ET')],
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    65
                                        description=_('destination state for this transition'))
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    66
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    67
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    68
class TrInfo(EntityType):
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    69
    permissions = META_ETYPE_PERMS
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    70
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    71
    from_state = SubjectRelation('State', cardinality='?*')
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    72
    to_state = SubjectRelation('State', cardinality='1*')
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    73
    comment = RichString(fulltextindexed=True)
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    74
    # get actor and date time using owned_by and creation_date
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    75
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    76
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    77
class from_state(RelationType):
2501
fa86d99c2c3a test and fix wf history security
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2459
diff changeset
    78
    permissions = HOOKS_RTYPE_PERMS
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    79
    inlined = True
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    80
class to_state(RelationType):
2501
fa86d99c2c3a test and fix wf history security
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2459
diff changeset
    81
    permissions = HOOKS_RTYPE_PERMS
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    82
    inlined = True
2501
fa86d99c2c3a test and fix wf history security
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2459
diff changeset
    83
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    84
class wf_info_for(RelationType):
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    85
    """link a transition information to its object"""
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    86
    permissions = {
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    87
        'read':   ('managers', 'users', 'guests',),# RRQLExpression('U has_read_permission O')),
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    88
        'add':    (), # handled automatically, no one should add one explicitly
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    89
        'delete': ('managers',), # RRQLExpression('U has_delete_permission O')
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    90
        }
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    91
    inlined = True
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    92
    composite = 'object'
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    93
    fulltext_container = composite
1572
469787f6ea2b delete-trailing-whitespaces
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    94
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    95
class state_of(RelationType):
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    96
    """link a state to one or more entity type"""
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    97
    permissions = META_RTYPE_PERMS
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    98
class transition_of(RelationType):
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    99
    """link a transition to one or more entity type"""
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   100
    permissions = META_RTYPE_PERMS
1572
469787f6ea2b delete-trailing-whitespaces
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   101
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   102
class initial_state(RelationType):
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   103
    """indicate which state should be used by default when an entity using
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   104
    states is created
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   105
    """
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   106
    permissions = META_RTYPE_PERMS
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   107
    inlined = True
1572
469787f6ea2b delete-trailing-whitespaces
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   108
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   109
class destination_state(RelationType):
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   110
    """destination state of a transition"""
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   111
    permissions = META_RTYPE_PERMS
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   112
    inlined = True
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   113
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   114
class allowed_transition(RelationType):
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   115
    """allowed transition from this state"""
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   116
    permissions = META_RTYPE_PERMS
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   117
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   118
class in_state(RelationType):
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   119
    """indicate the current state of an entity"""
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   120
    # not inlined intentionnaly since when using ldap sources, user'state
1398
5fe84a5f7035 rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents: 798
diff changeset
   121
    # has to be stored outside the CWUser table
2602
7bfa83772d90 [F schema] set inlined=False to ensure it'is not inlined by accident
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2501
diff changeset
   122
    inlined = False
628
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   123
    # add/delete perms given to managers/users, after what most of the job
3a6f28a1ea21 extract workflow related schema definitions in its own file
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   124
    # is done by workflow enforcment
2140
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   125
    permissions = {
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   126
        'read':   ('managers', 'users', 'guests',),
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   127
        'add':    ('managers', 'users',), # XXX has_update_perm
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   128
        'delete': ('managers', 'users',),
1cba3393ba01 update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
   129
        }
1572
469787f6ea2b delete-trailing-whitespaces
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   130