ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilFileServicesSettings Class Reference

Class ilObjFileServices. More...

+ Collaboration diagram for ilFileServicesSettings:

Public Member Functions

 __construct (private ilSetting $settings, ilIniFile $client_ini, private 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

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 ( private ilSetting  $settings,
ilIniFile  $client_ini,
private ilDBInterface  $db 
)

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

References determineFileAdminRefId(), and read().

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

Member Function Documentation

◆ determineByPass()

ilFileServicesSettings::determineByPass ( )
private

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

References $DIC.

Referenced by isByPassAllowedForCurrentUser().

60  : bool
61  {
62  global $DIC;
63  return $DIC->isDependencyAvailable('rbac')
64  && isset($DIC["rbacsystem"])
65  && $DIC->rbac()->system()->checkAccess(
66  'upload_blacklisted_files',
67  $this->file_admin_ref_id
68  );
69  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ determineFileAdminRefId()

ilFileServicesSettings::determineFileAdminRefId ( )
private

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

References $r.

Referenced by __construct().

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

◆ getBlackListedSuffixes()

ilFileServicesSettings::getBlackListedSuffixes ( )

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

References $black_list_overall.

Referenced by ilFileServicesFilenameSanitizer\__construct().

135  : array
136  {
138  }
+ Here is the caller graph for this function:

◆ getCleaner()

ilFileServicesSettings::getCleaner ( )
private

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

Referenced by readBlackList(), and readWhiteList().

125  : Closure
126  {
127  return fn(string $suffix): string => trim(strtolower($suffix));
128  }
+ Here is the caller graph for this function:

◆ getDefaultWhitelist()

ilFileServicesSettings::getDefaultWhitelist ( )

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

References $white_list_default.

143  : array
144  {
146  }

◆ getProhibited()

ilFileServicesSettings::getProhibited ( )

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

References $black_list_prohibited.

167  : array
168  {
170  }

◆ getWhiteListedSuffixes()

ilFileServicesSettings::getWhiteListedSuffixes ( )

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

References $white_list_overall.

Referenced by ilFileServicesFilenameSanitizer\__construct().

130  : array
131  {
133  }
+ Here is the caller graph for this function:

◆ getWhiteListNegative()

ilFileServicesSettings::getWhiteListNegative ( )

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

References $white_list_negative.

151  : array
152  {
154  }

◆ getWhiteListPositive()

ilFileServicesSettings::getWhiteListPositive ( )

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

References $white_list_positive.

159  : array
160  {
162  }

◆ isASCIIConvertionEnabled()

ilFileServicesSettings::isASCIIConvertionEnabled ( )

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

References $convert_to_ascii.

85  : bool
86  {
88  }

◆ isByPassAllowedForCurrentUser()

ilFileServicesSettings::isByPassAllowedForCurrentUser ( )

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

References $bypass, determineByPass(), and null.

71  : bool
72  {
73  if ($this->bypass !== null) {
74  return $this->bypass;
75  }
76  return $this->bypass = $this->determineByPass();
77  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ read()

ilFileServicesSettings::read ( )
private

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

References readBlackList(), and readWhiteList().

Referenced by __construct().

79  : void
80  {
81  $this->readBlackList();
82  $this->readWhiteList();
83  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readBlackList()

ilFileServicesSettings::readBlackList ( )
private

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

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

Referenced by read().

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

◆ readWhiteList()

ilFileServicesSettings::readWhiteList ( )
private

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

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

Referenced by read().

90  : void
91  {
92  $cleaner = $this->getCleaner();
93 
94  $this->white_list_negative = array_map(
95  $cleaner,
96  explode(",", $this->settings->get("suffix_repl_additional") ?? '')
97  );
98 
99  $this->white_list_positive = array_map(
100  $cleaner,
101  explode(",", $this->settings->get("suffix_custom_white_list") ?? '')
102  );
103 
104  $this->white_list_overall = array_merge($this->white_list_default, $this->white_list_positive);
105  $this->white_list_overall = array_diff($this->white_list_overall, $this->white_list_negative);
106  $this->white_list_overall = array_diff($this->white_list_overall, $this->black_list_overall);
107  $this->white_list_overall[] = '';
108  $this->white_list_overall = array_unique($this->white_list_overall);
109  $this->white_list_overall = array_diff($this->white_list_overall, $this->black_list_prohibited);
110  }
+ 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 33 of file class.ilFileServicesSettings.php.

Referenced by getBlackListedSuffixes().

◆ $black_list_prohibited

array ilFileServicesSettings::$black_list_prohibited = []
private

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

Referenced by getProhibited(), and readBlackList().

◆ $bypass

bool ilFileServicesSettings::$bypass = null
private

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

Referenced by isByPassAllowedForCurrentUser().

◆ $convert_to_ascii

bool ilFileServicesSettings::$convert_to_ascii = true
private

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

Referenced by isASCIIConvertionEnabled().

◆ $file_admin_ref_id

int ilFileServicesSettings::$file_admin_ref_id
protected

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

◆ $white_list_default

array ilFileServicesSettings::$white_list_default = []
private

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

Referenced by getDefaultWhitelist().

◆ $white_list_negative

array ilFileServicesSettings::$white_list_negative = []
private

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

Referenced by getWhiteListNegative().

◆ $white_list_overall

array ilFileServicesSettings::$white_list_overall = []
private

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

Referenced by getWhiteListedSuffixes().

◆ $white_list_positive

array ilFileServicesSettings::$white_list_positive = []
private

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

Referenced by getWhiteListPositive().


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