server/test/data/schema.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 17 Feb 2010 09:13:00 +0100
branchstable
changeset 4602 fe5aad04f08b
parent 4570 ede247bbbf62
child 4635 44a883148ab4
permissions -rw-r--r--
proper deprecation of TabedPrimaryView
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     1
"""
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     2
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     3
:organization: Logilab
4212
ab6573088b4a update copyright: welcome 2010
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 3981
diff changeset
     4
:copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     5
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     6
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     7
"""
2503
c4bf7ef8b851 explicit imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2459
diff changeset
     8
from yams.buildobjs import (EntityType, RelationType, RelationDefinition,
c4bf7ef8b851 explicit imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2459
diff changeset
     9
                            SubjectRelation, ObjectRelation,
c4bf7ef8b851 explicit imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2459
diff changeset
    10
                            RichString, String, Int, Boolean, Datetime)
c4bf7ef8b851 explicit imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2459
diff changeset
    11
from yams.constraints import SizeConstraint
c4bf7ef8b851 explicit imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2459
diff changeset
    12
from cubicweb.schema import (WorkflowableEntityType, RQLConstraint,
c4bf7ef8b851 explicit imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2459
diff changeset
    13
                             ERQLExpression, RRQLExpression)
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    14
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    15
class Affaire(WorkflowableEntityType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
    16
    __permissions__ = {
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    17
        'read':   ('managers',
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    18
                   ERQLExpression('X owned_by U'), ERQLExpression('X concerne S?, S owned_by U')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    19
        'add':    ('managers', ERQLExpression('X concerne S, S owned_by U')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    20
        'update': ('managers', 'owners', ERQLExpression('X in_state S, S name in ("pitetre", "en cours")')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    21
        'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    22
        }
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    23
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    24
    ref = String(fulltextindexed=True, indexed=True,
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    25
                 constraints=[SizeConstraint(16)])
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    26
    sujet = String(fulltextindexed=True,
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    27
                   constraints=[SizeConstraint(256)])
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: 2455
diff changeset
    28
    descr = RichString(fulltextindexed=True,
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: 2455
diff changeset
    29
                       description=_('more detailed description'))
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    30
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    31
    duration = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    32
    invoiced = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    33
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    34
    depends_on = SubjectRelation('Affaire')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    35
    require_permission = SubjectRelation('CWPermission')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    36
    concerne = SubjectRelation(('Societe', 'Note'))
2923
b97a0f8dd4dc fix test schema and update some tests to work again with wf changes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2920
diff changeset
    37
    todo_by = SubjectRelation('Personne', cardinality='?*')
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    38
    documented_by = SubjectRelation('Card')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    39
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    40
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    41
class Societe(EntityType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
    42
    __permissions__ = {
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    43
        'read': ('managers', 'users', 'guests'),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    44
        'update': ('managers', 'owners', ERQLExpression('U login L, X nom L')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    45
        'delete': ('managers', 'owners', ERQLExpression('U login L, X nom L')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    46
        'add': ('managers', 'users',)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    47
        }
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    48
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    49
    nom  = String(maxsize=64, fulltextindexed=True)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    50
    web  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    51
    type  = String(maxsize=128) # attribute in common with Note
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    52
    tel  = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    53
    fax  = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    54
    rncs = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    55
    ad1  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    56
    ad2  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    57
    ad3  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    58
    cp   = String(maxsize=12)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    59
    ville= String(maxsize=32)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    60
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    61
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    62
class Division(Societe):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    63
    __specializes_schema__ = True
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    64
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    65
class SubDivision(Division):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    66
    __specializes_schema__ = True
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    67
    travaille_subdivision = ObjectRelation('Personne')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    68
2455
5346d9f3d5ec [tests] fixes (including two operations renaming)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2349
diff changeset
    69
from cubicweb.schemas.base import CWUser
5346d9f3d5ec [tests] fixes (including two operations renaming)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2349
diff changeset
    70
CWUser.get_relations('login').next().fulltextindexed = True
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    71
2920
64322aa83a1d start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2608
diff changeset
    72
class Note(WorkflowableEntityType):
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    73
    date = String(maxsize=10)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    74
    type = String(maxsize=6)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    75
    para = String(maxsize=512)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    76
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    77
    migrated_from = SubjectRelation('Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    78
    attachment = SubjectRelation(('File', 'Image'))
2608
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
    79
    inline1 = SubjectRelation('Affaire', inlined=True, cardinality='?*')
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    80
    todo_by = SubjectRelation('CWUser')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    81
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    82
class Personne(EntityType):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    83
    nom    = String(fulltextindexed=True, required=True, maxsize=64)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    84
    prenom = String(fulltextindexed=True, maxsize=64)
3546
f0aecddf367e fix bug when renaming a full text indexed attribute
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2923
diff changeset
    85
    sexe   = String(maxsize=1, default='M', fulltextindexed=True)
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    86
    promo  = String(vocabulary=('bon','pasbon'))
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    87
    titre  = String(fulltextindexed=True, maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    88
    adel   = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    89
    ass    = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    90
    web    = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    91
    tel    = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    92
    fax    = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    93
    datenaiss = Datetime()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    94
    test   = Boolean()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    95
    description = String()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    96
    firstname = String(fulltextindexed=True, maxsize=64)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    97
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    98
    travaille = SubjectRelation('Societe')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    99
    concerne = SubjectRelation('Affaire')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   100
    connait = SubjectRelation('Personne')
2608
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   101
    inline2 = SubjectRelation('Affaire', inlined=True, cardinality='?*')
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   102
    comments = ObjectRelation('Comment')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   103
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   104
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   105
class fiche(RelationType):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   106
    inlined = True
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   107
    subject = 'Personne'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   108
    object = 'Card'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   109
    cardinality = '??'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   110
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   111
class multisource_inlined_rel(RelationType):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   112
    inlined = True
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   113
    cardinality = '?*'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   114
    subject = ('Card', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   115
    object = ('Affaire', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   116
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   117
class ecrit_par(RelationType):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   118
    inlined = True
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   119
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   120
class connait(RelationType):
4467
0e73d299730a fix long-waiting symetric typo: should be spelled symmetric. Add auto database migration on schema deserialization
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
   121
    symmetric = True
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   122
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   123
class concerne(RelationType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
   124
    __permissions__ = {
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   125
        'read':   ('managers', 'users', 'guests'),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   126
        'add':    ('managers', RRQLExpression('U has_update_permission S')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   127
        'delete': ('managers', RRQLExpression('O owned_by U')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   128
        }
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   129
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   130
class travaille(RelationType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
   131
    __permissions__ = {
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   132
        'read':   ('managers', 'users', 'guests'),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   133
        'add':    ('managers', RRQLExpression('U has_update_permission S')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   134
        'delete': ('managers', RRQLExpression('O owned_by U')),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   135
        }
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   136
2455
5346d9f3d5ec [tests] fixes (including two operations renaming)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2349
diff changeset
   137
class para(RelationType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
   138
    __permissions__ = {
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   139
        'read':   ('managers', 'users', 'guests'),
4570
ede247bbbf62 follow yams api change: attributes permissions are now defined for
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
   140
        'update':    ('managers', ERQLExpression('X in_state S, S name "todo"')),
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   141
        }
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   142
2455
5346d9f3d5ec [tests] fixes (including two operations renaming)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2349
diff changeset
   143
class test(RelationType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
   144
    __permissions__ = {'read': ('managers', 'users', 'guests'),
4570
ede247bbbf62 follow yams api change: attributes permissions are now defined for
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
   145
                       'update': ('managers',),
ede247bbbf62 follow yams api change: attributes permissions are now defined for
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4467
diff changeset
   146
                       }
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   147
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   148
class multisource_rel(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   149
    subject = ('Card', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   150
    object = 'Note'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   151
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   152
class multisource_crossed_rel(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   153
    subject = ('Card', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   154
    object = 'Note'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   155
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   156
2608
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   157
class see_also_1(RelationDefinition):
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   158
    name = 'see_also'
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   159
    subject = object = 'Folder'
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   160
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   161
class see_also_2(RelationDefinition):
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   162
    name = 'see_also'
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   163
    subject = ('Bookmark', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   164
    object = ('Bookmark', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   165
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   166
class evaluee(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   167
    subject = ('Personne', 'CWUser', 'Societe')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   168
    object = ('Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   169
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   170
class ecrit_par_1(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   171
    name = 'ecrit_par'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   172
    subject = 'Note'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   173
    object ='Personne'
3981
8029019884af this invalid constraint now fails with new constraints checking
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
   174
    constraints = [RQLConstraint('E concerns P, S version_of P')]
2608
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   175
    cardinality = '?*'
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   176
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   177
class ecrit_par_2(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   178
    name = 'ecrit_par'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   179
    subject = 'Note'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   180
    object ='CWUser'
2608
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   181
    cardinality='?*'
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   182
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   183
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   184
class copain(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   185
    subject = object = 'CWUser'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   186
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   187
class tags(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   188
    subject = 'Tag'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   189
    object = ('CWUser', 'CWGroup', 'State', 'Note', 'Card', 'Affaire')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   190
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   191
class filed_under(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   192
    subject = ('Note', 'Affaire')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   193
    object = 'Folder'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   194
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   195
class require_permission(RelationDefinition):
2608
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   196
    subject = ('Card', 'Note', 'Personne')
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   197
    object = 'CWPermission'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   198
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   199
class require_state(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   200
    subject = 'CWPermission'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   201
    object = 'State'