ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilClientNodeDAV Class Reference

Class ilClientNodeDAV. More...

+ Inheritance diagram for ilClientNodeDAV:
+ Collaboration diagram for ilClientNodeDAV:

Public Member Functions

 __construct (string $client_name, ilWebDAVRepositoryHelper $repo_helper, ilWebDAVObjDAVHelper $dav_helper)
 
 setName ($name)
 Overwrite parent function to throw an exception if called. More...
 
 getChildren ()
 Returns Repository Root Object. More...
 
 getName ()
 Return name of client. More...
 
 getLastModified ()
 Returns some date as return for last modified. More...
 
 getChild ($name)
 If the "ILIAS" is given as parameter, the repository root will be returned. More...
 
 childExists ($name)
 Either the given name is the name of the repository root of ILIAS or it is a reference to a node in the ILIAS-repo. More...
 
 getRefIdFromName ($name)
 Gets ref_id from name. More...
 
 createDirectory ($name)
 It is not allowed to create a directory here. More...
 
 delete ()
 It is not allowed to delete anything here. More...
 
 createFile ($name, $data=null)
 It is not allowed (and not even possible) to create a file here. More...
 

Protected Member Functions

 getMountPointByReference ($name)
 Create DAV-Object from ref_id. More...
 
 getRepositoryRootPoint ()
 Creates and returns Repository Root Object. More...
 
 checkIfRefIdIsValid ($ref_id)
 Check if object with ref_id exists and if is DAVable object. More...
 

Protected Attributes

 $repo_helper
 
 $name_of_repository_root
 

Detailed Description

Class ilClientNodeDAV.

This class represents the used ilias client. For example if your clients name is "my_ilias" and you are currently in the directory with the ref_id=123, the path would look like this: ilias.mysite.com/webdav.php/my_ilias/ref_123/

The call would look like this: -> webdav.php <- creates the request handler and initialize ilias -> ilWebDAVRequestHandler <- setup the webdav server -> ilObjMountPointDAV <- This represents the "root" node and is needed for sabreDAV -> ilMountPointDAV <- This class represents the used client (for example here it is my_ilias) -> child of ilContainerDAV

Author
Raphael Heer rapha.nosp@m.el.h.nosp@m.eer@h.nosp@m.slu..nosp@m.ch $Id$

Definition at line 27 of file class.ilClientNodeDAV.php.

Constructor & Destructor Documentation

◆ __construct()

ilClientNodeDAV::__construct ( string  $client_name,
ilWebDAVRepositoryHelper  $repo_helper,
ilWebDAVObjDAVHelper  $dav_helper 
)
Parameters
string$client_name

Definition at line 38 of file class.ilClientNodeDAV.php.

References $DIC, and $repo_helper.

