ILIAS  release_8 Revision v8.24
ilWebDAVLocksBackend Class Reference
+ Inheritance diagram for ilWebDAVLocksBackend:
+ Collaboration diagram for ilWebDAVLocksBackend:

Public Member Functions

 __construct (ilWebDAVLocksRepository $wedav_locks_repository, ilWebDAVRepositoryHelper $webdav_repository_helper, ilWebDAVObjFactory $webdav_object_factory, ilWebDAVLockUriPathResolver $webdav_path_resolver, ilObjUser $user)
 
 getLocks ($uri, $returnChildLocks)
 
 unlock ($uri, LockInfo $lockInfo)
 
 lock ($uri, LockInfo $lock_info)
 
 getLocksOnObjectId (int $obj_id)
 

Protected Member Functions

 getLocksRecursive (array $sabre_locks, int $ref_id, string $uri)
 

Protected Attributes

ilWebDAVLocksRepository $wedav_locks_repository
 
ilWebDAVRepositoryHelper $webdav_repository_helper
 
ilWebDAVObjFactory $webdav_object_factory
 
ilWebDAVLockUriPathResolver $webdav_path_resolver
 
ilObjUser $user
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWebDAVLocksBackend::__construct ( ilWebDAVLocksRepository  $wedav_locks_repository,
ilWebDAVRepositoryHelper  $webdav_repository_helper,
ilWebDAVObjFactory  $webdav_object_factory,
ilWebDAVLockUriPathResolver  $webdav_path_resolver,
ilObjUser  $user 
)

Definition at line 37 of file class.ilWebDAVLocksBackend.php.

43 {
44 $this->wedav_locks_repository = $wedav_locks_repository;
45 $this->webdav_repository_helper = $webdav_repository_helper;
46 $this->webdav_object_factory = $webdav_object_factory;
47 $this->webdav_path_resolver = $webdav_path_resolver;
48 $this->user = $user;
49 }
ilWebDAVLocksRepository $wedav_locks_repository
ilWebDAVLockUriPathResolver $webdav_path_resolver
ilWebDAVObjFactory $webdav_object_factory
ilWebDAVRepositoryHelper $webdav_repository_helper

References $user, $webdav_object_factory, $webdav_path_resolver, $webdav_repository_helper, $wedav_locks_repository, and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ getLocks()

ilWebDAVLocksBackend::getLocks (   $uri,
  $returnChildLocks 
)
Parameters
string$uri
bool$returnChildLocks
Returns
LockInfo[]

Definition at line 56 of file class.ilWebDAVLocksBackend.php.

56 : array
57 {
58 $sabre_locks = [];
59
60 try {
61 $ref_id = $this->webdav_path_resolver->getRefIdForWebDAVPath($uri);
62
63 $obj_id = $this->webdav_repository_helper->getObjectIdFromRefId($ref_id);
64 $lock_on_obj = $this->getLocksOnObjectId($obj_id);
65
66 if (!is_null($lock_on_obj)) {
67 $sabre_locks[] = $lock_on_obj->getAsSabreDavLock($uri);
68 }
69
70 if ($returnChildLocks) {
71 $sabre_locks = $this->getLocksRecursive($sabre_locks, $ref_id, $uri);
72 }
73 } catch (Exception\NotFound $e) {
74 }
75
76 return $sabre_locks;
77 }
getLocksRecursive(array $sabre_locks, int $ref_id, string $uri)
$ref_id
Definition: ltiauth.php:67

References Vendor\Package\$e, $ref_id, getLocksOnObjectId(), and getLocksRecursive().

+ Here is the call graph for this function:

◆ getLocksOnObjectId()

ilWebDAVLocksBackend::getLocksOnObjectId ( int  $obj_id)

Definition at line 155 of file class.ilWebDAVLocksBackend.php.

156 {
157 try {
158 return $this->wedav_locks_repository->getLockObjectWithObjIdFromDB($obj_id);
159 } catch (Exception $e) {
160 }
161 }

References Vendor\Package\$e.

Referenced by getLocks(), and getLocksRecursive().

+ Here is the caller graph for this function:

◆ getLocksRecursive()

ilWebDAVLocksBackend::getLocksRecursive ( array  $sabre_locks,
int  $ref_id,
string  $uri 
)
protected
Parameters
LockInfo[]$sabre_locks
Returns
LockInfo[]

