3 declare(strict_types=1);
56 public function getLocks($uri, $returnChildLocks): array
61 $ref_id = $this->webdav_path_resolver->getRefIdForWebDAVPath($uri);
63 $obj_id = $this->webdav_repository_helper->getObjectIdFromRefId(
$ref_id);
66 if (!is_null($lock_on_obj)) {
67 $sabre_locks[] = $lock_on_obj->getAsSabreDavLock($uri);
70 if ($returnChildLocks) {
85 foreach ($this->webdav_repository_helper->getChildrenOfRefId($ref_id) as $child_ref) {
87 $child_obj_id = $this->webdav_repository_helper->getObjectIdFromRefId($child_ref);
88 $child_obj = $this->webdav_object_factory->retrieveDAVObjectByRefID($child_ref);
91 if (!is_null($child_ilias_lock)) {
92 $sabre_locks[] = $child_ilias_lock->getAsSabreDavLock($uri .
'/' . $child_obj->getName());
95 $sabre_locks = $this->
getLocksRecursive($sabre_locks, $child_ref, $uri . $child_obj->getName() .
'/');
107 public function unlock($uri, LockInfo $lockInfo): bool
109 $ilias_lock = $this->wedav_locks_repository->getLockObjectWithTokenFromDB($lockInfo->token);
111 if (!is_null($ilias_lock) && $ilias_lock->getIliasOwner() == $this->
user->getId()) {
112 $this->wedav_locks_repository->removeLockWithTokenFromDB($lockInfo->token);
115 throw new Exception\Forbidden();
124 public function lock($uri, LockInfo $lock_info): bool
127 $ref_id = $this->webdav_path_resolver->getRefIdForWebDAVPath($uri);
129 if (
$ref_id > 0 && $this->webdav_repository_helper->checkAccess(
'write',
$ref_id)) {
130 $obj_id = $this->webdav_repository_helper->getObjectIdFromRefId(
$ref_id);
134 $this->user->getId(),
141 $this->wedav_locks_repository->saveLockToDB($ilias_lock);
144 throw new Exception\Forbidden();
147 if ($e->getCode() == -1) {
158 return $this->wedav_locks_repository->getLockObjectWithObjIdFromDB($obj_id);
ilWebDAVLockUriPathResolver $webdav_path_resolver
ilWebDAVLocksRepository $wedav_locks_repository
ilWebDAVRepositoryHelper $webdav_repository_helper
getLocksRecursive(array $sabre_locks, int $ref_id, string $uri)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilWebDAVObjFactory $webdav_object_factory
lock($uri, LockInfo $lock_info)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getLocks($uri, $returnChildLocks)
unlock($uri, LockInfo $lockInfo)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilWebDAVLocksRepository $wedav_locks_repository, ilWebDAVRepositoryHelper $webdav_repository_helper, ilWebDAVObjFactory $webdav_object_factory, ilWebDAVLockUriPathResolver $webdav_path_resolver, ilObjUser $user)
getLocksOnObjectId(int $obj_id)