ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilRegistrationSettings Class Reference

Class ilObjAuthSettingsGUI. More...

+ Collaboration diagram for ilRegistrationSettings:

Public Member Functions

 __construct (?ilSetting $settings=null)
 
 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 ( ?ilSetting  $settings = null)

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

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

58  {
59  global $DIC;
60 
61  if (null == $settings) {
62  $settings = $DIC->settings();
63  }
64 
65  $this->settings = $settings;
66  $this->read();
67  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ _lookupRegistrationType()

static ilRegistrationSettings::_lookupRegistrationType ( )
static

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

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

Referenced by ilStartUpGUI\showRegistrationLinks().

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

◆ activationEnabled()

ilRegistrationSettings::activationEnabled ( )

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

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

◆ approveEnabled()

ilRegistrationSettings::approveEnabled ( )

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

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

◆ automaticRoleAssignmentEnabled()

ilRegistrationSettings::automaticRoleAssignmentEnabled ( )

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

171  : bool
172  {
173  return $this->role_type === self::IL_REG_ROLES_EMAIL;
174  }

◆ directEnabled()

ilRegistrationSettings::directEnabled ( )

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

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

◆ enabled()

ilRegistrationSettings::enabled ( )

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

93  : bool
94  {
95  return $this->registration_type !== self::IL_REG_DISABLED;
96  }

◆ getAccessLimitation()

ilRegistrationSettings::getAccessLimitation ( )

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

References $access_limitation.

128  : bool
129  {
131  }

◆ getAllowCodes()

ilRegistrationSettings::getAllowCodes ( )

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

References $reg_allow_codes.

199  : bool
200  {
201  return $this->reg_allow_codes;
202  }

◆ getAllowedDomains()

ilRegistrationSettings::getAllowedDomains ( )

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

References $allowed_domains.

216  : array
217  {
218  return $this->allowed_domains;
219  }

◆ getApproveRecipientLogins()

ilRegistrationSettings::getApproveRecipientLogins ( )

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

References $approve_recipient_logins.

Referenced by validate().

151  : string
152  {
154  }
+ Here is the caller graph for this function:

◆ getApproveRecipients()

ilRegistrationSettings::getApproveRecipients ( )

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

References $approve_recipient_ids.

156  : array
157  {
159  }

◆ getRegistrationHashLifetime()

ilRegistrationSettings::getRegistrationHashLifetime ( )

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

187  : int
188  {
189  return max($this->reg_hash_life_time, self::REG_HASH_LIFETIME_MIN_VALUE);
190  }

◆ getRegistrationType()

ilRegistrationSettings::getRegistrationType ( )

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

References $registration_type.

Referenced by validate().

69  : int
70  {
72  }
+ Here is the caller graph for this function:

◆ getUnknown()

ilRegistrationSettings::getUnknown ( )

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

161  : string
162  {
163  return implode(',', $this->unknown);
164  }

◆ passwordGenerationEnabled()

ilRegistrationSettings::passwordGenerationEnabled ( )

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

References $password_generation_enabled.

Referenced by ilUserProfile\addFieldToForm(), and ilUserProfile\getPasswordInput().

118  : bool
119  {
121  }
+ Here is the caller graph for this function:

◆ read()

ilRegistrationSettings::read ( )
private

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

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

Referenced by __construct().

260  : void
261  {
262  //static method validates value
263  $this->registration_type = self::_lookupRegistrationType();
264 
265  $this->role_type = (int) $this->settings->get('reg_role_assignment', '1');
266  $this->password_generation_enabled = (bool) $this->settings->get('passwd_reg_auto_generate');
267  $this->access_limitation = (bool) $this->settings->get('reg_access_limitation');
268  $this->reg_hash_life_time = (int) $this->settings->get('reg_hash_life_time');
269  $this->reg_allow_codes = (bool) $this->settings->get('reg_allow_codes');
270 
271  $this->approve_recipient_ids = unserialize(
272  stripslashes($this->settings->get('approve_recipient', serialize([]))),
273  ['allowed_classes' => false]
274  ) ?: [];
275 
276  // create login array
277  $tmp_logins = [];
278  foreach ($this->approve_recipient_ids as $id) {
279  if ($login = ilObjUser::_lookupLogin((int) $id)) {
280  $tmp_logins[] = $login;
281  }
282  }
283  $this->approve_recipient_logins = implode(',', $tmp_logins);
284  $this->setAllowedDomains((string) $this->settings->get('reg_allowed_domains'));
285  }
$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 113 of file class.ilRegistrationSettings.php.

113  : bool
114  {
115  return $this->registration_type === self::IL_REG_CODES;
116  }

◆ roleSelectionEnabled()

ilRegistrationSettings::roleSelectionEnabled ( )

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

Referenced by ilUserProfile\getRolesInput().

166  : bool
167  {
168  return $this->role_type === self::IL_REG_ROLES_FIXED;
169  }
+ Here is the caller graph for this function:

◆ save()

ilRegistrationSettings::save ( )

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

References ILIAS\Repository\settings().

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

◆ setAccessLimitation()

ilRegistrationSettings::setAccessLimitation ( bool  $a_access_limitation)

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

133  : void
134  {
135  $this->access_limitation = $a_access_limitation;
136  }

◆ setAllowCodes()

ilRegistrationSettings::setAllowCodes ( bool  $a_allow_codes)

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

192  : self
193  {
194  $this->reg_allow_codes = $a_allow_codes;
195 
196  return $this;
197  }

◆ setAllowedDomains()

ilRegistrationSettings::setAllowedDomains ( string  $a_value)

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

Referenced by read().

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

◆ setApproveRecipientLogins()

ilRegistrationSettings::setApproveRecipientLogins ( string  $a_rec_string)

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

References ilObjUser\_lookupId().

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

◆ setPasswordGenerationStatus()

ilRegistrationSettings::setPasswordGenerationStatus ( bool  $a_status)

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

123  : void
124  {
125  $this->password_generation_enabled = $a_status;
126  }

◆ setRegistrationHashLifetime()

ilRegistrationSettings::setRegistrationHashLifetime ( int  $a_lifetime)

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

181  : self
182  {
183  $this->reg_hash_life_time = $a_lifetime;
184  return $this;
185  }

◆ setRegistrationType()

ilRegistrationSettings::setRegistrationType ( int  $a_type)

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

74  : void
75  {
76  $this->registration_type = $a_type;
77  }

◆ setRoleType()

ilRegistrationSettings::setRoleType ( int  $a_type)

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

176  : void
177  {
178  $this->role_type = $a_type;
179  }

◆ validate()

ilRegistrationSettings::validate ( )

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

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

221  : int
222  {
223  $this->unknown = [];
224 
225  $login_arr = explode(',', $this->getApproveRecipientLogins());
226  $login_arr = $login_arr ?: [];
227  $valid = [];
228  foreach ($login_arr as $recipient) {
229  if (!$recipient = trim($recipient)) {
230  continue;
231  }
232  if (!ilObjUser::_lookupId($recipient)) {
233  $this->unknown[] = $recipient;
234  } else {
235  $valid[] = $recipient;
236  }
237  }
238  if (count($this->unknown)) {
239  return self::ERR_UNKNOWN_RCP;
240  }
241  if ($this->getRegistrationType() === self::IL_REG_APPROVE && !count($valid)) {
242  return self::ERR_MISSING_RCP;
243  }
244  return 0;
245  }
$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.

Referenced by __construct().

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


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