server/test/data/schema.py
changeset 9984 793377697c81
parent 9832 17abdb7af3e6
parent 9981 7099bbd685aa
child 10114 6f4b4567b77d
equal deleted inserted replaced
9979:9ccdb3751fbe 9984:793377697c81
     1 # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
    90 class Note(WorkflowableEntityType):
    90 class Note(WorkflowableEntityType):
    91     date = String(maxsize=10)
    91     date = String(maxsize=10)
    92     type = String(maxsize=6)
    92     type = String(maxsize=6)
    93     para = String(maxsize=512,
    93     para = String(maxsize=512,
    94                   __permissions__ = {
    94                   __permissions__ = {
       
    95                       'add': ('managers', ERQLExpression('X in_state S, S name "todo"')),
    95                       'read':   ('managers', 'users', 'guests'),
    96                       'read':   ('managers', 'users', 'guests'),
    96                       'update': ('managers', ERQLExpression('X in_state S, S name "todo"')),
    97                       'update': ('managers', ERQLExpression('X in_state S, S name "todo"')),
    97                       })
    98                       })
    98     something = String(maxsize=1,
    99     something = String(maxsize=1,
    99                       __permissions__ = {
   100                       __permissions__ = {
   106     inline1 = SubjectRelation('Affaire', inlined=True, cardinality='?*',
   107     inline1 = SubjectRelation('Affaire', inlined=True, cardinality='?*',
   107                               constraints=[RQLUniqueConstraint('S type T, S inline1 A1, A1 todo_by C, '
   108                               constraints=[RQLUniqueConstraint('S type T, S inline1 A1, A1 todo_by C, '
   108                                                               'Y type T, Y inline1 A2, A2 todo_by C',
   109                                                               'Y type T, Y inline1 A2, A2 todo_by C',
   109                                                                'S,Y')])
   110                                                                'S,Y')])
   110     todo_by = SubjectRelation('CWUser')
   111     todo_by = SubjectRelation('CWUser')
       
   112 
       
   113 
       
   114 class Frozable(EntityType):
       
   115     __permissions__ = {
       
   116         'read':   ('managers', 'users'),
       
   117         'add':    ('managers', 'users'),
       
   118         'update': ('managers', ERQLExpression('X frozen False'),),
       
   119         'delete': ('managers', ERQLExpression('X frozen False'),)
       
   120     }
       
   121     name = String()
       
   122     frozen = Boolean(default=False,
       
   123                      __permissions__ = {
       
   124                          'read':   ('managers', 'users'),
       
   125                          'add':    ('managers', 'users'),
       
   126                          'update': ('managers', 'owners')
       
   127                          })
       
   128 
   111 
   129 
   112 class Personne(EntityType):
   130 class Personne(EntityType):
   113     __unique_together__ = [('nom', 'prenom', 'inline2')]
   131     __unique_together__ = [('nom', 'prenom', 'inline2')]
   114     nom    = String(fulltextindexed=True, required=True, maxsize=64)
   132     nom    = String(fulltextindexed=True, required=True, maxsize=64)
   115     prenom = String(fulltextindexed=True, maxsize=64)
   133     prenom = String(fulltextindexed=True, maxsize=64)