You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Hooks.php 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bjoern Schiessle <bjoern@schiessle.org>
  6. * @author Björn Schießle <bjoern@schiessle.org>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. * @author Robin Appelman <robin@icewind.nl>
  10. * @author Roeland Jago Douma <roeland@famdouma.nl>
  11. *
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. namespace OCA\Files_Sharing;
  28. use OC\Files\Filesystem;
  29. use OCP\EventDispatcher\IEventDispatcher;
  30. use Psr\Log\LoggerInterface;
  31. class Hooks {
  32. public static function deleteUser($params) {
  33. $manager = new External\Manager(
  34. \OC::$server->getDatabaseConnection(),
  35. \OC\Files\Filesystem::getMountManager(),
  36. \OC\Files\Filesystem::getLoader(),
  37. \OC::$server->getHTTPClientService(),
  38. \OC::$server->getNotificationManager(),
  39. \OC::$server->query(\OCP\OCS\IDiscoveryService::class),
  40. \OC::$server->getCloudFederationProviderManager(),
  41. \OC::$server->getCloudFederationFactory(),
  42. \OC::$server->getGroupManager(),
  43. \OC::$server->getUserManager(),
  44. $params['uid'],
  45. \OC::$server->query(IEventDispatcher::class),
  46. \OC::$server->get(LoggerInterface::class)
  47. );
  48. $manager->removeUserShares($params['uid']);
  49. }
  50. public static function unshareChildren($params) {
  51. $path = Filesystem::getView()->getAbsolutePath($params['path']);
  52. $view = new \OC\Files\View('/');
  53. // find share mount points within $path and unmount them
  54. $mountManager = \OC\Files\Filesystem::getMountManager();
  55. $mountedShares = $mountManager->findIn($path);
  56. foreach ($mountedShares as $mount) {
  57. if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) {
  58. $mountPoint = $mount->getMountPoint();
  59. $view->unlink($mountPoint);
  60. }
  61. }
  62. }
  63. }