schemas/Bookmark.py
changeset 2140 1cba3393ba01
parent 1977 606923dff11b
child 2144 51c84d585456
equal deleted inserted replaced
2129:fbfab570a276 2140:1cba3393ba01
     3 :organization: Logilab
     3 :organization: Logilab
     4 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
     4 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
     5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
     6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
     7 """
     7 """
       
     8 __docformat__ = "restructuredtext en"
       
     9 _ = unicode
     8 
    10 
     9 class Bookmark(MetaUserEntityType):
    11 from yams.buildobjs import EntityType, RelationType, String
       
    12 
       
    13 class Bookmark(EntityType):
    10     """define an entity type, used to build the application schema"""
    14     """define an entity type, used to build the application schema"""
       
    15     permissions = {
       
    16         'read':   ('managers', 'users', 'guests',),
       
    17         'add':    ('managers', 'users',),
       
    18         'delete': ('managers', 'owners',),
       
    19         'update': ('managers', 'owners',),
       
    20         }
    11     title = String(required=True, maxsize=128)
    21     title = String(required=True, maxsize=128)
    12     path  = String(maxsize=512, required=True,
    22     path  = String(maxsize=512, required=True,
    13                    description=_("relative url of the bookmarked page"))
    23                    description=_("relative url of the bookmarked page"))
    14 
    24 
    15     bookmarked_by = SubjectRelation('CWUser',
    25     bookmarked_by = SubjectRelation('CWUser',
    16                                     description=_("users using this bookmark"))
    26                                     description=_("users using this bookmark"))
    17 
    27 
    18 
    28 
    19 class bookmarked_by(MetaUserRelationType):
    29 class bookmarked_by(RelationType):
    20     permissions = {'read':   ('managers', 'users', 'guests',),
    30     permissions = {'read':   ('managers', 'users', 'guests',),
    21                    # test user in users group to avoid granting permission to anonymous user
    31                    # test user in users group to avoid granting permission to anonymous user
    22                    'add':    ('managers', RRQLExpression('O identity U, U in_group G, G name "users"')),
    32                    'add':    ('managers', RRQLExpression('O identity U, U in_group G, G name "users"')),
    23                    'delete': ('managers', RRQLExpression('O identity U, U in_group G, G name "users"')),
    33                    'delete': ('managers', RRQLExpression('O identity U, U in_group G, G name "users"')),
    24                    }
    34                    }