ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjFolderAccess.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
28 private static ?ilSetting $folderSettings = null;
29
30 private static function getFolderSettings(): ilSetting
31 {
32 if (is_null(self::$folderSettings)) {
33 self::$folderSettings = new ilSetting('fold');
34 }
36 }
37
38 public function _checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id = null): bool
39 {
40 if ($cmd === "download" &&
41 !self::hasDownloadAction($ref_id)) {
42 return false;
43 }
44 return true;
45 }
46
47 public static function _getCommands(): array
48 {
49 $commands = [];
50 $commands[] = ["permission" => "read", "cmd" => "view", "lang_var" => "show", "default" => true];
51
52 // why here, why read permission? it just needs info_screen_enabled = true in ilObjCategoryListGUI (alex, 30.7.2008)
53 // this is not consistent, with all other objects...
54 //$commands[] = array("permission" => "read", "cmd" => "showSummary", "lang_var" => "info_short", "enable_anonymous" => "false");
55 $commands[] = ["permission" => "read", "cmd" => "download", "lang_var" => "download"]; // #18805
56 // BEGIN WebDAV: Mount Webfolder.
58 $webdav_obj = new ilObjWebDAV();
59 $commands[] = $webdav_obj->retrieveWebDAVCommandArrayForActionMenu();
60 }
61 $commands[] = ["permission" => "write", "cmd" => "enableAdministrationPanel", "lang_var" => "edit_content"];
62 $commands[] = ["permission" => "write", "cmd" => "edit", "lang_var" => "settings"];
63
64 return $commands;
65 }
66
67
68 private static function hasDownloadAction(int $ref_id): bool
69 {
70 $settings = self::getFolderSettings();
71 if ((int) $settings->get("enable_download_folder", '0') !== 1) {
72 return false;
73 }
74 return true;
75 }
76
77 public static function _checkGoto(string $target): bool
78 {
79 global $DIC;
80
81 $ilAccess = $DIC->access();
82
83 $t_arr = explode("_", $target);
84
85 if ($t_arr[0] !== "fold" || ((int) $t_arr[1]) <= 0) {
86 return false;
87 }
88
89 if ($ilAccess->checkAccess("read", "", (int) $t_arr[1]) ||
90 $ilAccess->checkAccess("visible", "", (int) $t_arr[1])) {
91 return true;
92 }
93 return false;
94 }
95}
Class ilObjFileAccess.
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
Class ilObjectAccess.
ILIAS Setting Class.
$ref_id
Definition: ltiauth.php:66
global $DIC
Definition: shib_login.php:26