vendor/sulu/sulu/src/Sulu/Bundle/DocumentManagerBundle/Session/Session.php line 76

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of Sulu.
  4. *
  5. * (c) Sulu GmbH
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace Sulu\Bundle\DocumentManagerBundle\Session;
  11. use PHPCR\CredentialsInterface;
  12. use PHPCR\SessionInterface;
  13. /**
  14. * Used to wrap the PHPCR session and add some Sulu specific logic on top of it.
  15. */
  16. class Session implements SessionInterface
  17. {
  18. public function __construct(private SessionInterface $inner)
  19. {
  20. }
  21. public function getRepository()
  22. {
  23. return $this->inner->getRepository();
  24. }
  25. public function getUserID()
  26. {
  27. return $this->inner->getUserID();
  28. }
  29. public function getAttributeNames()
  30. {
  31. return $this->inner->getAttributeNames();
  32. }
  33. public function getAttribute($name)
  34. {
  35. return $this->inner->getAttribute($name);
  36. }
  37. public function getWorkspace()
  38. {
  39. return $this->inner->getWorkspace();
  40. }
  41. public function getRootNode()
  42. {
  43. return $this->inner->getRootNode();
  44. }
  45. public function impersonate(CredentialsInterface $credentials)
  46. {
  47. return $this->inner->impersonate($credentials);
  48. }
  49. public function getNodeByIdentifier($id)
  50. {
  51. return $this->inner->getNodeByIdentifier($id);
  52. }
  53. public function getNodesByIdentifier($ids)
  54. {
  55. return $this->inner->getNodesByIdentifier($ids);
  56. }
  57. public function getItem($absPath)
  58. {
  59. return $this->inner->getItem($absPath);
  60. }
  61. public function getNode($absPath, $depthHint = -1)
  62. {
  63. return $this->inner->getNode($absPath, $depthHint);
  64. }
  65. public function getNodes($absPaths)
  66. {
  67. return $this->inner->getNodes($absPaths);
  68. }
  69. public function getProperty($absPath)
  70. {
  71. return $this->inner->getProperty($absPath);
  72. }
  73. public function getProperties($absPaths)
  74. {
  75. return $this->inner->getProperties($absPaths);
  76. }
  77. public function itemExists($absPath)
  78. {
  79. return $this->inner->itemExists($absPath);
  80. }
  81. public function nodeExists($absPath)
  82. {
  83. return $this->inner->nodeExists($absPath);
  84. }
  85. public function propertyExists($absPath)
  86. {
  87. return $this->inner->propertyExists($absPath);
  88. }
  89. public function move($srcAbsPath, $destAbsPath)
  90. {
  91. $this->inner->move($srcAbsPath, $destAbsPath);
  92. }
  93. public function removeItem($absPath)
  94. {
  95. $this->inner->removeItem($absPath);
  96. }
  97. public function save()
  98. {
  99. $this->inner->save();
  100. }
  101. public function refresh($keepChanges)
  102. {
  103. $this->inner->refresh($keepChanges);
  104. }
  105. public function hasPendingChanges()
  106. {
  107. return $this->inner->hasPendingChanges();
  108. }
  109. public function hasPermission($absPath, $actions)
  110. {
  111. return $this->inner->hasPermission($absPath, $actions);
  112. }
  113. public function checkPermission($absPath, $actions)
  114. {
  115. $this->inner->checkPermission($absPath, $actions);
  116. }
  117. public function hasCapability($methodName, $target, array $arguments)
  118. {
  119. return $this->inner->hasCapability($methodName, $target, $arguments);
  120. }
  121. public function importXML($parentAbsPath, $uri, $uuidBehavior)
  122. {
  123. $this->inner->importXML($parentAbsPath, $uri, $uuidBehavior);
  124. }
  125. public function exportSystemView($absPath, $stream, $skipBinary, $noRecurse)
  126. {
  127. $memoryStream = \fopen('php://memory', 'w+');
  128. $this->inner->exportSystemView($absPath, $memoryStream, $skipBinary, $noRecurse);
  129. \rewind($memoryStream);
  130. $content = \stream_get_contents($memoryStream);
  131. $document = new \DOMDocument();
  132. $document->loadXML($content);
  133. $xpath = new \DOMXPath($document);
  134. $xpath->registerNamespace('sv', 'http://www.jcp.org/jcr/sv/1.0');
  135. foreach ($xpath->query('//sv:property[@sv:name="sulu:versions" or @sv:name="jcr:versionHistory" or @sv:name="jcr:baseVersion" or @sv:name="jcr:predecessors" or @sv:name="jcr:isCheckedOut"]') as $element) {
  136. if ($element->parentNode) {
  137. $element->parentNode->removeChild($element);
  138. }
  139. }
  140. \fwrite($stream, $document->saveXML());
  141. }
  142. public function exportDocumentView($absPath, $stream, $skipBinary, $noRecurse)
  143. {
  144. $this->inner->exportDocumentView($absPath, $stream, $skipBinary, $noRecurse);
  145. }
  146. public function setNamespacePrefix($prefix, $uri)
  147. {
  148. $this->inner->setNamespacePrefix($prefix, $uri);
  149. }
  150. public function getNamespacePrefixes()
  151. {
  152. return $this->inner->getNamespacePrefixes();
  153. }
  154. public function getNamespaceURI($prefix)
  155. {
  156. return $this->inner->getNamespaceURI($prefix);
  157. }
  158. public function getNamespacePrefix($uri)
  159. {
  160. return $this->inner->getNamespacePrefix($uri);
  161. }
  162. public function logout()
  163. {
  164. $this->inner->logout();
  165. }
  166. public function isLive()
  167. {
  168. return $this->inner->isLive();
  169. }
  170. public function getAccessControlManager()
  171. {
  172. return $this->inner->getAccessControlManager();
  173. }
  174. public function getRetentionManager()
  175. {
  176. return $this->inner->getRetentionManager();
  177. }
  178. }