diff -r e6ae125d5903 -r 17555e9b9854 entities/authobjs.py --- a/entities/authobjs.py Thu Feb 19 20:19:05 2009 +0100 +++ b/entities/authobjs.py Thu Feb 19 20:21:10 2009 +0100 @@ -1,3 +1,10 @@ +"""entity classes user and group entities + +:organization: Logilab +:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved. +:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr +""" +__docformat__ = "restructuredtext en" from logilab.common.decorators import cached from cubicweb import Unauthorized @@ -26,6 +33,7 @@ 'in_group' : 'primary', ('owned_by', '*', 'object') : ('generated', 'link'), ('created_by','*','object') : ('generated', 'link'), + ('bookmarked_by', '*', 'object'): ('generated', 'create'), } # used by repository to check if the user can log in or not @@ -85,6 +93,13 @@ """ return self.matching_groups(group) == 1 + def is_anonymous(self): + """ checks if user is an anonymous user""" + #FIXME on the web-side anonymous user is detected according + # to config['anonymous-user'], we don't have this info on + # the server side. + return self.groups == frozenset(('guests', )) + def owns(self, eid): if hasattr(self.req, 'unsafe_execute'): # use unsafe_execute on the repository side, in case