ILIAS  release_8 Revision v8.24
class.ilObjFolderAccess.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
24{
25 private static ?ilSetting $folderSettings = null;
26
27 private static function getFolderSettings(): ilSetting
28 {
29 if (is_null(self::$folderSettings)) {
30 self::$folderSettings = new ilSetting('fold');
31 }
33 }
34
35 public function _checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id = null): bool
36 {
37 if ($cmd === "download" &&
38 !self::hasDownloadAction($ref_id)) {
39 return false;
40 }
41 return true;
42 }
43
44 public static function _getCommands(): array
45 {
46 $commands = [];
47 $commands[] = ["permission" => "read", "cmd" => "view", "lang_var" => "show", "default" => true];
48
49 // why here, why read permission? it just needs info_screen_enabled = true in ilObjCategoryListGUI (alex, 30.7.2008)
50 // this is not consistent, with all other objects...
51 //$commands[] = array("permission" => "read", "cmd" => "showSummary", "lang_var" => "info_short", "enable_anonymous" => "false");
52 $commands[] = ["permission" => "read", "cmd" => "download", "lang_var" => "download"]; // #18805
53 // BEGIN WebDAV: Mount Webfolder.
55 $webdav_obj = new ilObjWebDAV();
56 $commands[] = $webdav_obj->retrieveWebDAVCommandArrayForActionMenu();
57 }
58 $commands[] = ["permission" => "write", "cmd" => "enableAdministrationPanel", "lang_var" => "edit_content"];
59 $commands[] = ["permission" => "write", "cmd" => "edit", "lang_var" => "settings"];
60
61 return $commands;
62 }
63
64
65 private static function hasDownloadAction(int $ref_id): bool
66 {
68 if ((int) $settings->get("enable_download_folder", '0') !== 1) {
69 return false;
70 }
71 return true;
72 }
73
74 public static function _checkGoto(string $target): bool
75 {
76 global $DIC;
77
78 $ilAccess = $DIC->access();
79
80 $t_arr = explode("_", $target);
81
82 if ($t_arr[0] !== "fold" || ((int) $t_arr[1]) <= 0) {
83 return false;
84 }
85
86 if ($ilAccess->checkAccess("read", "", (int) $t_arr[1]) ||
87 $ilAccess->checkAccess("visible", "", (int) $t_arr[1])) {
88 return true;
89 }
90 return false;
91 }
92}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _checkGoto(string $target)
check whether goto script will succeed
static hasDownloadAction(int $ref_id)
_checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
Checks whether a user may invoke a command or not (this method is called by ilAccessHandler::checkAcc...
static _getCommands()
get commands
static ilSetting $folderSettings
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...
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200