ILIAS  release_8 Revision v8.23
ilWebDAVRepositoryHelper Class Reference
+ Collaboration diagram for ilWebDAVRepositoryHelper:

Public Member Functions

 __construct (ilAccessHandler $access, ilTree $tree, ilRepUtil $repository_util, ilWebDAVLocksRepository $locks_repository)
 
 deleteObject (int $ref_id)
 
 checkAccess (string $permission, int $ref_id)
 
 checkCreateAccessForType (int $ref_id, string $type)
 
 objectWithRefIdExists (int $ref_id)
 
 getObjectIdFromRefId (int $ref_id)
 
 getObjectTitleFromObjId (int $obj_id, bool $escape_forbidden_fileextension=false)
 
 getFilenameWithSanitizedFileExtension (int $obj_id)
 
 getParentOfRefId (int $ref_id)
 
 getObjectTypeFromObjId (int $obj_id)
 
 getObjectTitleFromRefId (int $ref_id, bool $escape_forbidden_fileextension=false)
 
 getObjectTypeFromRefId (int $ref_id)
 
 getChildrenOfRefId (int $ref_id)
 
 updateLocksAfterResettingObject (int $old_obj_id, int $new_obj_id)
 

Protected Member Functions

 getRawObjectTitleFromObjId (int $obj_id)
 

Protected Attributes

ilAccessHandler $access
 
ilTree $tree
 
ilRepUtil $repository_util
 
ilWebDAVLocksRepository $locks_repository
 

Detailed Description

Definition at line 23 of file class.ilWebDAVRepositoryHelper.php.

Constructor & Destructor Documentation

◆ __construct()

ilWebDAVRepositoryHelper::__construct ( ilAccessHandler  $access,
ilTree  $tree,
ilRepUtil  $repository_util,
ilWebDAVLocksRepository  $locks_repository 
)

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

References $access, $locks_repository, $repository_util, $tree, and ILIAS\Repository\access().

31  {
32  $this->access = $access;
33  $this->tree = $tree;
34  $this->repository_util = $repository_util;
35  $this->locks_repository = $locks_repository;
36  }
ilWebDAVLocksRepository $locks_repository
+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilWebDAVRepositoryHelper::checkAccess ( string  $permission,
int  $ref_id 
)

Definition at line 48 of file class.ilWebDAVRepositoryHelper.php.

References ILIAS\Repository\access().

Referenced by deleteObject().

48  : bool
49  {
50  return $this->access->checkAccess($permission, '', $ref_id);
51  }
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkCreateAccessForType()

ilWebDAVRepositoryHelper::checkCreateAccessForType ( int  $ref_id,
string  $type 
)

Definition at line 53 of file class.ilWebDAVRepositoryHelper.php.

References ILIAS\Repository\access().

53  : bool
54  {
55  return $this->access->checkAccess('create', '', $ref_id, $type);
56  }
$type
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

◆ deleteObject()

ilWebDAVRepositoryHelper::deleteObject ( int  $ref_id)

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

References checkAccess().

38  : void
39  {
40  if (!$this->checkAccess('delete', $ref_id)) {
41  throw new Forbidden("Permission denied");
42  }
43 
44  $parent = $this->tree->getParentId($ref_id);
45  $this->repository_util->deleteObjects($parent, [$ref_id]);
46  }
checkAccess(string $permission, int $ref_id)
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

◆ getChildrenOfRefId()

ilWebDAVRepositoryHelper::getChildrenOfRefId ( int  $ref_id)
Returns
int[]

Definition at line 123 of file class.ilWebDAVRepositoryHelper.php.

123  : array
124  {
125  return array_map(
126  'intval',
127  $this->tree->getChildIds($ref_id)
128  );
129  }
$ref_id
Definition: ltiauth.php:67

◆ getFilenameWithSanitizedFileExtension()

ilWebDAVRepositoryHelper::getFilenameWithSanitizedFileExtension ( int  $obj_id)

Definition at line 79 of file class.ilWebDAVRepositoryHelper.php.

References Vendor\Package\$e, getRawObjectTitleFromObjId(), and ilFileUtils\getValidFilename().

Referenced by getObjectTitleFromObjId().

79  : string
80  {
81  $unescaped_title = $this->getRawObjectTitleFromObjId($obj_id);
82 
83  try {
84  $escaped_title = ilFileUtils::getValidFilename($unescaped_title);
85  } catch (ilFileUtilsException $e) {
86  $escaped_title = '';
87  }
88 
89  return $escaped_title;
90  }
static getValidFilename(string $a_filename)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjectIdFromRefId()

ilWebDAVRepositoryHelper::getObjectIdFromRefId ( int  $ref_id)

