ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilRegistrationSettings Class Reference

Class ilObjAuthSettingsGUI. More...

+ Collaboration diagram for ilRegistrationSettings:

Public Member Functions

 __construct ()
 
 getRegistrationType ()
 
 setRegistrationType (int $a_type)
 
 enabled ()
 
 directEnabled ()
 
 approveEnabled ()
 
 activationEnabled ()
 
 registrationCodeRequired ()
 
 passwordGenerationEnabled ()
 
 setPasswordGenerationStatus (bool $a_status)
 
 getAccessLimitation ()
 
 setAccessLimitation (bool $a_access_limitation)
 
 setApproveRecipientLogins (string $a_rec_string)
 
 getApproveRecipientLogins ()
 
 getApproveRecipients ()
 
 getUnknown ()
 
 roleSelectionEnabled ()
 
 automaticRoleAssignmentEnabled ()
 
 setRoleType (int $a_type)
 
 setRegistrationHashLifetime (int $a_lifetime)
 
 getRegistrationHashLifetime ()
 
 setAllowCodes (bool $a_allow_codes)
 
 getAllowCodes ()
 
 setAllowedDomains (string $a_value)
 
 getAllowedDomains ()
 
 validate ()
 
 save ()
 

Static Public Member Functions

static _lookupRegistrationType ()
 

Data Fields

const ERR_UNKNOWN_RCP = 1
 
const ERR_MISSING_RCP = 2
 
const REG_HASH_LIFETIME_MIN_VALUE = 60
 
const IL_REG_DISABLED = 1
 
const IL_REG_DIRECT = 2
 
const IL_REG_APPROVE = 3
 
const IL_REG_ACTIVATION = 4
 
const IL_REG_CODES = 5
 
const IL_REG_ROLE_UNDEFINED = 0
 
const IL_REG_ROLES_FIXED = 1
 
const IL_REG_ROLES_EMAIL = 2
 
const IL_REG_ERROR_UNKNOWN = 1
 
const IL_REG_ERROR_NO_PERM = 2
 

Protected Attributes

ilSetting $settings
 

Private Member Functions

 read ()
 

Private Attributes

int $registration_type
 
bool $password_generation_enabled = false
 
bool $access_limitation = false
 
string $approve_recipient_logins = ''
 
array $approve_recipient_ids = []
 
int $role_type = self::IL_REG_ROLE_UNDEFINED
 
array $unknown = []
 
int $reg_hash_life_time = 0
 
bool $reg_allow_codes = false
 
array $allowed_domains = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilRegistrationSettings::__construct ( )

Definition at line 57 of file class.ilRegistrationSettings.php.

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

58  {
59  global $DIC;
60 
61  $this->settings = $DIC->settings();
62  $this->read();
63  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ _lookupRegistrationType()

static ilRegistrationSettings::_lookupRegistrationType ( )
static

Definition at line 75 of file class.ilRegistrationSettings.php.

References $DIC, $ilSetting, and ILIAS\Repository\int().

Referenced by ilStartUpGUI\showRegistrationLinks().

75  : int
76  {
77  global $DIC;
78 
79  $ilSetting = $DIC['ilSetting'];
80  $ret = (int) $ilSetting->get('new_registration_type', (string) self::IL_REG_DISABLED);
81 
82  if ($ret < 1 || $ret > 5) {
83  //data is corrupted and should be processed like "No Registration possible" (#18261)
84  $ret = self::IL_REG_DISABLED;
85  }
86  return $ret;
87  }
global $DIC
Definition: feed.php:28
global $ilSetting
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ activationEnabled()

ilRegistrationSettings::activationEnabled ( )

Definition at line 104 of file class.ilRegistrationSettings.php.

104  : bool
105  {
106  return $this->registration_type === self::IL_REG_ACTIVATION;
107  }

◆ approveEnabled()

ilRegistrationSettings::approveEnabled ( )

Definition at line 99 of file class.ilRegistrationSettings.php.

99  : bool
100  {
101  return $this->registration_type === self::IL_REG_APPROVE;
102  }

◆ automaticRoleAssignmentEnabled()

ilRegistrationSettings::automaticRoleAssignmentEnabled ( )

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

167  : bool
168  {
169  return $this->role_type === self::IL_REG_ROLES_EMAIL;
170  }

◆ directEnabled()

ilRegistrationSettings::directEnabled ( )

Definition at line 94 of file class.ilRegistrationSettings.php.

94  : bool
95  {
96  return $this->registration_type === self::IL_REG_DIRECT;
97  }

◆ enabled()

ilRegistrationSettings::enabled ( )

Definition at line 89 of file class.ilRegistrationSettings.php.

89  : bool
90  {
91  return $this->registration_type !== self::IL_REG_DISABLED;
92  }

◆ getAccessLimitation()

ilRegistrationSettings::getAccessLimitation ( )

Definition at line 124 of file class.ilRegistrationSettings.php.

References $access_limitation.

124  : bool
125  {
127  }

◆ getAllowCodes()

ilRegistrationSettings::getAllowCodes ( )

Definition at line 195 of file class.ilRegistrationSettings.php.

References $reg_allow_codes.

195  : bool
196  {
197  return $this->reg_allow_codes;
198  }

◆ getAllowedDomains()

ilRegistrationSettings::getAllowedDomains ( )

Definition at line 212 of file class.ilRegistrationSettings.php.

References $allowed_domains.

212  : array
213  {
214  return $this->allowed_domains;
215  }

◆ getApproveRecipientLogins()

ilRegistrationSettings::getApproveRecipientLogins ( )

Definition at line 147 of file class.ilRegistrationSettings.php.

References $approve_recipient_logins.

Referenced by validate().

147  : string
148  {
150  }
+ Here is the caller graph for this function:

◆ getApproveRecipients()

ilRegistrationSettings::getApproveRecipients ( )

Definition at line 152 of file class.ilRegistrationSettings.php.

References $approve_recipient_ids.

152  : array
153  {
155  }

◆ getRegistrationHashLifetime()

ilRegistrationSettings::getRegistrationHashLifetime ( )

Definition at line 183 of file class.ilRegistrationSettings.php.

183  : int
184  {
185  return max($this->reg_hash_life_time, self::REG_HASH_LIFETIME_MIN_VALUE);
186  }

◆ getRegistrationType()

ilRegistrationSettings::getRegistrationType ( )

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

References $registration_type.

Referenced by validate().

65  : int
66  {
68  }
+ Here is the caller graph for this function:

◆ getUnknown()

ilRegistrationSettings::getUnknown ( )

Definition at line 157 of file class.ilRegistrationSettings.php.

157  : string
158  {
159  return implode(',', $this->unknown);
160  }

◆ passwordGenerationEnabled()

ilRegistrationSettings::passwordGenerationEnabled ( )

Definition at line 114 of file class.ilRegistrationSettings.php.

References $password_generation_enabled.

114  : bool
115  {
117  }

◆ read()

ilRegistrationSettings::read ( )
private

Definition at line 256 of file class.ilRegistrationSettings.php.

References $id, ilObjUser\_lookupLogin(), ILIAS\Repository\int(), setAllowedDomains(), and ILIAS\Repository\settings().

Referenced by __construct().

256  : void
257  {
258  //static method validates value
259  $this->registration_type = self::_lookupRegistrationType();
260 
261  $this->role_type = (int) $this->settings->get('reg_role_assignment', '1');
262  $this->password_generation_enabled = (bool) $this->settings->get('passwd_reg_auto_generate');
263  $this->access_limitation = (bool) $this->settings->get('reg_access_limitation');
264  $this->reg_hash_life_time = (int) $this->settings->get('reg_hash_life_time');
265  $this->reg_allow_codes = (bool) $this->settings->get('reg_allow_codes');
266 
267  $this->approve_recipient_ids = unserialize(
268  stripslashes($this->settings->get('approve_recipient', "")),
269  ['allowed_classes' => false]
270  ) ?: [];
271 
272  // create login array
273  $tmp_logins = [];
274  foreach ($this->approve_recipient_ids as $id) {
275  if ($login = ilObjUser::_lookupLogin((int) $id)) {
276  $tmp_logins[] = $login;
277  }
278  }
279  $this->approve_recipient_logins = implode(',', $tmp_logins);
280  $this->setAllowedDomains((string) $this->settings->get('reg_allowed_domains'));
281  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static _lookupLogin(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ registrationCodeRequired()

ilRegistrationSettings::registrationCodeRequired ( )

Definition at line 109 of file class.ilRegistrationSettings.php.

109  : bool
110  {
111  return $this->registration_type === self::IL_REG_CODES;
112  }

◆ roleSelectionEnabled()

ilRegistrationSettings::roleSelectionEnabled ( )

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

162  : bool
163  {
164  return $this->role_type === self::IL_REG_ROLES_FIXED;
165  }

◆ save()

ilRegistrationSettings::save ( )

Definition at line 243 of file class.ilRegistrationSettings.php.

References ILIAS\Repository\settings().

243  : bool
244  {
245  $this->settings->set('reg_role_assignment', (string) $this->role_type);
246  $this->settings->set('new_registration_type', (string) $this->registration_type);
247  $this->settings->set('passwd_reg_auto_generate', (string) $this->password_generation_enabled);
248  $this->settings->set('approve_recipient', addslashes(serialize($this->approve_recipient_ids)));
249  $this->settings->set('reg_access_limitation', (string) $this->access_limitation);
250  $this->settings->set('reg_hash_life_time', (string) $this->reg_hash_life_time);
251  $this->settings->set('reg_allow_codes', (string) $this->reg_allow_codes);
252  $this->settings->set('reg_allowed_domains', implode(';', $this->allowed_domains));
253  return true;
254  }
+ Here is the call graph for this function:

◆ setAccessLimitation()

ilRegistrationSettings::setAccessLimitation ( bool  $a_access_limitation)

Definition at line 129 of file class.ilRegistrationSettings.php.

129  : void
130  {
131  $this->access_limitation = $a_access_limitation;
132  }

◆ setAllowCodes()

ilRegistrationSettings::setAllowCodes ( bool  $a_allow_codes)

Definition at line 188 of file class.ilRegistrationSettings.php.

188  : self
189  {
190  $this->reg_allow_codes = $a_allow_codes;
191 
192  return $this;
193  }

◆ setAllowedDomains()

ilRegistrationSettings::setAllowedDomains ( string  $a_value)

Definition at line 200 of file class.ilRegistrationSettings.php.

Referenced by read().

200  : void
201  {
202  $a_value = array_map(
203  static function (string $value): string {
204  return trim($value);
205  },
206  explode(";", trim($a_value))
207  );
208 
209  $this->allowed_domains = $a_value;
210  }
+ Here is the caller graph for this function:

◆ setApproveRecipientLogins()

ilRegistrationSettings::setApproveRecipientLogins ( string  $a_rec_string)

Definition at line 134 of file class.ilRegistrationSettings.php.

References ilObjUser\_lookupId().

134  : void
135  {
136  $this->approve_recipient_logins = $a_rec_string;
137  $this->approve_recipient_ids = [];
138 
139  // convert logins to array of ids
140  foreach (explode(',', trim($this->approve_recipient_logins)) as $login) {
141  if ($uid = ilObjUser::_lookupId(trim($login))) {
142  $this->approve_recipient_ids[] = $uid;
143  }
144  }
145  }
static _lookupId($a_user_str)
+ Here is the call graph for this function:

◆ setPasswordGenerationStatus()

ilRegistrationSettings::setPasswordGenerationStatus ( bool  $a_status)

Definition at line 119 of file class.ilRegistrationSettings.php.

119  : void
120  {
121  $this->password_generation_enabled = $a_status;
122  }

◆ setRegistrationHashLifetime()

ilRegistrationSettings::setRegistrationHashLifetime ( int  $a_lifetime)

Definition at line 177 of file class.ilRegistrationSettings.php.

177  : self
178  {
179  $this->reg_hash_life_time = $a_lifetime;
180  return $this;
181  }

◆ setRegistrationType()

ilRegistrationSettings::setRegistrationType ( int  $a_type)

Definition at line 70 of file class.ilRegistrationSettings.php.

70  : void
71  {
72  $this->registration_type = $a_type;
73  }

◆ setRoleType()

ilRegistrationSettings::setRoleType ( int  $a_type)

Definition at line 172 of file class.ilRegistrationSettings.php.

172  : void
173  {
174  $this->role_type = $a_type;
175  }

◆ validate()

ilRegistrationSettings::validate ( )

Definition at line 217 of file class.ilRegistrationSettings.php.

References $valid, ilObjUser\_lookupId(), getApproveRecipientLogins(), and getRegistrationType().

217  : int
218  {
219  $this->unknown = [];
220 
221  $login_arr = explode(',', $this->getApproveRecipientLogins());
222  $login_arr = $login_arr ?: [];
223  $valid = [];
224  foreach ($login_arr as $recipient) {
225  if (!$recipient = trim($recipient)) {
226  continue;
227  }
228  if (!ilObjUser::_lookupId($recipient)) {
229  $this->unknown[] = $recipient;
230  } else {
231  $valid[] = $recipient;
232  }
233  }
234  if (count($this->unknown)) {
235  return self::ERR_UNKNOWN_RCP;
236  }
237  if ($this->getRegistrationType() === self::IL_REG_APPROVE && !count($valid)) {
238  return self::ERR_MISSING_RCP;
239  }
240  return 0;
241  }
$valid
static _lookupId($a_user_str)
+ Here is the call graph for this function:

Field Documentation

◆ $access_limitation

bool ilRegistrationSettings::$access_limitation = false
private

Definition at line 46 of file class.ilRegistrationSettings.php.

Referenced by getAccessLimitation().

◆ $allowed_domains

array ilRegistrationSettings::$allowed_domains = []
private

Definition at line 53 of file class.ilRegistrationSettings.php.

Referenced by getAllowedDomains().

◆ $approve_recipient_ids

array ilRegistrationSettings::$approve_recipient_ids = []
private

Definition at line 48 of file class.ilRegistrationSettings.php.

Referenced by getApproveRecipients().

◆ $approve_recipient_logins

string ilRegistrationSettings::$approve_recipient_logins = ''
private

Definition at line 47 of file class.ilRegistrationSettings.php.

Referenced by getApproveRecipientLogins().

◆ $password_generation_enabled

bool ilRegistrationSettings::$password_generation_enabled = false
private

Definition at line 45 of file class.ilRegistrationSettings.php.

Referenced by passwordGenerationEnabled().

◆ $reg_allow_codes

bool ilRegistrationSettings::$reg_allow_codes = false
private

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

Referenced by getAllowCodes().

◆ $reg_hash_life_time

int ilRegistrationSettings::$reg_hash_life_time = 0
private

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

◆ $registration_type

int ilRegistrationSettings::$registration_type
private

Definition at line 44 of file class.ilRegistrationSettings.php.

Referenced by getRegistrationType().

◆ $role_type

int ilRegistrationSettings::$role_type = self::IL_REG_ROLE_UNDEFINED
private

Definition at line 49 of file class.ilRegistrationSettings.php.

◆ $settings

ilSetting ilRegistrationSettings::$settings
protected

Definition at line 55 of file class.ilRegistrationSettings.php.

◆ $unknown

array ilRegistrationSettings::$unknown = []
private

Definition at line 50 of file class.ilRegistrationSettings.php.

◆ ERR_MISSING_RCP

const ilRegistrationSettings::ERR_MISSING_RCP = 2

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

Referenced by ilRegistrationSettingsGUI\save().

◆ ERR_UNKNOWN_RCP

const ilRegistrationSettings::ERR_UNKNOWN_RCP = 1

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

Referenced by ilRegistrationSettingsGUI\save().

◆ IL_REG_ACTIVATION

◆ IL_REG_APPROVE

◆ IL_REG_CODES

const ilRegistrationSettings::IL_REG_CODES = 5

◆ IL_REG_DIRECT

◆ IL_REG_DISABLED

◆ IL_REG_ERROR_NO_PERM

const ilRegistrationSettings::IL_REG_ERROR_NO_PERM = 2

Definition at line 42 of file class.ilRegistrationSettings.php.

◆ IL_REG_ERROR_UNKNOWN

const ilRegistrationSettings::IL_REG_ERROR_UNKNOWN = 1

Definition at line 41 of file class.ilRegistrationSettings.php.

◆ IL_REG_ROLE_UNDEFINED

const ilRegistrationSettings::IL_REG_ROLE_UNDEFINED = 0

◆ IL_REG_ROLES_EMAIL

const ilRegistrationSettings::IL_REG_ROLES_EMAIL = 2

◆ IL_REG_ROLES_FIXED

const ilRegistrationSettings::IL_REG_ROLES_FIXED = 1

◆ REG_HASH_LIFETIME_MIN_VALUE

const ilRegistrationSettings::REG_HASH_LIFETIME_MIN_VALUE = 60

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