ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjFolderAccess.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/Object/classes/class.ilObjectAccess.php");
6 
16 {
17  private static $folderSettings;
18 
19  private static function getFolderSettings()
20  {
23  }
25  }
26 
27 
40  public static function _getCommands()
41  {
42  $commands = array();
43  $commands[] = array("permission" => "read", "cmd" => "view", "lang_var" => "show", "default" => true);
44 
45  // why here, why read permission? it just needs info_screen_enabled = true in ilObjCategoryListGUI (alex, 30.7.2008)
46  // this is not consistent, with all other objects...
47  //$commands[] = array("permission" => "read", "cmd" => "showSummary", "lang_var" => "info_short", "enable_anonymous" => "false");
49  $commands[] = array("permission" => "read", "cmd" => "download", "lang_var" => "download"); // #18805
50  }
51  // BEGIN WebDAV: Mount Webfolder.
52  include_once('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
54  include_once './Services/WebDAV/classes/class.ilWebDAVUtil.php';
55  if (ilWebDAVUtil::getInstance()->isLocalPasswordInstructionRequired()) {
56  $commands[] = array('permission' => 'read', 'cmd' => 'showPasswordInstruction', 'lang_var' => 'mount_webfolder', 'enable_anonymous' => 'false');
57  } else {
58  $commands[] = array("permission" => "read", "cmd" => "mount_webfolder", "lang_var" => "mount_webfolder", "enable_anonymous" => "false");
59  }
60  }
61  $commands[] = array("permission" => "write", "cmd" => "enableAdministrationPanel", "lang_var" => "edit_content");
62  $commands[] = array("permission" => "write", "cmd" => "edit", "lang_var" => "settings");
63 
64  return $commands;
65  }
66 
67 
68  private static function hasDownloadAction($ref_id)
69  {
70  global $DIC;
71 
72  $tree = $DIC->repositoryTree();
73  $ilUser = $DIC->user();
75  // default value should reflect previous behaviour (-> 0)
76  if ($settings->get("enable_download_folder", 0) != 1) {
77  return false;
78  }
79 
80  /*
81  * deactivated check for now, because wrong ref_id here!
82 
83  *
84  $children = $tree->getChildsByTypeFilter($ref_id, array("file","fold"));
85 
86  // no children at all, so no download button
87  if (count ($children) == 0)
88  return false;
89  // check if at least one of the children has a read permission
90  foreach ($children as $child)
91  {
92  if ($rbacsystem->checkAccessOfUser($ilUser->getId(), "read", $child["ref_id"]))
93  return true;
94  }
95  return false;
96  */
97  return true;
98  }
99 
103  public static function _checkGoto($a_target)
104  {
105  global $DIC;
106 
107  $ilAccess = $DIC->access();
108 
109  $t_arr = explode("_", $a_target);
110 
111  if ($t_arr[0] != "fold" || ((int) $t_arr[1]) <= 0) {
112  return false;
113  }
114 
115  if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
116  $ilAccess->checkAccess("visible", "", $t_arr[1])) {
117  return true;
118  }
119  return false;
120  }
121 
122 }
static hasDownloadAction($ref_id)
$_GET["client_id"]
static _checkGoto($a_target)
check whether goto script will succeed
static _isActive()
Static getter.
Class ilObjFileAccess.
global $DIC
Definition: goto.php:24
static _getCommands()
get commands
static getInstance()
Get singleton instance.
$ilUser
Definition: imgupload.php:18