ILIAS  release_8 Revision v8.24
ilFileServicesSettings Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilObjFileServices

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

Constructor & Destructor Documentation

◆ __construct()

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

@noRector

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

42 {
43 $this->db = $db;
44 $this->convert_to_ascii = (bool) !$client_ini->readVariable('file_access', 'disable_ascii');
45 $this->settings = $settings;
47 $this->white_list_default = include "./Services/FileServices/defaults/default_whitelist.php";
48 $this->file_admin_ref_id = $this->determineFileAdminRefId();
49 $this->read();
50 }

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

+ Here is the call graph for this function:

Member Function Documentation

◆ determineByPass()

ilFileServicesSettings::determineByPass ( )
private

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

61 : bool
62 {
63 global $DIC;
64 return $DIC->isDependencyAvailable('rbac')
65 && isset($DIC["rbacsystem"])
66 && $DIC->rbac()->system()->checkAccess(
67 'upload_blacklisted_files',
68 $this->file_admin_ref_id
69 );
70 }
global $DIC
Definition: feed.php:28

References $DIC.

Referenced by isByPassAllowedForCurrentUser().

+ Here is the caller graph for this function:

◆ determineFileAdminRefId()

ilFileServicesSettings::determineFileAdminRefId ( )
private

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

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

Referenced by __construct().

+ Here is the caller graph for this function:

◆ getBlackListedSuffixes()

ilFileServicesSettings::getBlackListedSuffixes ( )

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

138 : array
139 {
141 }

References $black_list_overall.

Referenced by ilFileServicesPreProcessor\__construct().

+ Here is the caller graph for this function:

◆ getCleaner()

ilFileServicesSettings::getCleaner ( )
private

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

126 : Closure
127 {
128 return function (string $suffix): string {
129 return trim(strtolower($suffix));
130 };
131 }

Referenced by readBlackList(), and readWhiteList().

+ Here is the caller graph for this function:

◆ getDefaultWhitelist()

ilFileServicesSettings::getDefaultWhitelist ( )

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

References $white_list_default.

◆ getProhibited()

ilFileServicesSettings::getProhibited ( )

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

170 : array
171 {
173 }

References $black_list_prohibited.

◆ getWhiteListedSuffixes()

ilFileServicesSettings::getWhiteListedSuffixes ( )

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

133 : array
134 {
136 }

References $white_list_overall.

◆ getWhiteListNegative()

ilFileServicesSettings::getWhiteListNegative ( )

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

154 : array
155 {
157 }

References $white_list_negative.

◆ getWhiteListPositive()

ilFileServicesSettings::getWhiteListPositive ( )

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

162 : array
163 {
165 }

References $white_list_positive.

◆ isASCIIConvertionEnabled()

ilFileServicesSettings::isASCIIConvertionEnabled ( )

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

86 : bool
87 {
89 }

References $convert_to_ascii.

◆ isByPassAllowedForCurrentUser()

ilFileServicesSettings::isByPassAllowedForCurrentUser ( )

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

72 : bool
73 {
74 if ($this->bypass !== null) {
75 return $this->bypass;
76 }
77 return $this->bypass = $this->determineByPass();
78 }

References $bypass, and determineByPass().

+ Here is the call graph for this function:

◆ read()

ilFileServicesSettings::read ( )
private

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

References readBlackList(), and readWhiteList().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readBlackList()

ilFileServicesSettings::readBlackList ( )
private

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

113 : void
114 {
115 $cleaner = $this->getCleaner();
116
117 $this->black_list_prohibited = array_map(
118 $cleaner,
119 explode(",", $this->settings->get("suffix_custom_expl_black") ?? '')
120 );
121
122 $this->black_list_prohibited = array_filter($this->black_list_prohibited, fn ($item): bool => $item !== '');
123 $this->black_list_overall = $this->black_list_prohibited;
124 }

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

Referenced by read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readWhiteList()

ilFileServicesSettings::readWhiteList ( )
private

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

91 : void
92 {
93 $cleaner = $this->getCleaner();
94
95 $this->white_list_negative = array_map(
96 $cleaner,
97 explode(",", $this->settings->get("suffix_repl_additional") ?? '')
98 );
99
100 $this->white_list_positive = array_map(
101 $cleaner,
102 explode(",", $this->settings->get("suffix_custom_white_list") ?? '')
103 );
104
105 $this->white_list_overall = array_merge($this->white_list_default, $this->white_list_positive);
106 $this->white_list_overall = array_diff($this->white_list_overall, $this->white_list_negative);
107 $this->white_list_overall = array_diff($this->white_list_overall, $this->black_list_overall);
108 $this->white_list_overall[] = '';
109 $this->white_list_overall = array_unique($this->white_list_overall);
110 $this->white_list_overall = array_diff($this->white_list_overall, $this->black_list_prohibited);
111 }

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

Referenced by read().

+ 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().

◆ $db

ilDBInterface ilFileServicesSettings::$db
private

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

Referenced by __construct().

◆ $file_admin_ref_id

int ilFileServicesSettings::$file_admin_ref_id
protected

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

◆ $settings

ilSetting ilFileServicesSettings::$settings
private

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

Referenced by __construct().

◆ $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: