cubicweb/entities/authobjs.py
branch3.25
changeset 12125 1d3a9bb46339
parent 12046 9056a41d91ba
child 12567 26744ad37953
equal deleted inserted replaced
12124:392d6d599286 12125:1d3a9bb46339
    60 
    60 
    61     @property
    61     @property
    62     def groups(self):
    62     def groups(self):
    63         key = user_session_cache_key(self.eid, 'groups')
    63         key = user_session_cache_key(self.eid, 'groups')
    64         try:
    64         try:
    65             return self._cw.data[key]
    65             return self._cw.transaction_data[key]
    66         except KeyError:
    66         except KeyError:
    67             with self._cw.security_enabled(read=False):
    67             with self._cw.security_enabled(read=False):
    68                 groups = set(group for group, in self._cw.execute(
    68                 groups = set(group for group, in self._cw.execute(
    69                     'Any GN WHERE U in_group G, G name GN, U eid %(userid)s',
    69                     'Any GN WHERE U in_group G, G name GN, U eid %(userid)s',
    70                     {'userid': self.eid}))
    70                     {'userid': self.eid}))
    71             self._cw.data[key] = groups
    71             self._cw.transaction_data[key] = groups
    72             return groups
    72             return groups
    73 
    73 
    74     @property
    74     @property
    75     def properties(self):
    75     def properties(self):
    76         key = user_session_cache_key(self.eid, 'properties')
    76         key = user_session_cache_key(self.eid, 'properties')
    77         try:
    77         try:
    78             return self._cw.data[key]
    78             return self._cw.transaction_data[key]
    79         except KeyError:
    79         except KeyError:
    80             with self._cw.security_enabled(read=False):
    80             with self._cw.security_enabled(read=False):
    81                 properties = dict(self._cw.execute(
    81                 properties = dict(self._cw.execute(
    82                     'Any K, V WHERE P for_user U, U eid %(userid)s, '
    82                     'Any K, V WHERE P for_user U, U eid %(userid)s, '
    83                     'P pkey K, P value V', {'userid': self.eid}))
    83                     'P pkey K, P value V', {'userid': self.eid}))
    84             self._cw.data[key] = properties
    84             self._cw.transaction_data[key] = properties
    85             return properties
    85             return properties
    86 
    86 
    87     def prefered_language(self, language=None):
    87     def prefered_language(self, language=None):
    88         """return language used by this user, if explicitly defined (eg not
    88         """return language used by this user, if explicitly defined (eg not
    89         using http negociation)
    89         using http negociation)