test if anonymous
authorArthur Lutz <arthur.lutz@logilab.fr>
Tue, 10 Feb 2009 17:27:05 +0100
changeset 590 bbf6d47a2e9b
parent 589 e1e100276f59
child 591 9eeb3d0a4463
test if anonymous
entities/authobjs.py
--- a/entities/authobjs.py	Tue Feb 10 17:26:42 2009 +0100
+++ b/entities/authobjs.py	Tue Feb 10 17:27:05 2009 +0100
@@ -85,6 +85,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