Definition at line 63 of file class.ilWebDAVRepositoryHelper.php.

References ilObject\_lookupObjectId().

Referenced by getObjectTitleFromRefId().

63  : int
64  {
66  }
$ref_id
Definition: ltiauth.php:67
static _lookupObjectId(int $ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjectTitleFromObjId()

ilWebDAVRepositoryHelper::getObjectTitleFromObjId ( int  $obj_id,
bool  $escape_forbidden_fileextension = false 
)

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

References ilObject\_lookupType(), getFilenameWithSanitizedFileExtension(), and getRawObjectTitleFromObjId().

Referenced by getObjectTitleFromRefId().

68  : string
69  {
70  if ($escape_forbidden_fileextension && ilObject::_lookupType($obj_id) === 'file') {
71  $title = $this->getFilenameWithSanitizedFileExtension($obj_id);
72  } else {
73  $title = $this->getRawObjectTitleFromObjId($obj_id);
74  }
75 
76  return $title;
77  }
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjectTitleFromRefId()

ilWebDAVRepositoryHelper::getObjectTitleFromRefId ( int  $ref_id,
bool  $escape_forbidden_fileextension = false 
)

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

References getObjectIdFromRefId(), and getObjectTitleFromObjId().

107  : string
108  {
109  $obj_id = $this->getObjectIdFromRefId($ref_id);
110 
111  return $this->getObjectTitleFromObjId($obj_id, $escape_forbidden_fileextension);
112  }
$ref_id
Definition: ltiauth.php:67
getObjectTitleFromObjId(int $obj_id, bool $escape_forbidden_fileextension=false)
+ Here is the call graph for this function:

◆ getObjectTypeFromObjId()

ilWebDAVRepositoryHelper::getObjectTypeFromObjId ( int  $obj_id)

Definition at line 102 of file class.ilWebDAVRepositoryHelper.php.

References ilObject\_lookupType().

102  : string
103  {
104  return ilObject::_lookupType($obj_id);
105  }
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ getObjectTypeFromRefId()

ilWebDAVRepositoryHelper::getObjectTypeFromRefId ( int  $ref_id)

Definition at line 114 of file class.ilWebDAVRepositoryHelper.php.

References ilObject\_lookupType().

114  : string
115  {
116  return ilObject::_lookupType($ref_id, true);
117  }
$ref_id
Definition: ltiauth.php:67
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ getParentOfRefId()

ilWebDAVRepositoryHelper::getParentOfRefId ( int  $ref_id)

Definition at line 97 of file class.ilWebDAVRepositoryHelper.php.

97  : int
98  {
99  return $this->tree->getParentId($ref_id);
100  }
$ref_id
Definition: ltiauth.php:67

◆ getRawObjectTitleFromObjId()

ilWebDAVRepositoryHelper::getRawObjectTitleFromObjId ( int  $obj_id)
protected

Definition at line 92 of file class.ilWebDAVRepositoryHelper.php.

References ilObject\_lookupTitle().

Referenced by getFilenameWithSanitizedFileExtension(), and getObjectTitleFromObjId().

92  : string
93  {
94  return ilObject::_lookupTitle($obj_id);
95  }
static _lookupTitle(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ objectWithRefIdExists()

ilWebDAVRepositoryHelper::objectWithRefIdExists ( int  $ref_id)

Definition at line 58 of file class.ilWebDAVRepositoryHelper.php.

References ilObject\_exists().

58  : bool
59  {
60  return ilObject::_exists($ref_id, true);
61  }
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

◆ updateLocksAfterResettingObject()

ilWebDAVRepositoryHelper::updateLocksAfterResettingObject ( int  $old_obj_id,
int  $new_obj_id 
)

Definition at line 131 of file class.ilWebDAVRepositoryHelper.php.

131  : void
132  {
133  $this->locks_repository->updateLocks($old_obj_id, $new_obj_id);
134  }

Field Documentation

◆ $access

ilAccessHandler ilWebDAVRepositoryHelper::$access
protected

Definition at line 25 of file class.ilWebDAVRepositoryHelper.php.

Referenced by __construct().

◆ $locks_repository

ilWebDAVLocksRepository ilWebDAVRepositoryHelper::$locks_repository
protected

Definition at line 28 of file class.ilWebDAVRepositoryHelper.php.

Referenced by __construct().

◆ $repository_util

ilRepUtil ilWebDAVRepositoryHelper::$repository_util
protected

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

Referenced by __construct().

◆ $tree

ilTree ilWebDAVRepositoryHelper::$tree
protected

Definition at line 26 of file class.ilWebDAVRepositoryHelper.php.

Referenced by __construct().


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