schemas/base.py
branchstable
changeset 7733 432e1f0d4857
parent 7690 015396b6e417
child 7739 12a802ba5311
equal deleted inserted replaced
7732:5430d0db52ab 7733:432e1f0d4857
    44     last_login_time  = Datetime(description=_('last connection date'))
    44     last_login_time  = Datetime(description=_('last connection date'))
    45     # allowing an email to be the primary email of multiple entities is necessary for
    45     # allowing an email to be the primary email of multiple entities is necessary for
    46     # test at least :-/
    46     # test at least :-/
    47     primary_email = SubjectRelation('EmailAddress', cardinality='??',
    47     primary_email = SubjectRelation('EmailAddress', cardinality='??',
    48                                     description=_('email address to use for notification'))
    48                                     description=_('email address to use for notification'))
    49     use_email     = SubjectRelation('EmailAddress', cardinality='*?', composite='subject')
       
    50 
       
    51     in_group = SubjectRelation('CWGroup', cardinality='+*',
    49     in_group = SubjectRelation('CWGroup', cardinality='+*',
    52                                constraints=[RQLConstraint('NOT O name "owners"')],
    50                                constraints=[RQLConstraint('NOT O name "owners"')],
    53                                description=_('groups grant permissions to the user'))
    51                                description=_('groups grant permissions to the user'))
    54 
    52 
    55 
    53 
    69                                     description=_('when multiple addresses are equivalent \
    67                                     description=_('when multiple addresses are equivalent \
    70 (such as python-projects@logilab.org and python-projects@lists.logilab.org), set this \
    68 (such as python-projects@logilab.org and python-projects@lists.logilab.org), set this \
    71 to indicate which is the preferred form.'))
    69 to indicate which is the preferred form.'))
    72 
    70 
    73 class use_email(RelationType):
    71 class use_email(RelationType):
    74     """ """
    72     fulltext_container = 'subject'
       
    73 
       
    74 class use_email_relation(RelationDefinition):
       
    75     """user's email account"""
       
    76     name = "use_email"
    75     __permissions__ = {
    77     __permissions__ = {
    76         'read':   ('managers', 'users', 'guests',),
    78         'read':   ('managers', 'users', 'guests',),
    77         'add':    ('managers', RRQLExpression('U has_update_permission S'),),
    79         'add':    ('managers', RRQLExpression('U has_update_permission S'),),
    78         'delete': ('managers', RRQLExpression('U has_update_permission S'),),
    80         'delete': ('managers', RRQLExpression('U has_update_permission S'),),
    79         }
    81         }
    80     fulltext_container = 'subject'
    82     subject = "CWUser"
       
    83     object = "EmailAddress"
       
    84     cardinality = '*?'
       
    85     composite = 'subject'
    81 
    86 
    82 class primary_email(RelationType):
    87 class primary_email(RelationType):
    83     """the prefered email"""
    88     """the prefered email"""
    84     __permissions__ = use_email.__permissions__
    89     __permissions__ = use_email.__permissions__
    85 
    90