ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDAVContainer Class Reference
+ Inheritance diagram for ilDAVContainer:
+ Collaboration diagram for ilDAVContainer:

Public Member Functions

 __construct (ilContainer $obj, ilObjUser $current_user, RequestInterface $request, ilWebDAVObjFactory $dav_factory, ilWebDAVRepositoryHelper $repository_helper)
 
 getName ()
 
 getChild ($name)
 
 getChildren ()
 
 childExists ($name)
 
 setName ($name)
 
 createFile ($name, $data=null)
 
 createDirectory ($name)
 
 delete ()
 
 getLastModified ()
 

Protected Member Functions

 getChildCollection ()
 

Protected Attributes

ilObjUser $current_user
 
ilObject $obj
 
RequestInterface $request
 
ilWebDAVObjFactory $dav_factory
 
ilWebDAVRepositoryHelper $repository_helper
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDAVContainer::__construct ( ilContainer  $obj,
ilObjUser  $current_user,
RequestInterface  $request,
ilWebDAVObjFactory  $dav_factory,
ilWebDAVRepositoryHelper  $repository_helper 
)

Definition at line 41 of file class.ilDAVContainer.php.

References $current_user, $dav_factory, $obj, $repository_helper, and $request.

47  {
48  $this->obj = $obj;
49  $this->current_user = $current_user;
50  $this->request = $request;
51  $this->dav_factory = $dav_factory;
52  $this->repository_helper = $repository_helper;
53  }
ilWebDAVRepositoryHelper $repository_helper
ilWebDAVObjFactory $dav_factory
RequestInterface $request

Member Function Documentation

◆ childExists()

ilDAVContainer::childExists (   $name)

See also
::childExists()

Definition at line 90 of file class.ilDAVContainer.php.

References $name.

Referenced by createFile().

90  : bool
91  {
92  return $this->checkIfChildExistsByParentRefId(
93  $this->repository_helper,
94  $this->dav_factory,
95  $this->obj->getRefId(),
96  $name
97  );
98  }
if($format !==null) $name
Definition: metadata.php:247
+ Here is the caller graph for this function:

◆ createDirectory()

ilDAVContainer::createDirectory (   $name)

See also
::createDirectory()

Definition at line 158 of file class.ilDAVContainer.php.

References Vendor\Package\$e, $name, and getChildCollection().

158  : void
159  {
160  $new_obj = $this->getChildCollection();
161 
162  if (!$this->repository_helper->checkCreateAccessForType($this->obj->getRefId(), $new_obj->getType())) {
163  throw new Forbidden('Permission denied');
164  }
165 
166  try {
167  $new_obj->setOwner($this->current_user->getId());
168  $new_obj->setTitle($name);
169  $this->dav_factory->createDAVObject($new_obj, $this->obj->getRefId());
170  } catch (ilWebDAVNotDavableException $e) {
171  throw new Forbidden('Forbidden characters in title');
172  }
173  }
if($format !==null) $name
Definition: metadata.php:247
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ createFile()

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

See also
::createFile()

Definition at line 122 of file class.ilDAVContainer.php.

References $data, Vendor\Package\$e, $name, childExists(), getChild(), and ilFileUtils\getUploadSizeLimitBytes().

122  : ?string
123  {
124  if (!$this->repository_helper->checkCreateAccessForType($this->obj->getRefId(), 'file')) {
125  throw new Forbidden('Permission denied');
126  }
127 
128  $size = $this->request->getHeader("Content-Length")[0] ?? 0;
129  if ($size === 0 && $this->request->hasHeader('X-Expected-Entity-Length')) {
130  $size = $this->request->getHeader('X-Expected-Entity-Length')[0];
131  }
132 
133  if ($size > ilFileUtils::getUploadSizeLimitBytes()) {
134  throw new Forbidden('File is too big');
135  }
136 
137  if ($this->childExists($name)) {
138  $file_dav = $this->getChild($name);
139  } else {
140  try {
141  $file_obj = new ilObjFile();
142  $file_obj->setTitle($name);
143  $file_obj->setFileName($name);
144 
145  $file_dav = $this->dav_factory->createDAVObject($file_obj, $this->obj->getRefId());
146  } catch (ilWebDAVNotDavableException $e) {
147  throw new Forbidden('Forbidden characters in title');
148  }
149  }
150 
151  return $file_dav->put($data);
152  }
static getUploadSizeLimitBytes()
if($format !==null) $name
Definition: metadata.php:247
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjFile.
+ Here is the call graph for this function:

◆ delete()

ilDAVContainer::delete ( )

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

175  : void
176  {
177  $this->repository_helper->deleteObject($this->obj->getRefId());
178  }

◆ getChild()

ilDAVContainer::getChild (   $name)

See also
::getChild()

Definition at line 64 of file class.ilDAVContainer.php.

References $name.

Referenced by createFile().

64  : INode
65  {
66  return $this->getChildByParentRefId(
67  $this->repository_helper,
68  $this->dav_factory,
69  $this->obj->getRefId(),
70  $name
71  );
72  }
if($format !==null) $name
Definition: metadata.php:247
+ Here is the caller graph for this function:

◆ getChildCollection()

ilDAVContainer::getChildCollection ( )
protected

Definition at line 185 of file class.ilDAVContainer.php.

Referenced by createDirectory().

185  : ilContainer
186  {
187  if (get_class($this->obj) === 'ilObjCategory') {
188  return new ilObjCategory();
189  }
190 
191  return new ilObjFolder();
192  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ getChildren()

ilDAVContainer::getChildren ( )
Returns
ilObject[]

Definition at line 77 of file class.ilDAVContainer.php.

77  : array
78  {
79  return $this->getChildrenByParentRefId(
80  $this->repository_helper,
81  $this->dav_factory,
82  $this->obj->getRefId()
83  );
84  }

◆ getLastModified()

ilDAVContainer::getLastModified ( )

Definition at line 180 of file class.ilDAVContainer.php.

180  : ?int
181  {
182  return $this->retrieveLastModifiedAsIntFromObjectLastUpdateString($this->obj->getLastUpdateDate());
183  }

◆ getName()

ilDAVContainer::getName ( )

Definition at line 55 of file class.ilDAVContainer.php.

55  : string
56  {
57  return $this->obj->getTitle();
58  }

◆ setName()

ilDAVContainer::setName (   $name)

See also
::setName()

Definition at line 104 of file class.ilDAVContainer.php.

References $name.

104  : void
105  {
106  if (!$this->repository_helper->checkAccess("write", $this->obj->getRefId())) {
107  throw new Forbidden('Permission denied');
108  }
109 
110  if ($this->isDAVableObjTitle($name)) {
111  $this->obj->setTitle($name);
112  $this->obj->update();
113  } else {
114  throw new Forbidden('Forbidden characters in title');
115  }
116  }
if($format !==null) $name
Definition: metadata.php:247

Field Documentation

◆ $current_user

ilObjUser ilDAVContainer::$current_user
protected

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

Referenced by __construct().

◆ $dav_factory

ilWebDAVObjFactory ilDAVContainer::$dav_factory
protected

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

Referenced by __construct().

◆ $obj

ilObject ilDAVContainer::$obj
protected

Definition at line 36 of file class.ilDAVContainer.php.

Referenced by __construct().

◆ $repository_helper

ilWebDAVRepositoryHelper ilDAVContainer::$repository_helper
protected

Definition at line 39 of file class.ilDAVContainer.php.

Referenced by __construct().

◆ $request

RequestInterface ilDAVContainer::$request
protected

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

Referenced by __construct().


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