server/repository.py
branchtls-sprint
changeset 1138 22f634977c95
parent 1016 26387b836099
child 1263 01152fffd593
equal deleted inserted replaced
1135:00eb43688a57 1138:22f634977c95
   392                not euser.state in euser.AUTHENTICABLE_STATES:
   392                not euser.state in euser.AUTHENTICABLE_STATES:
   393             raise AuthenticationError('user is not in authenticable state')
   393             raise AuthenticationError('user is not in authenticable state')
   394         return euser
   394         return euser
   395 
   395 
   396     def _build_user(self, session, eid):
   396     def _build_user(self, session, eid):
       
   397         """return a EUser entity for user with the given eid"""
   397         cls = self.vreg.etype_class('EUser')
   398         cls = self.vreg.etype_class('EUser')
   398         rql = cls.fetch_rql(session.user, ['X eid %(x)s'])
   399         rql = cls.fetch_rql(session.user, ['X eid %(x)s'])
   399         rset = session.execute(rql, {'x': eid}, 'x')
   400         rset = session.execute(rql, {'x': eid}, 'x')
   400         assert len(rset) == 1, rset
   401         assert len(rset) == 1, rset
   401         euser = rset.get_entity(0, 0)
   402         euser = rset.get_entity(0, 0)
       
   403         # pylint: disable-msg=W0104
   402         # prefetch / cache euser's groups and properties. This is especially
   404         # prefetch / cache euser's groups and properties. This is especially
   403         # useful for internal sessions to avoid security insertions
   405         # useful for internal sessions to avoid security insertions
   404         euser.groups
   406         euser.groups
   405         euser.properties
   407         euser.properties
   406         return euser
   408         return euser