ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilFileServicesSettings Class Reference

Class ilObjFileServices. More...

+ Collaboration diagram for ilFileServicesSettings:

Public Member Functions

 __construct (ilSetting $settings, ilIniFile $client_ini, ilDBInterface $db)
 
 isByPassAllowedForCurrentUser ()
 
 isASCIIConvertionEnabled ()
 
 getWhiteListedSuffixes ()
 
 getBlackListedSuffixes ()
 
 getDefaultWhitelist ()
 
 getWhiteListNegative ()
 
 getWhiteListPositive ()
 
 getProhibited ()
 

Protected Attributes

int $file_admin_ref_id
 

Private Member Functions

 determineFileAdminRefId ()
 
 determineByPass ()
 
 read ()
 
 readWhiteList ()
 
 readBlackList ()
 
 getCleaner ()
 

Private Attributes

ilSetting $settings
 
ilDBInterface $db
 
array $white_list_default = []
 
array $white_list_negative = []
 
array $white_list_positive = []
 
array $white_list_overall = []
 
array $black_list_prohibited = []
 
array $black_list_overall = []
 
bool $convert_to_ascii = true
 
bool $bypass = null
 

Detailed Description

Class ilObjFileServices.

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

Constructor & Destructor Documentation

◆ __construct()

ilFileServicesSettings::__construct ( ilSetting  $settings,
ilIniFile  $client_ini,
ilDBInterface  $db 
)

Definition at line 40 of file class.ilFileServicesSettings.php.

References $db, $settings, determineFileAdminRefId(), read(), and ILIAS\Repository\settings().

44  {
45  $this->db = $db;
46 
47  $general_settings = new General();
48  $this->convert_to_ascii = $general_settings->isDownloadWithAsciiFileName();
49  $this->settings = $settings;
51  $this->white_list_default = include __DIR__ . "/../defaults/default_whitelist.php";
52  $this->file_admin_ref_id = $this->determineFileAdminRefId();
53  $this->read();
54  }
+ Here is the call graph for this function:

Member Function Documentation

◆ determineByPass()

ilFileServicesSettings::determineByPass ( )
private

Definition at line 65 of file class.ilFileServicesSettings.php.

References $DIC.

Referenced by isByPassAllowedForCurrentUser().

65  : bool
66  {
67  global $DIC;
68  return $DIC->isDependencyAvailable('rbac')
69  && isset($DIC["rbacsystem"])
70  && $DIC->rbac()->system()->checkAccess(
71  'upload_blacklisted_files',
72  $this->file_admin_ref_id
73  );
74  }
global $DIC
Definition: shib_login.php:25
+ Here is the caller graph for this function:

◆ determineFileAdminRefId()

ilFileServicesSettings::determineFileAdminRefId ( )
private

Definition at line 56 of file class.ilFileServicesSettings.php.

References $r.

Referenced by __construct().

56  : int
57  {
58  $r = $this->db->query(
59  "SELECT ref_id FROM object_reference JOIN object_data ON object_reference.obj_id = object_data.obj_id WHERE object_data.type = 'facs';"
60  );
61  $r = $this->db->fetchObject($r);
62  return (int) ($r->ref_id ?? 0);
63  }
$r
+ Here is the caller graph for this function:

◆ getBlackListedSuffixes()

ilFileServicesSettings::getBlackListedSuffixes ( )

Definition at line 142 of file class.ilFileServicesSettings.php.

References $black_list_overall.

Referenced by ilFileServicesFilenameSanitizer\__construct(), and ilFileServicesPreProcessor\__construct().

142  : array
143  {
145  }
+ Here is the caller graph for this function:

◆ getCleaner()

ilFileServicesSettings::getCleaner ( )
private

Definition at line 130 of file class.ilFileServicesSettings.php.

Referenced by readBlackList(), and readWhiteList().

130  : Closure
131  {
132  return function (string $suffix): string {
133  return trim(strtolower($suffix));
134  };
135  }
+ Here is the caller graph for this function:

◆ getDefaultWhitelist()

ilFileServicesSettings::getDefaultWhitelist ( )

Definition at line 150 of file class.ilFileServicesSettings.php.

References $white_list_default.

151  {
153  }

◆ getProhibited()

ilFileServicesSettings::getProhibited ( )

Definition at line 174 of file class.ilFileServicesSettings.php.

References $black_list_prohibited.

174  : array
175  {
177  }

◆ getWhiteListedSuffixes()

ilFileServicesSettings::getWhiteListedSuffixes ( )

Definition at line 137 of file class.ilFileServicesSettings.php.

References $white_list_overall.

Referenced by ilFileServicesFilenameSanitizer\__construct().

137  : array
138  {
140  }
+ Here is the caller graph for this function:

◆ getWhiteListNegative()

ilFileServicesSettings::getWhiteListNegative ( )

Definition at line 158 of file class.ilFileServicesSettings.php.

References $white_list_negative.