Definition at line 83 of file class.ilWebDAVLocksBackend.php.

83 : array
84 {
85 foreach ($this->webdav_repository_helper->getChildrenOfRefId($ref_id) as $child_ref) {
86 try {
87 $child_obj_id = $this->webdav_repository_helper->getObjectIdFromRefId($child_ref);
88 $child_obj = $this->webdav_object_factory->retrieveDAVObjectByRefID($child_ref);
89
90 $child_ilias_lock = $this->getLocksOnObjectId($child_obj_id);
91 if (!is_null($child_ilias_lock)) {
92 $sabre_locks[] = $child_ilias_lock->getAsSabreDavLock($uri . '/' . $child_obj->getName());
93 }
94
95 $sabre_locks = $this->getLocksRecursive($sabre_locks, $child_ref, $uri . $child_obj->getName() . '/');
96 } catch (ilWebDAVNotDavableException | NotFound | RuntimeException $e) {
97 }
98 }
99
100 return $sabre_locks;
101 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References Vendor\Package\$e, $ref_id, getLocksOnObjectId(), and getLocksRecursive().

Referenced by getLocks(), and getLocksRecursive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lock()

ilWebDAVLocksBackend::lock (   $uri,
LockInfo  $lock_info 
)

See also
\Sabre\DAV\Locks\Backend\BackendInterface::lock()

Definition at line 124 of file class.ilWebDAVLocksBackend.php.

124 : bool
125 {
126 try {
127 $ref_id = $this->webdav_path_resolver->getRefIdForWebDAVPath($uri);
128
129 if ($ref_id > 0 && $this->webdav_repository_helper->checkAccess('write', $ref_id)) {
130 $obj_id = $this->webdav_repository_helper->getObjectIdFromRefId($ref_id);
131 $ilias_lock = new ilWebDAVLockObject(
132 $lock_info->token,
133 $obj_id,
134 $this->user->getId(),
135 $lock_info->owner,
136 time() + 360,
137 $lock_info->depth,
138 'w',
139 $lock_info->scope
140 );
141 $this->wedav_locks_repository->saveLockToDB($ilias_lock);
142 return true;
143 } else {
144 throw new Exception\Forbidden();
145 }
146 } catch (Exception\NotFound $e) {
147 if ($e->getCode() == -1) {
148 return false;
149 } else {
150 throw $e;
151 }
152 }
153 }

References Vendor\Package\$e, and $ref_id.

◆ unlock()

ilWebDAVLocksBackend::unlock (   $uri,
LockInfo  $lockInfo 
)

See also
\Sabre\DAV\Locks\Backend\BackendInterface::unlock()

Definition at line 107 of file class.ilWebDAVLocksBackend.php.

107 : bool
108 {
109 $ilias_lock = $this->wedav_locks_repository->getLockObjectWithTokenFromDB($lockInfo->token);
110
111 if (!is_null($ilias_lock) && $ilias_lock->getIliasOwner() == $this->user->getId()) {
112 $this->wedav_locks_repository->removeLockWithTokenFromDB($lockInfo->token);
113 return true;
114 } else {
115 throw new Exception\Forbidden();
116 }
117 }

Field Documentation

◆ $user

ilObjUser ilWebDAVLocksBackend::$user
protected

Definition at line 35 of file class.ilWebDAVLocksBackend.php.

Referenced by __construct().

◆ $webdav_object_factory

ilWebDAVObjFactory ilWebDAVLocksBackend::$webdav_object_factory
protected

Definition at line 33 of file class.ilWebDAVLocksBackend.php.

Referenced by __construct().

◆ $webdav_path_resolver

ilWebDAVLockUriPathResolver ilWebDAVLocksBackend::$webdav_path_resolver
protected

Definition at line 34 of file class.ilWebDAVLocksBackend.php.

Referenced by __construct().

◆ $webdav_repository_helper

ilWebDAVRepositoryHelper ilWebDAVLocksBackend::$webdav_repository_helper
protected

Definition at line 32 of file class.ilWebDAVLocksBackend.php.

Referenced by __construct().

◆ $wedav_locks_repository

ilWebDAVLocksRepository ilWebDAVLocksBackend::$wedav_locks_repository
protected

Definition at line 31 of file class.ilWebDAVLocksBackend.php.

Referenced by __construct().


The documentation for this class was generated from the following file: