cubicweb/server/test/data/schema.py
author Julien Cristau <julien.cristau@logilab.fr>
Mon, 08 Feb 2016 15:37:52 +0100
changeset 11157 42fa15632493
parent 11057 0b59724cb3f2
permissions -rw-r--r--
[web/test] return the hash of uploaded files in FileUploadTC instead of their contents json must be unicode, which doesn't go well with arbitrary file contents. Compute the file hash instead, as we know the hexdigest is (ascii) text.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9981
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
     1
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     2
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     3
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     4
# This file is part of CubicWeb.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     5
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     6
# CubicWeb is free software: you can redistribute it and/or modify it under the
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     7
# terms of the GNU Lesser General Public License as published by the Free
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     8
# Software Foundation, either version 2.1 of the License, or (at your option)
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
     9
# any later version.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    10
#
5424
8ecbcbff9777 replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5421
diff changeset
    11
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    13
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    14
# details.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    15
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    16
# You should have received a copy of the GNU Lesser General Public License along
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    17
# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    18
10285
d14db30b90d6 [repository] don't attempt to delete computed relation, they have no table in the database. Closes #5162935
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 10114
diff changeset
    19
from yams.buildobjs import (EntityType, RelationType, RelationDefinition, ComputedRelation,
6081
ede33e6400ab [forms] test abs() rql function
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5762
diff changeset
    20
                            SubjectRelation, RichString, String, Int, Float,
7694
bd56a29acaa8 [bfss] Fix update of BFSS attribute to None (close #1875289)
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 7252
diff changeset
    21
                            Boolean, Datetime, TZDatetime, Bytes)
2503
c4bf7ef8b851 explicit imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2459
diff changeset
    22
from yams.constraints import SizeConstraint
6236
9138f23ee263 [repo tests] add test case for RQLUniqueConstraint
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6208
diff changeset
    23
from cubicweb.schema import (WorkflowableEntityType,
9138f23ee263 [repo tests] add test case for RQLUniqueConstraint
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6208
diff changeset
    24
                             RQLConstraint, RQLUniqueConstraint,
9565
fa00fc251d57 [migractions] Better handle removal of RQLConstraint in sync_schema
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8820
diff changeset
    25
                             RQLVocabularyConstraint,
2503
c4bf7ef8b851 explicit imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2459
diff changeset
    26
                             ERQLExpression, RRQLExpression)
10817
7b154e0fa194 Use cubicweb._
Julien Cristau <julien.cristau@logilab.fr>
parents: 10669
diff changeset
    27
from cubicweb import _
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    28
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    29
class Affaire(WorkflowableEntityType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
    30
    __permissions__ = {
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    31
        'read':   ('managers',
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    32
                   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
    33
        '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
    34
        '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
    35
        '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
    36
        }
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    37
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    38
    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
    39
                 constraints=[SizeConstraint(16)])
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    40
    sujet = String(fulltextindexed=True,
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    41
                   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
    42
    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
    43
                       description=_('more detailed description'))
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    44
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    45
    duration = Int()
6081
ede33e6400ab [forms] test abs() rql function
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5762
diff changeset
    46
    invoiced = Float()
7711
458cb2edf63a [repo test] Fix test broken by BFSSTestable
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 7694
diff changeset
    47
    opt_attr = Bytes()
2349
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
    depends_on = SubjectRelation('Affaire')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    50
    require_permission = SubjectRelation('CWPermission')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    51
    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
    52
    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
    53
    documented_by = SubjectRelation('Card')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    54
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    55
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    56
class Societe(EntityType):
8820
dbffb6959564 server/source/native: fix wrong usage of .lstrip that produce garbled error messages (closes #2777641)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8105
diff changeset
    57
    __unique_together__ = [('nom', 'type', 'cp')]
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
    58
    __permissions__ = {
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    59
        'read': ('managers', 'users', 'guests'),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    60
        '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
    61
        '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
    62
        'add': ('managers', 'users',)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    63
        }
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
    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
    66
    web  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    67
    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
    68
    tel  = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    69
    fax  = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    70
    rncs = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    71
    ad1  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    72
    ad2  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    73
    ad3  = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    74
    cp   = String(maxsize=12)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    75
    ville= String(maxsize=32)
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
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    78
class Division(Societe):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    79
    __specializes_schema__ = True
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    80
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    81
class SubDivision(Division):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    82
    __specializes_schema__ = True
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    83
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    84
class travaille_subdivision(RelationDefinition):
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    85
    subject = 'Personne'
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    86
    object = 'SubDivision'
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    87
2455
5346d9f3d5ec [tests] fixes (including two operations renaming)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 2349
diff changeset
    88
from cubicweb.schemas.base import CWUser
10669
155c29e0ed1c [py3k] use next builtin instead of next method
Rémi Cardona <remi.cardona@logilab.fr>
parents: 10646
diff changeset
    89
next(CWUser.get_relations('login')).fulltextindexed = True
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    90
2920
64322aa83a1d start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2608
diff changeset
    91
class Note(WorkflowableEntityType):
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    92
    date = String(maxsize=10)
10446
1e6655cff5ab add IUserFriendlyError adapter for violation of check constraints
Julien Cristau <julien.cristau@logilab.fr>
parents: 10303
diff changeset
    93
    type = String(vocabulary=[u'todo', u'a', u'b', u'T', u'lalala'])
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    94
    para = String(maxsize=512,
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    95
                  __permissions__ = {
9925
aee99876eb10 [test] Add missing attribute 'add' permission in test schema
Julien Cristau <julien.cristau@logilab.fr>
parents: 9600
diff changeset
    96
                      'add': ('managers', ERQLExpression('X in_state S, S name "todo"')),
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    97
                      'read':   ('managers', 'users', 'guests'),
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    98
                      'update': ('managers', ERQLExpression('X in_state S, S name "todo"')),
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
    99
                      })
9395
96dba2efd16d [hooks/security] provide attribute "add" permission
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8820
diff changeset
   100
    something = String(maxsize=1,
96dba2efd16d [hooks/security] provide attribute "add" permission
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8820
diff changeset
   101
                      __permissions__ = {
96dba2efd16d [hooks/security] provide attribute "add" permission
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8820
diff changeset
   102
                          'read': ('managers', 'users', 'guests'),
96dba2efd16d [hooks/security] provide attribute "add" permission
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8820
diff changeset
   103
                          'add': (ERQLExpression('NOT X para NULL'),),
96dba2efd16d [hooks/security] provide attribute "add" permission
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8820
diff changeset
   104
                          'update': ('managers', 'owners')
96dba2efd16d [hooks/security] provide attribute "add" permission
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8820
diff changeset
   105
                      })
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   106
    migrated_from = SubjectRelation('Note')
5575
8a531340c3ef no more Image type w/ cw 3.9
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5426
diff changeset
   107
    attachment = SubjectRelation('File')
6236
9138f23ee263 [repo tests] add test case for RQLUniqueConstraint
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6208
diff changeset
   108
    inline1 = SubjectRelation('Affaire', inlined=True, cardinality='?*',
9138f23ee263 [repo tests] add test case for RQLUniqueConstraint
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6208
diff changeset
   109
                              constraints=[RQLUniqueConstraint('S type T, S inline1 A1, A1 todo_by C, '
9138f23ee263 [repo tests] add test case for RQLUniqueConstraint
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6208
diff changeset
   110
                                                              'Y type T, Y inline1 A2, A2 todo_by C',
9138f23ee263 [repo tests] add test case for RQLUniqueConstraint
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6208
diff changeset
   111
                                                               'S,Y')])
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   112
    todo_by = SubjectRelation('CWUser')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   113
9981
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   114
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   115
class Frozable(EntityType):
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   116
    __permissions__ = {
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   117
        'read':   ('managers', 'users'),
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   118
        'add':    ('managers', 'users'),
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   119
        'update': ('managers', ERQLExpression('X frozen False'),),
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   120
        'delete': ('managers', ERQLExpression('X frozen False'),)
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   121
    }
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   122
    name = String()
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   123
    frozen = Boolean(default=False,
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   124
                     __permissions__ = {
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   125
                         'read':   ('managers', 'users'),
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   126
                         'add':    ('managers', 'users'),
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   127
                         'update': ('managers', 'owners')
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   128
                         })
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   129
7099bbd685aa [hooks/security] allow edition of attributes with permissive permissions
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9925
diff changeset
   130
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   131
class Personne(EntityType):
10584
743ed2b13a6f [syncschema] only add to the `synchronized` set if all possible updates have been done
Aurelien Campeas <aurelien.campeas@pythonian.fr>
parents: 10114
diff changeset
   132
    __permissions__ = {
743ed2b13a6f [syncschema] only add to the `synchronized` set if all possible updates have been done
Aurelien Campeas <aurelien.campeas@pythonian.fr>
parents: 10114
diff changeset
   133
        'read':   ('managers', 'users', 'guests'), # 'guests' will be removed
743ed2b13a6f [syncschema] only add to the `synchronized` set if all possible updates have been done
Aurelien Campeas <aurelien.campeas@pythonian.fr>
parents: 10114
diff changeset
   134
        'add':    ('managers', 'users'),
743ed2b13a6f [syncschema] only add to the `synchronized` set if all possible updates have been done
Aurelien Campeas <aurelien.campeas@pythonian.fr>
parents: 10114
diff changeset
   135
        'update': ('managers', 'owners'),
743ed2b13a6f [syncschema] only add to the `synchronized` set if all possible updates have been done
Aurelien Campeas <aurelien.campeas@pythonian.fr>
parents: 10114
diff changeset
   136
        'delete': ('managers', 'owners')
743ed2b13a6f [syncschema] only add to the `synchronized` set if all possible updates have been done
Aurelien Campeas <aurelien.campeas@pythonian.fr>
parents: 10114
diff changeset
   137
    }
6208
07b176640a8c unique_together integration in CW (alf+syt)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 5762
diff changeset
   138
    __unique_together__ = [('nom', 'prenom', 'inline2')]
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   139
    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
   140
    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
   141
    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
   142
    promo  = String(vocabulary=('bon','pasbon'))
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   143
    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
   144
    adel   = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   145
    ass    = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   146
    web    = String(maxsize=128)
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   147
    tel    = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   148
    fax    = Int()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   149
    datenaiss = Datetime()
7166
dde161937d3e [time zone] support for TZDatetime and TZTime data type
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6279
diff changeset
   150
    tzdatenaiss = TZDatetime()
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   151
    test   = Boolean(__permissions__={
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   152
        'read': ('managers', 'users', 'guests'),
9395
96dba2efd16d [hooks/security] provide attribute "add" permission
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8820
diff changeset
   153
        'add': ('managers',),
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   154
        'update': ('managers',),
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   155
        })
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   156
    description = String()
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   157
    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
   158
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   159
    concerne = SubjectRelation('Affaire')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   160
    connait = SubjectRelation('Personne')
2608
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   161
    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
   162
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   163
8105
7980b36fb1aa [schema sync] Update repo._type_source_cache when renaming an entity (closes #2094470)
Julien Cristau <julien.cristau@logilab.fr>
parents: 7711
diff changeset
   164
class Old(EntityType):
10114
6f4b4567b77d [security] check attributes: dispatch on the "add" action if entity was just created
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9984
diff changeset
   165
    name = String(__permissions__ = {
6f4b4567b77d [security] check attributes: dispatch on the "add" action if entity was just created
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9984
diff changeset
   166
        'read'   : ('managers', 'users', 'guests'),
6f4b4567b77d [security] check attributes: dispatch on the "add" action if entity was just created
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9984
diff changeset
   167
        'add'    : ('managers', 'users', 'guests'),
6f4b4567b77d [security] check attributes: dispatch on the "add" action if entity was just created
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9984
diff changeset
   168
        'update' : ()
6f4b4567b77d [security] check attributes: dispatch on the "add" action if entity was just created
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9984
diff changeset
   169
    })
8105
7980b36fb1aa [schema sync] Update repo._type_source_cache when renaming an entity (closes #2094470)
Julien Cristau <julien.cristau@logilab.fr>
parents: 7711
diff changeset
   170
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   171
10487
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   172
class Email(EntityType):
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   173
    subject = String(fulltextindexed=True)
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   174
    messageid = String(required=True, indexed=True, unique=True)
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   175
    sender = SubjectRelation('EmailAddress', cardinality='?*')
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   176
    recipients = SubjectRelation('EmailAddress')
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   177
    attachment = SubjectRelation('File')
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   178
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   179
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   180
class EmailPart(EntityType):
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   181
    pass
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   182
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   183
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   184
class EmailThread(EntityType):
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   185
    see_also = SubjectRelation('EmailThread')
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   186
49a5c38de1de [server/test] stop using email cube
Julien Cristau <julien.cristau@logilab.fr>
parents: 10446
diff changeset
   187
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   188
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
   189
    symmetric = True
2349
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 concerne(RelationType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
   192
    __permissions__ = {
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   193
        'read':   ('managers', 'users', 'guests'),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   194
        '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
   195
        '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
   196
        }
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   197
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   198
class travaille(RelationDefinition):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3546
diff changeset
   199
    __permissions__ = {
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   200
        'read':   ('managers', 'users', 'guests'),
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   201
        '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
   202
        '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
   203
        }
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   204
    subject = 'Personne'
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   205
    object = 'Societe'
9565
fa00fc251d57 [migractions] Better handle removal of RQLConstraint in sync_schema
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8820
diff changeset
   206
    constraints = [RQLVocabularyConstraint('S owned_by U'),
fa00fc251d57 [migractions] Better handle removal of RQLConstraint in sync_schema
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8820
diff changeset
   207
                   RQLVocabularyConstraint('S created_by U')]
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   208
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   209
class comments(RelationDefinition):
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   210
    subject = 'Comment'
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   211
    object = 'Personne'
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   212
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   213
class fiche(RelationDefinition):
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   214
    inlined = True
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   215
    subject = 'Personne'
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   216
    object = 'Card'
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   217
    cardinality = '??'
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   218
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   219
class multisource_inlined_rel(RelationDefinition):
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   220
    inlined = True
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   221
    cardinality = '?*'
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   222
    subject = ('Card', 'Note')
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   223
    object = ('Affaire', 'Note')
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   224
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   225
2608
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   226
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
   227
    name = 'see_also'
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   228
    subject = object = 'Folder'
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   229
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   230
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
   231
    name = 'see_also'
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   232
    subject = ('Bookmark', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   233
    object = ('Bookmark', 'Note')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   234
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   235
class evaluee(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   236
    subject = ('Personne', 'CWUser', 'Societe')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   237
    object = ('Note')
9565
fa00fc251d57 [migractions] Better handle removal of RQLConstraint in sync_schema
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8820
diff changeset
   238
    constraints = [
fa00fc251d57 [migractions] Better handle removal of RQLConstraint in sync_schema
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8820
diff changeset
   239
        RQLVocabularyConstraint('S created_by U'),
fa00fc251d57 [migractions] Better handle removal of RQLConstraint in sync_schema
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8820
diff changeset
   240
        RQLVocabularyConstraint('S owned_by U'),
fa00fc251d57 [migractions] Better handle removal of RQLConstraint in sync_schema
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 8820
diff changeset
   241
    ]
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   242
5386
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   243
class ecrit_par(RelationType):
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   244
    inlined = True
4c92202ab130 [test] stop using ObjectRelation in schema
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4635
diff changeset
   245
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   246
class ecrit_par_1(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   247
    name = 'ecrit_par'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   248
    subject = 'Note'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   249
    object ='Personne'
2608
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   250
    cardinality = '?*'
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   251
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   252
class ecrit_par_2(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   253
    name = 'ecrit_par'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   254
    subject = 'Note'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   255
    object ='CWUser'
2608
21856eda34f6 [F repo tests] tests have to be updated:
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2503
diff changeset
   256
    cardinality='?*'
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   257
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   258
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   259
class copain(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   260
    subject = object = 'CWUser'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   261
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   262
class tags(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   263
    subject = 'Tag'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   264
    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
   265
10303
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   266
class Folder(EntityType):
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   267
    """folders are used to classify entities. They may be defined as a tree.
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   268
    """
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   269
    name = String(required=True, indexed=True, internationalizable=True,
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   270
                  maxsize=64)
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   271
    description = RichString(fulltextindexed=True)
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   272
    filed_under = SubjectRelation('Folder', description=_('parent folder'))
593e63a68429 [server/test] Drop dependency on folder cube
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 10285
diff changeset
   273
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   274
class filed_under(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   275
    subject = ('Note', 'Affaire')
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   276
    object = 'Folder'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   277
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   278
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
   279
    subject = ('Card', 'Note', 'Personne')
2349
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   280
    object = 'CWPermission'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   281
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   282
class require_state(RelationDefinition):
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   283
    subject = 'CWPermission'
b9e2c1b7b873 rewrite test schema using a single schema file
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   284
    object = 'State'
7236
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   285
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   286
class personne_composite(RelationDefinition):
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   287
    subject='Personne'
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   288
    object='Personne'
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   289
    composite='subject'
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   290
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   291
class personne_inlined(RelationDefinition):
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   292
    subject='Personne'
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   293
    object='Personne'
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   294
    cardinality='?*'
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   295
    inlined=True
b91205ada414 added test case to monitor speed improvements in the repository code.
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7166
diff changeset
   296
7238
576abb8c4626 fix implementation of repository.glob_add_relations (closes ##1625257)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7236
diff changeset
   297
576abb8c4626 fix implementation of repository.glob_add_relations (closes ##1625257)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7236
diff changeset
   298
class login_user(RelationDefinition):
576abb8c4626 fix implementation of repository.glob_add_relations (closes ##1625257)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7236
diff changeset
   299
    subject = 'Personne'
576abb8c4626 fix implementation of repository.glob_add_relations (closes ##1625257)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7236
diff changeset
   300
    object = 'CWUser'
576abb8c4626 fix implementation of repository.glob_add_relations (closes ##1625257)
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7236
diff changeset
   301
    cardinality = '??'
7252
adb1673efa5f [sql generation] fix crash on outer join + ambiguous inlined relation + attribute selection
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7238
diff changeset
   302
adb1673efa5f [sql generation] fix crash on outer join + ambiguous inlined relation + attribute selection
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7238
diff changeset
   303
class ambiguous_inlined(RelationDefinition):
adb1673efa5f [sql generation] fix crash on outer join + ambiguous inlined relation + attribute selection
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7238
diff changeset
   304
    subject = ('Affaire', 'Note')
adb1673efa5f [sql generation] fix crash on outer join + ambiguous inlined relation + attribute selection
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7238
diff changeset
   305
    object = 'CWUser'
adb1673efa5f [sql generation] fix crash on outer join + ambiguous inlined relation + attribute selection
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7238
diff changeset
   306
    inlined = True
adb1673efa5f [sql generation] fix crash on outer join + ambiguous inlined relation + attribute selection
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7238
diff changeset
   307
    cardinality = '?*'
10285
d14db30b90d6 [repository] don't attempt to delete computed relation, they have no table in the database. Closes #5162935
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 10114
diff changeset
   308
d14db30b90d6 [repository] don't attempt to delete computed relation, they have no table in the database. Closes #5162935
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 10114
diff changeset
   309
d14db30b90d6 [repository] don't attempt to delete computed relation, they have no table in the database. Closes #5162935
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 10114
diff changeset
   310
class user_login(ComputedRelation):
d14db30b90d6 [repository] don't attempt to delete computed relation, they have no table in the database. Closes #5162935
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 10114
diff changeset
   311
    rule = 'O login_user S'