901 |
901 |
902 The `free_cnxset` will be given to rollback/commit methods to indicate |
902 The `free_cnxset` will be given to rollback/commit methods to indicate |
903 wether the connections set should be freed or not. |
903 wether the connections set should be freed or not. |
904 """ |
904 """ |
905 return transaction(self, free_cnxset) |
905 return transaction(self, free_cnxset) |
906 |
|
907 |
|
908 @deprecated('[3.17] do not use hijack_user. create new Session object') |
|
909 def hijack_user(self, user): |
|
910 """return a fake request/session using specified user""" |
|
911 session = Session(user, self.repo) |
|
912 tx = session._tx |
|
913 tx.cnxset = self.cnxset |
|
914 # share pending_operations, else operation added in the hi-jacked |
|
915 # session such as SendMailOp won't ever be processed |
|
916 tx.pending_operations = self.pending_operations |
|
917 # everything in tx.data should be copied back but the entity |
|
918 # type cache we don't want to avoid security pb |
|
919 tx.data = self._tx.data.copy() |
|
920 tx.data.pop('ecache', None) |
|
921 return session |
|
922 |
906 |
923 def add_relation(self, fromeid, rtype, toeid): |
907 def add_relation(self, fromeid, rtype, toeid): |
924 """provide direct access to the repository method to add a relation. |
908 """provide direct access to the repository method to add a relation. |
925 |
909 |
926 This is equivalent to the following rql query: |
910 This is equivalent to the following rql query: |