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

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. /**
  19. * @var SessionInterface
  20. */
  21. private $inner;
  22. public function __construct(SessionInterface $inner)
  23. {
  24. $this->inner = $inner;
  25. }
  26. public function getRepository()
  27. {
  28. return $this->inner->getRepository();
  29. }
  30. public function getUserID()
  31. {
  32. return $this->inner->getUserID();
  33. }
  34. public function getAttributeNames()
  35. {
  36. return $this->inner->getAttributeNames();
  37. }
  38. public function getAttribute($name)
  39. {
  40. return $this->inner->getAttribute($name);
  41. }
  42. public function getWorkspace()
  43. {
  44. return $this->inner->getWorkspace();
  45. }
  46. public function getRootNode()
  47. {
  48. return $this->inner->getRootNode();
  49. }
  50. public function impersonate(CredentialsInterface $credentials)
  51. {
  52. return $this->inner->impersonate($credentials);
  53. }
  54. public function getNodeByIdentifier($id)
  55. {
  56. return $this->inner->getNodeByIdentifier($id);
  57. }
  58. public function getNodesByIdentifier($ids)
  59. {
  60. return $this->inner->getNodesByIdentifier($ids);
  61. }
  62. public function getItem($absPath)
  63. {
  64. return $this->inner->getItem($absPath);
  65. }
  66. public function getNode($absPath, $depthHint = -1)
  67. {
  68. return $this->inner->getNode($absPath, $depthHint);
  69. }
  70. public function getNodes($absPaths)
  71. {
  72. return $this->inner->getNodes($absPaths);
  73. }
  74. public function getProperty($absPath)
  75. {
  76. return $this->inner->getProperty($absPath);
  77. }
  78. public function getProperties($absPaths)
  79. {
  80. return $this->inner->getProperties($absPaths);
  81. }
  82. public function itemExists($absPath)
  83. {
  84. return $this->inner->itemExists($absPath);
  85. }
  86. public function nodeExists($absPath)
  87. {
  88. return $this->inner->nodeExists($absPath);
  89. }
  90. public function propertyExists($absPath)
  91. {
  92. return $this->inner->propertyExists($absPath);
  93. }
  94. public function move($srcAbsPath, $destAbsPath)
  95. {
  96. $this->inner->move($srcAbsPath, $destAbsPath);
  97. }
  98. public function removeItem($absPath)
  99. {
  100. $this->inner->removeItem($absPath);
  101. }
  102. public function save()
  103. {
  104. $this->inner->save();
  105. }
  106. public function refresh($keepChanges)
  107. {
  108. $this->inner->refresh($keepChanges);
  109. }
  110. public function hasPendingChanges()
  111. {
  112. return $this->inner->hasPendingChanges();
  113. }
  114. public function hasPermission($absPath, $actions)
  115. {
  116. return $this->inner->hasPermission($absPath, $actions);
  117. }
  118. public function checkPermission($absPath, $actions)
  119. {
  120. $this->inner->checkPermission($absPath, $actions);
  121. }
  122. public function hasCapability($methodName, $target, array $arguments)
  123. {
  124. return $this->inner->hasCapability($methodName, $target, $arguments);
  125. }
  126. public function importXML($parentAbsPath, $uri, $uuidBehavior)
  127. {
  128. $this->inner->importXML($parentAbsPath, $uri, $uuidBehavior);
  129. }
  130. public function exportSystemView($absPath, $stream, $skipBinary, $noRecurse)
  131. {
  132. $memoryStream = \fopen('php://memory', 'w+');
  133. $this->inner->exportSystemView($absPath, $memoryStream, $skipBinary, $noRecurse);
  134. \rewind($memoryStream);
  135. $content = \stream_get_contents($memoryStream);
  136. $document = new \DOMDocument();
  137. $document->loadXML($content);
  138. $xpath = new \DOMXPath($document);
  139. $xpath->registerNamespace('sv', 'http://www.jcp.org/jcr/sv/1.0');
  140. 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) {
  141. if ($element->parentNode) {
  142. $element->parentNode->removeChild($element);
  143. }
  144. }
  145. \fwrite($stream, $document->saveXML());
  146. }
  147. public function exportDocumentView($absPath, $stream, $skipBinary, $noRecurse)
  148. {
  149. $this->inner->exportDocumentView($absPath, $stream, $skipBinary, $noRecurse);
  150. }
  151. public function setNamespacePrefix($prefix, $uri)
  152. {
  153. $this->inner->setNamespacePrefix($prefix, $uri);
  154. }
  155. public function getNamespacePrefixes()
  156. {
  157. return $this->inner->getNamespacePrefixes();
  158. }
  159. public function getNamespaceURI($prefix)
  160. {
  161. return $this->inner->getNamespaceURI($prefix);
  162. }
  163. public function getNamespacePrefix($uri)
  164. {
  165. return $this->inner->getNamespacePrefix($uri);
  166. }
  167. public function logout()
  168. {
  169. $this->inner->logout();
  170. }
  171. public function isLive()
  172. {
  173. return $this->inner->isLive();
  174. }
  175. public function getAccessControlManager()
  176. {
  177. return $this->inner->getAccessControlManager();
  178. }
  179. public function getRetentionManager()
  180. {
  181. return $this->inner->getRetentionManager();
  182. }
  183. }