158  : array
159  {
161  }

◆ getWhiteListPositive()

ilFileServicesSettings::getWhiteListPositive ( )

Definition at line 166 of file class.ilFileServicesSettings.php.

References $white_list_positive.

166  : array
167  {
169  }

◆ isASCIIConvertionEnabled()

ilFileServicesSettings::isASCIIConvertionEnabled ( )

Definition at line 90 of file class.ilFileServicesSettings.php.

References $convert_to_ascii.

90  : bool
91  {
93  }

◆ isByPassAllowedForCurrentUser()

ilFileServicesSettings::isByPassAllowedForCurrentUser ( )

Definition at line 76 of file class.ilFileServicesSettings.php.

References $bypass, and determineByPass().

76  : bool
77  {
78  if ($this->bypass !== null) {
79  return $this->bypass;
80  }
81  return $this->bypass = $this->determineByPass();
82  }
+ Here is the call graph for this function:

◆ read()

ilFileServicesSettings::read ( )
private

Definition at line 84 of file class.ilFileServicesSettings.php.

References readBlackList(), and readWhiteList().

Referenced by __construct().

84  : void
85  {
86  $this->readBlackList();
87  $this->readWhiteList();
88  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readBlackList()

ilFileServicesSettings::readBlackList ( )
private

Definition at line 117 of file class.ilFileServicesSettings.php.

References $black_list_prohibited, getCleaner(), and ILIAS\Repository\settings().

Referenced by read().

117  : void
118  {
119  $cleaner = $this->getCleaner();
120 
121  $this->black_list_prohibited = array_map(
122  $cleaner,
123  explode(",", $this->settings->get("suffix_custom_expl_black") ?? '')
124  );
125 
126  $this->black_list_prohibited = array_filter($this->black_list_prohibited, fn($item): bool => $item !== '');
127  $this->black_list_overall = $this->black_list_prohibited;
128  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readWhiteList()

ilFileServicesSettings::readWhiteList ( )
private

Definition at line 95 of file class.ilFileServicesSettings.php.

References getCleaner(), and ILIAS\Repository\settings().

Referenced by read().

95  : void
96  {
97  $cleaner = $this->getCleaner();
98 
99  $this->white_list_negative = array_map(
100  $cleaner,
101  explode(",", $this->settings->get("suffix_repl_additional") ?? '')
102  );
103 
104  $this->white_list_positive = array_map(
105  $cleaner,
106  explode(",", $this->settings->get("suffix_custom_white_list") ?? '')
107  );
108 
109  $this->white_list_overall = array_merge($this->white_list_default, $this->white_list_positive);
110  $this->white_list_overall = array_diff($this->white_list_overall, $this->white_list_negative);
111  $this->white_list_overall = array_diff($this->white_list_overall, $this->black_list_overall);
112  $this->white_list_overall[] = '';
113  $this->white_list_overall = array_unique($this->white_list_overall);
114  $this->white_list_overall = array_diff($this->white_list_overall, $this->black_list_prohibited);
115  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $black_list_overall

array ilFileServicesSettings::$black_list_overall = []
private

Definition at line 35 of file class.ilFileServicesSettings.php.

Referenced by getBlackListedSuffixes().

◆ $black_list_prohibited

array ilFileServicesSettings::$black_list_prohibited = []
private

Definition at line 34 of file class.ilFileServicesSettings.php.

Referenced by getProhibited(), and readBlackList().

◆ $bypass

bool ilFileServicesSettings::$bypass = null
private

Definition at line 37 of file class.ilFileServicesSettings.php.

Referenced by isByPassAllowedForCurrentUser().

◆ $convert_to_ascii

bool ilFileServicesSettings::$convert_to_ascii = true
private

Definition at line 36 of file class.ilFileServicesSettings.php.

Referenced by isASCIIConvertionEnabled().

◆ $db

ilDBInterface ilFileServicesSettings::$db
private

Definition at line 29 of file class.ilFileServicesSettings.php.

Referenced by __construct().

◆ $file_admin_ref_id

int ilFileServicesSettings::$file_admin_ref_id
protected

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

◆ $settings

ilSetting ilFileServicesSettings::$settings
private

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

Referenced by __construct().

◆ $white_list_default

array ilFileServicesSettings::$white_list_default = []
private

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

Referenced by getDefaultWhitelist().

◆ $white_list_negative

array ilFileServicesSettings::$white_list_negative = []
private

Definition at line 31 of file class.ilFileServicesSettings.php.

Referenced by getWhiteListNegative().

◆ $white_list_overall

array ilFileServicesSettings::$white_list_overall = []
private

Definition at line 33 of file class.ilFileServicesSettings.php.

Referenced by getWhiteListedSuffixes().

◆ $white_list_positive

array ilFileServicesSettings::$white_list_positive = []
private

Definition at line 32 of file class.ilFileServicesSettings.php.

Referenced by getWhiteListPositive().


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