server/session.py
branch3.5
changeset 3110 757d36162235
parent 3084 096d680c9da2
child 3120 57ceabc6dfbc
--- a/server/session.py	Thu Sep 03 14:08:17 2009 +0200
+++ b/server/session.py	Tue Sep 08 15:30:14 2009 +0200
@@ -78,6 +78,12 @@
     def schema(self):
         return self.repo.schema
 
+    def hijack_user(self, user):
+        """return a fake request/session using specified user"""
+        session = Session(user, self.repo)
+        session._threaddata = self._threaddata
+        return session
+
     def _change_relation(self, cb, fromeid, rtype, toeid):
         if self.is_super_session:
             cb(self, fromeid, rtype, toeid)
@@ -115,6 +121,8 @@
         self._change_relation(self.repo.glob_delete_relation,
                               fromeid, rtype, toeid)
 
+    # relations cache handling #################################################
+
     def update_rel_cache_add(self, subject, rtype, object, symetric=False):
         self._update_entity_rel_cache_add(subject, rtype, 'subject', object)
         if symetric: