schemas/Bookmark.py
branchreldefsecurity
changeset 3877 7ca53fc72a0a
parent 2297 4cf57dd80650
child 4252 6c4f109c2b03
equal deleted inserted replaced
3876:1169d3154be6 3877:7ca53fc72a0a
    11 from yams.buildobjs import EntityType, RelationType, SubjectRelation, String
    11 from yams.buildobjs import EntityType, RelationType, SubjectRelation, String
    12 from cubicweb.schema import RRQLExpression
    12 from cubicweb.schema import RRQLExpression
    13 
    13 
    14 class Bookmark(EntityType):
    14 class Bookmark(EntityType):
    15     """bookmarks are used to have user's specific internal links"""
    15     """bookmarks are used to have user's specific internal links"""
    16     permissions = {
    16     __permissions__ = {
    17         'read':   ('managers', 'users', 'guests',),
    17         'read':   ('managers', 'users', 'guests',),
    18         'add':    ('managers', 'users',),
    18         'add':    ('managers', 'users',),
    19         'delete': ('managers', 'owners',),
    19         'delete': ('managers', 'owners',),
    20         'update': ('managers', 'owners',),
    20         'update': ('managers', 'owners',),
    21         }
    21         }
    27     bookmarked_by = SubjectRelation('CWUser',
    27     bookmarked_by = SubjectRelation('CWUser',
    28                                     description=_("users using this bookmark"))
    28                                     description=_("users using this bookmark"))
    29 
    29 
    30 
    30 
    31 class bookmarked_by(RelationType):
    31 class bookmarked_by(RelationType):
    32     permissions = {'read':   ('managers', 'users', 'guests',),
    32     __permissions__ = {'read':   ('managers', 'users', 'guests',),
    33                    # test user in users group to avoid granting permission to anonymous user
    33                    # test user in users group to avoid granting permission to anonymous user
    34                    'add':    ('managers', RRQLExpression('O identity U, U in_group G, G name "users"')),
    34                    'add':    ('managers', RRQLExpression('O identity U, U in_group G, G name "users"')),
    35                    'delete': ('managers', RRQLExpression('O identity U, U in_group G, G name "users"')),
    35                    'delete': ('managers', RRQLExpression('O identity U, U in_group G, G name "users"')),
    36                    }
    36                    }