entities/authobjs.py
changeset 4252 6c4f109c2b03
parent 3890 d7a270f50f54
parent 4246 c95b8c7e5fb2
child 4436 294e084f1263
--- a/entities/authobjs.py	Mon Jan 18 19:05:08 2010 +0100
+++ b/entities/authobjs.py	Mon Jan 18 19:21:30 2010 +0100
@@ -1,7 +1,7 @@
 """entity classes user and group entities
 
 :organization: Logilab
-:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
+:copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
 """
@@ -21,6 +21,7 @@
         """XXX goa specific"""
         return self.get('name')
 
+
 class CWUser(AnyEntity):
     __regid__ = 'CWUser'
     fetch_attrs, fetch_order = fetch_config(['login', 'firstname', 'surname'])
@@ -77,12 +78,12 @@
             groups = frozenset((groups,))
         elif isinstance(groups, (tuple, list)):
             groups = frozenset(groups)
-        return len(groups & self.groups)
+        return len(groups & self.groups) # XXX return the resulting set instead of its size
 
     def is_in_group(self, group):
         """convience / shortcut method to test if the user belongs to `group`
         """
-        return self.matching_groups(group) == 1
+        return group in self._groups
 
     def is_anonymous(self):
         """ checks if user is an anonymous user"""