39  {
40  global $DIC;
41 
42  $this->repo_helper = $repo_helper;
43  $this->dav_helper = $dav_helper;
44  $this->client_name = $client_name;
45  $this->name_of_repository_root = 'ILIAS';
46  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ checkIfRefIdIsValid()

ilClientNodeDAV::checkIfRefIdIsValid (   $ref_id)
protected

Check if object with ref_id exists and if is DAVable object.

Parameters
$ref_id
Returns
mixed

Definition at line 192 of file class.ilClientNodeDAV.php.

Referenced by getRefIdFromName().

193  {
194  if ($ref_id > 0 && $this->repo_helper->objectWithRefIdExists($ref_id) && $this->dav_helper->isDAVableObject($ref_id, true, false)) {
195  return $ref_id;
196  }
197  }
+ Here is the caller graph for this function:

◆ childExists()

ilClientNodeDAV::childExists (   $name)

Either the given name is the name of the repository root of ILIAS or it is a reference to a node in the ILIAS-repo.

Returns true if name=name of repository root or if given reference exists and user has read permissions to this reference

Implements Sabre\DAV\ICollection.

Definition at line 156 of file class.ilClientNodeDAV.php.

References $name, and getRefIdFromName().

157  {
158  if ($name == $this->name_of_repository_root) {
159  return true;
160  }
161 
162  $ref_id = $this->getRefIdFromName($name);
163  if ($ref_id > 0) {
164  return $this->repo_helper->objectWithRefIdExists($ref_id) && $this->repo_helper->checkAccess('read', $ref_id);
165  }
166  return false;
167  }
getRefIdFromName($name)
Gets ref_id from name.
+ Here is the call graph for this function:

◆ createDirectory()

ilClientNodeDAV::createDirectory (   $name)

It is not allowed to create a directory here.

Parameters
string$name
Exceptions
Forbidden

Implements Sabre\DAV\ICollection.

Definition at line 205 of file class.ilClientNodeDAV.php.

206  {
207  throw new Forbidden();
208  }

◆ createFile()

ilClientNodeDAV::createFile (   $name,
  $data = null 
)

It is not allowed (and not even possible) to create a file here.

Parameters
string$name
null$data
Returns
null|string|void
Exceptions
Forbidden

Implements Sabre\DAV\ICollection.

Definition at line 228 of file class.ilClientNodeDAV.php.

229  {
230  throw new Forbidden();
231  }

◆ delete()

ilClientNodeDAV::delete ( )

It is not allowed to delete anything here.

Exceptions
Forbidden

Implements Sabre\DAV\INode.

Definition at line 215 of file class.ilClientNodeDAV.php.

216  {
217  throw new Forbidden();
218  }

◆ getChild()

ilClientNodeDAV::getChild (   $name)

If the "ILIAS" is given as parameter, the repository root will be returned.

Such an URL would look like this: https://ilias.de/webdav.php/client/ILIAS/

Otherwise, the given name will be inspected if it is a reference ID of a collection/container. If call is valid and permissions are granted, the collection/container will be returned. Such an URL would look like this: https://ilias.de/webdav.php/client/ref_12345/

Parameters
string$name
Returns
ilObjCategoryDAV|ilObjCourseDAV|ilObjFileDAV|ilObjFolderDAV|ilObjGroupDAV|ilObjRepositoryRootDAV|
Exceptions
BadRequest
Forbidden

Implements Sabre\DAV\ICollection.

Definition at line 103 of file class.ilClientNodeDAV.php.

References $name, getMountPointByReference(), and getRepositoryRootPoint().

104  {
105  if ($name == $this->name_of_repository_root) {
106  return $this->getRepositoryRootPoint();
107  } else {
108  return $this->getMountPointByReference($name);
109  }
110  }
getMountPointByReference($name)
Create DAV-Object from ref_id.
getRepositoryRootPoint()
Creates and returns Repository Root Object.
+ Here is the call graph for this function:

◆ getChildren()

ilClientNodeDAV::getChildren ( )

Returns Repository Root Object.

Array is needed since a list of all children is expected.

Returns
array|[]
Exceptions
Forbidden

Implements Sabre\DAV\ICollection.

Definition at line 65 of file class.ilClientNodeDAV.php.

References getRepositoryRootPoint().

66  {
67  return array($this->getRepositoryRootPoint());
68  }
getRepositoryRootPoint()
Creates and returns Repository Root Object.
+ Here is the call graph for this function:

◆ getLastModified()

ilClientNodeDAV::getLastModified ( )

Returns some date as return for last modified.

Returns
false|int|null

Implements Sabre\DAV\INode.

Definition at line 85 of file class.ilClientNodeDAV.php.

86  {
87  return strtotime('2000-01-01');
88  }

◆ getMountPointByReference()

ilClientNodeDAV::getMountPointByReference (   $name)
protected

Create DAV-Object from ref_id.

Parameters
string$name
Exceptions
Forbidden
BadRequest
Returns
ilObjCategoryDAV|ilObjCourseDAV|ilObjGroupDAV|ilObjFolderDAV|ilObjFileDAV

Definition at line 120 of file class.ilClientNodeDAV.php.

References $name, and getRefIdFromName().

Referenced by getChild().

121  {
122  $ref_id = $this->getRefIdFromName($name);
123 
124  if ($ref_id > 0) {
125  if ($this->repo_helper->checkAccess('read', $ref_id)) {
126  return $this->dav_helper->createDAVObjectForRefId($ref_id);
127  }
128 
129  throw new Forbidden("No read permission for object with reference ID $ref_id ");
130  }
131 
132  throw new BadRequest("Invalid parameter $name");
133  }
getRefIdFromName($name)
Gets ref_id from name.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getName()

ilClientNodeDAV::getName ( )

Return name of client.

Returns
string

Implements Sabre\DAV\INode.

Definition at line 75 of file class.ilClientNodeDAV.php.

76  {
77  return $this->client_name;
78  }

◆ getRefIdFromName()

ilClientNodeDAV::getRefIdFromName (   $name)

Gets ref_id from name.

Name should look like this: ref_<ref_id>

Parameters
string$name
Returns
int

Definition at line 175 of file class.ilClientNodeDAV.php.

References $name, and checkIfRefIdIsValid().

Referenced by childExists(), and getMountPointByReference().

176  {
177  $ref_parts = explode('_', $name);
178  if (count($ref_parts) == 2) {
179  $ref_id = (int) $ref_parts[1];
180  return $this->checkIfRefIdIsValid($ref_id);
181  }
182 
183  return 0;
184  }
checkIfRefIdIsValid($ref_id)
Check if object with ref_id exists and if is DAVable object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRepositoryRootPoint()

ilClientNodeDAV::getRepositoryRootPoint ( )
protected

Creates and returns Repository Root Object.

Returns
ilObjRepositoryRootDAV
Exceptions
Forbidden

Definition at line 140 of file class.ilClientNodeDAV.php.

Referenced by getChild(), and getChildren().

141  {
142  if ($this->repo_helper->checkAccess('read', ROOT_FOLDER_ID)) {
143  return new ilObjRepositoryRootDAV($this->name_of_repository_root, $this->repo_helper, $this->dav_helper);
144  }
145  throw new Forbidden("No read permission for ilias repository root");
146  }
Class ilObjRepositoryRootDAV.
+ Here is the caller graph for this function:

◆ setName()

ilClientNodeDAV::setName (   $name)

Overwrite parent function to throw an exception if called.

It is not forbidden to rename the client over WebDAV

Parameters
string$name
Exceptions
Forbidden

Implements Sabre\DAV\INode.

Definition at line 54 of file class.ilClientNodeDAV.php.

55  {
56  throw new Forbidden("You cant change the client name");
57  }

Field Documentation

◆ $name_of_repository_root

ilClientNodeDAV::$name_of_repository_root
protected

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

◆ $repo_helper

ilClientNodeDAV::$repo_helper
protected

Definition at line 30 of file class.ilClientNodeDAV.php.

Referenced by __construct().


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