62 if ($this->repo_helper->checkCreateAccessForType($this->obj->getRefId(),
'file')) {
63 $size = $this->request->getHeader(
"Content-Length")[0] ?? 0;
65 throw new Exception\Forbidden(
'File is too big');
69 if ($this->dav_helper->isValidFileNameWithValidFileExtension(
$name)) {
72 return $file_dav->put(
$data);
75 $file_obj->setTitle(
$name);
76 $file_obj->setFileName(
$name);
77 $file_obj->setVersion(1);
78 $file_obj->setMaxVersion(1);
79 $file_obj->createDirectory();
82 $file_obj->createReference();
83 $file_obj->putInTree($this->obj->getRefId());
84 $file_obj->setPermissions($this->ref_id);
86 $file_dav =
new ilObjFileDAV($file_obj, $this->repo_helper, $this->dav_helper);
87 return $file_dav->handleFileUpload(
$data,
"create");
92 throw new Forbidden(
'Invalid file name or file extension');
95 throw new Forbidden(
'No write access');
111 if ($this->repo_helper->checkCreateAccessForType($this->getRefId(),
$type) && $this->dav_helper->isDAVableObjTitle(
$name)) {
122 ilLoggerFactory::getLogger(
'WebDAV')->info(get_class($this) .
' ' . $this->obj->getTitle() .
" -> $type is not supported as webdav directory");
123 throw new NotImplemented(
"Create type '$type' as collection is not implemented yet");
126 $new_obj->setType(
$type);
127 $new_obj->setOwner($DIC->user()->getId());
128 $new_obj->setTitle(
$name);
131 $new_obj->createReference();
132 $new_obj->putInTree($this->obj->getRefId());
133 $new_obj->setPermissions($this->obj->getRefId());
136 throw new Forbidden();
153 $child_exists =
false;
161 foreach ($this->repo_helper->getChildrenOfRefId($this->obj->getRefId()) as $child_ref) {
163 if ($this->dav_helper->isDAVableObject($child_ref,
true)) {
165 if ($this->repo_helper->getObjectTitleFromRefId($child_ref,
true) ==
$name) {
166 $child_exists =
true;
170 $child_node = $this->dav_helper->createDAVObjectForRefId($child_ref);
177 if (!is_null($child_node)) {
192 $child_nodes = array();
193 $already_seen_titles = array();
194 $problem_info_file_needed =
false;
196 foreach ($this->repo_helper->getChildrenOfRefId($this->obj->getRefId()) as $child_ref) {
198 if ($this->dav_helper->isDAVableObject($child_ref,
true)) {
200 $title = $this->repo_helper->getObjectTitleFromRefId($child_ref);
201 if (in_array($title, $already_seen_titles)) {
202 $problem_info_file_needed =
true;
206 $already_seen_titles[] = $title;
211 $child_nodes[$child_ref] = $this->dav_helper->createDAVObjectForRefId($child_ref);
215 elseif (!$problem_info_file_needed
216 && $this->dav_helper->isDAVableObjType($this->repo_helper->getObjectTypeFromRefId($child_ref))
217 && $this->dav_helper->hasTitleForbiddenChars($this->repo_helper->getObjectTitleFromRefId($child_ref))) {
218 $problem_info_file_needed =
true;
222 if ($problem_info_file_needed) {
237 foreach ($this->repo_helper->getChildrenOfRefId($this->obj->getRefId()) as $child_ref) {
239 if ($this->dav_helper->isDAVableObject($child_ref,
true)) {
241 if ($this->repo_helper->getObjectTitleFromRefId($child_ref,
true) ==
$name) {
261 return $this->repo_helper->checkAccess(
"visible", $child_ref) && $this->repo_helper->checkAccess(
"read", $child_ref);
createDirectory($name)
Creates a new subdirectory.
getChildCollectionType()
Return the type for child collections of this collection For courses, groups and folders the type is ...
getChildren()
Returns an array with all the child nodes.
Class ilWebDAVRepositoryHelper.
childExists($name)
Checks if a child-node with the specified name exists.
Class ilWebDAVObjDAVHelper.
checkReadAndVisibleAccessForObj($child_ref)
createFile($name, $data=null)
Creates a new file in the directory.
static getUploadSizeLimitBytes()
const PROBLEM_INFO_FILE_NAME
getChild($name)
Returns a specific child node, referenced by its name.
__construct(Container $dic, ilPlugin $plugin)
__construct(ilContainer $a_obj, ilWebDAVRepositoryHelper $repo_helper, ilWebDAVObjDAVHelper $dav_helper)
Check if given object has valid type and calls parent constructor.
static getLogger($a_component_id)
Get component logger.