entities/authobjs.py
branchstable
changeset 4246 c95b8c7e5fb2
parent 4212 ab6573088b4a
child 4252 6c4f109c2b03
child 4402 360c532070f5
equal deleted inserted replaced
4245:ff8e355dbc97 4246:c95b8c7e5fb2
    18     fetch_unrelated_order = fetch_order
    18     fetch_unrelated_order = fetch_order
    19 
    19 
    20     def db_key_name(self):
    20     def db_key_name(self):
    21         """XXX goa specific"""
    21         """XXX goa specific"""
    22         return self.get('name')
    22         return self.get('name')
       
    23 
    23 
    24 
    24 class CWUser(AnyEntity):
    25 class CWUser(AnyEntity):
    25     id = 'CWUser'
    26     id = 'CWUser'
    26     fetch_attrs, fetch_order = fetch_config(['login', 'firstname', 'surname'])
    27     fetch_attrs, fetch_order = fetch_config(['login', 'firstname', 'surname'])
    27     fetch_unrelated_order = fetch_order
    28     fetch_unrelated_order = fetch_order
    74         """
    75         """
    75         if isinstance(groups, basestring):
    76         if isinstance(groups, basestring):
    76             groups = frozenset((groups,))
    77             groups = frozenset((groups,))
    77         elif isinstance(groups, (tuple, list)):
    78         elif isinstance(groups, (tuple, list)):
    78             groups = frozenset(groups)
    79             groups = frozenset(groups)
    79         return len(groups & self.groups)
    80         return len(groups & self.groups) # XXX return the resulting set instead of its size
    80 
    81 
    81     def is_in_group(self, group):
    82     def is_in_group(self, group):
    82         """convience / shortcut method to test if the user belongs to `group`
    83         """convience / shortcut method to test if the user belongs to `group`
    83         """
    84         """
    84         return self.matching_groups(group) == 1
    85         return group in self._groups
    85 
    86 
    86     def is_anonymous(self):
    87     def is_anonymous(self):
    87         """ checks if user is an anonymous user"""
    88         """ checks if user is an anonymous user"""
    88         #FIXME on the web-side anonymous user is detected according
    89         #FIXME on the web-side anonymous user is detected according
    89         # to config['anonymous-user'], we don't have this info on
    90         # to config['anonymous-user'], we don't have this info on