ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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
 
 $dav_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 41 of file class.ilClientNodeDAV.php.

References $dav_helper, $DIC, and $repo_helper.

42  {
43  global $DIC;
44 
45  $this->repo_helper = $repo_helper;
46  $this->dav_helper = $dav_helper;
47  $this->client_name = $client_name;
48  $this->name_of_repository_root = 'ILIAS';
49  }
$DIC
Definition: xapitoken.php:46

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 195 of file class.ilClientNodeDAV.php.

Referenced by getRefIdFromName().

196  {
197  if ($ref_id > 0
198  && $this->repo_helper->objectWithRefIdExists($ref_id)
199  && $this->dav_helper->isDAVableObject($ref_id, true, false)) {
200  return $ref_id;
201  }
202  }
+ 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

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

References $name, and getRefIdFromName().

160  {
161  if ($name == $this->name_of_repository_root) {
162  return true;
163  }
164 
165  $ref_id = $this->getRefIdFromName($name);
166  if ($ref_id > 0) {
167  return $this->repo_helper->objectWithRefIdExists($ref_id) && $this->repo_helper->checkAccess('read', $ref_id);
168  }
169  return false;
170  }
if($format !==null) $name
Definition: metadata.php:230
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

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

211  {
212  throw new Forbidden();
213  }

◆ 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

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

234  {
235  throw new Forbidden();
236  }

◆ delete()

ilClientNodeDAV::delete ( )

It is not allowed to delete anything here.

Exceptions
Forbidden

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

221  {
222  throw new Forbidden();
223  }

◆ 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

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

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

107  {
108  if ($name == $this->name_of_repository_root) {
109  return $this->getRepositoryRootPoint();
110  } else {
111  return $this->getMountPointByReference($name);
112  }
113  }
getMountPointByReference($name)
Create DAV-Object from ref_id.
if($format !==null) $name
Definition: metadata.php:230
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

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

References getRepositoryRootPoint().

69  {
70  return array($this->getRepositoryRootPoint());
71  }
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

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

89  {
90  return strtotime('2000-01-01');
91  }

◆ 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 123 of file class.ilClientNodeDAV.php.

References $name, and getRefIdFromName().

Referenced by getChild().

124  {
125  $ref_id = $this->getRefIdFromName($name);
126 
127  if ($ref_id > 0) {
128  if ($this->repo_helper->checkAccess('read', $ref_id)) {
129  return $this->dav_helper->createDAVObjectForRefId($ref_id);
130  }
131 
132  throw new Forbidden("No read permission for object with reference ID $ref_id ");
133  }
134 
135  throw new BadRequest("Invalid parameter $name");
136  }
if($format !==null) $name
Definition: metadata.php:230
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

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

79  {
80  return $this->client_name;
81  }

◆ 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 178 of file class.ilClientNodeDAV.php.

References $name, and checkIfRefIdIsValid().

Referenced by childExists(), and getMountPointByReference().

179  {
180  $ref_parts = explode('_', $name);
181  if (count($ref_parts) == 2) {
182  $ref_id = (int) $ref_parts[1];
183  return $this->checkIfRefIdIsValid($ref_id);
184  }
185 
186  return 0;
187  }
if($format !==null) $name
Definition: metadata.php:230
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 143 of file class.ilClientNodeDAV.php.

Referenced by getChild(), and getChildren().

144  {
145  if ($this->repo_helper->checkAccess('read', ROOT_FOLDER_ID)) {
146  return new ilObjRepositoryRootDAV($this->name_of_repository_root, $this->repo_helper, $this->dav_helper);
147  }
148  throw new Forbidden("No read permission for ilias repository root");
149  }
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

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

58  {
59  throw new Forbidden("You cant change the client name");
60  }

Field Documentation

◆ $dav_helper

ilClientNodeDAV::$dav_helper
protected

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

Referenced by __construct().

◆ $name_of_repository_root

ilClientNodeDAV::$name_of_repository_root
protected

Definition at line 36 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: