ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilRegistrationSettings Class Reference

Class ilObjAuthSettingsGUI. More...

+ Collaboration diagram for ilRegistrationSettings:

Public Member Functions

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

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
 

Private Attributes

 $registration_type
 
 $password_generation_enabled
 
 $access_limitation
 
 $approve_recipient_logins
 
 $approve_recipient_ids
 
 $role_type
 
 $unknown
 
 $reg_hash_life_time = 0
 
 $reg_allow_codes = false
 
 $allowed_domains
 

Detailed Description

Class ilObjAuthSettingsGUI.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilRegistrationSettings::__construct ( )

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

References __read().

64  {
65  $this->__read();
66  }
+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilRegistrationSettings::__read ( )

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

References $DIC, $id, $login, ilObjUser\_lookupLogin(), and setAllowedDomains().

Referenced by __construct().

253  {
254  global $DIC;
255 
256  $ilias = $DIC['ilias'];
257 
258  //static method validates value
259  $this->registration_type = self::_lookupRegistrationType();
260 
261  $this->role_type = $ilias->getSetting('reg_role_assignment', 1);
262  $this->password_generation_enabled = $ilias->getSetting('passwd_reg_auto_generate');
263  $this->access_limitation = $ilias->getSetting('reg_access_limitation');
264  $this->reg_hash_life_time = $ilias->getSetting('reg_hash_life_time');
265  $this->reg_allow_codes = (bool) $ilias->getSetting('reg_allow_codes');
266 
267  $this->approve_recipient_ids = unserialize(stripslashes($ilias->getSetting('approve_recipient')));
268  $this->approve_recipient_ids = $this->approve_recipient_ids ?
269  $this->approve_recipient_ids :
270  array();
271 
272  // create login array
273  $tmp_logins = array();
274  foreach ($this->approve_recipient_ids as $id) {
275  if ($login = ilObjUser::_lookupLogin($id)) {
276  $tmp_logins[] = $login;
277  }
278  }
279  $this->approve_recipient_logins = implode(',', $tmp_logins);
280 
281  $this->setAllowedDomains($ilias->getSetting('reg_allowed_domains'));
282  }
static _lookupLogin($a_user_id)
lookup login
global $DIC
Definition: saml.php:7
if(!array_key_exists('StateId', $_REQUEST)) $id
$login
Definition: cron.php:13
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupRegistrationType()

static ilRegistrationSettings::_lookupRegistrationType ( )
static

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

References $DIC, $ilSetting, $ret, and IL_REG_DISABLED.

Referenced by ilMainMenuGUI\setTemplateVars(), and ilStartUpGUI\showRegistrationLinks().

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

◆ activationEnabled()

ilRegistrationSettings::activationEnabled ( )

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

References IL_REG_ACTIVATION.

106  {
107  return $this->registration_type == IL_REG_ACTIVATION;
108  }
const IL_REG_ACTIVATION

◆ approveEnabled()

ilRegistrationSettings::approveEnabled ( )

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

References IL_REG_APPROVE.

102  {
103  return $this->registration_type == IL_REG_APPROVE;
104  }

◆ automaticRoleAssignmentEnabled()

ilRegistrationSettings::automaticRoleAssignmentEnabled ( )

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

References IL_REG_ROLES_EMAIL.

163  {
164  return $this->role_type == IL_REG_ROLES_EMAIL;
165  }
const IL_REG_ROLES_EMAIL

◆ directEnabled()

ilRegistrationSettings::directEnabled ( )

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

References IL_REG_DIRECT.

98  {
99  return $this->registration_type == IL_REG_DIRECT;
100  }

◆ enabled()

ilRegistrationSettings::enabled ( )

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

References IL_REG_DISABLED.

94  {
95  return $this->registration_type != IL_REG_DISABLED;
96  }

◆ getAccessLimitation()

ilRegistrationSettings::getAccessLimitation ( )

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

References $access_limitation.

◆ getAllowCodes()

ilRegistrationSettings::getAllowCodes ( )

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

References $reg_allow_codes.

◆ getAllowedDomains()

ilRegistrationSettings::getAllowedDomains ( )

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

References $allowed_domains.

202  {
203  return (array) $this->allowed_domains;
204  }

◆ getApproveRecipientLogins()

ilRegistrationSettings::getApproveRecipientLogins ( )

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

References $approve_recipient_logins.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getApproveRecipients()

ilRegistrationSettings::getApproveRecipients ( )

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

150  {
151  return $this->approve_recipient_ids ? $this->approve_recipient_ids : array();
152  }

◆ getRegistrationHashLifetime()

ilRegistrationSettings::getRegistrationHashLifetime ( )

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

179  {
180  return max($this->reg_hash_life_time, self::REG_HASH_LIFETIME_MIN_VALUE);
181  }

◆ getRegistrationType()

ilRegistrationSettings::getRegistrationType ( )

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

References $registration_type.

Referenced by validate().

+ Here is the caller graph for this function:

◆ getUnknown()

ilRegistrationSettings::getUnknown ( )

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

154  {
155  return implode(',', $this->unknown);
156  }

◆ passwordGenerationEnabled()

ilRegistrationSettings::passwordGenerationEnabled ( )

◆ registrationCodeRequired()

ilRegistrationSettings::registrationCodeRequired ( )

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

References IL_REG_CODES.

110  {
111  return $this->registration_type == IL_REG_CODES;
112  }

◆ roleSelectionEnabled()

ilRegistrationSettings::roleSelectionEnabled ( )

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

References IL_REG_ROLES_FIXED.

159  {
160  return $this->role_type == IL_REG_ROLES_FIXED;
161  }
const IL_REG_ROLES_FIXED

◆ save()

ilRegistrationSettings::save ( )

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

References $DIC.

235  {
236  global $DIC;
237 
238  $ilias = $DIC['ilias'];
239 
240  $ilias->setSetting('reg_role_assignment', $this->role_type);
241  $ilias->setSetting('new_registration_type', $this->registration_type);
242  $ilias->setSetting('passwd_reg_auto_generate', $this->password_generation_enabled);
243  $ilias->setSetting('approve_recipient', addslashes(serialize($this->approve_recipient_ids)));
244  $ilias->setSetting('reg_access_limitation', $this->access_limitation);
245  $ilias->setSetting('reg_hash_life_time', $this->reg_hash_life_time);
246  $ilias->setSetting('reg_allow_codes', $this->reg_allow_codes);
247  $ilias->setSetting('reg_allowed_domains', implode(';', $this->allowed_domains));
248 
249  return true;
250  }
global $DIC
Definition: saml.php:7

◆ setAccessLimitation()

ilRegistrationSettings::setAccessLimitation (   $a_access_limitation)

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

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

◆ setAllowCodes()

ilRegistrationSettings::setAllowCodes (   $a_allow_codes)

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

184  {
185  $this->reg_allow_codes = (bool) $a_allow_codes;
186 
187  return $this;
188  }

◆ setAllowedDomains()

ilRegistrationSettings::setAllowedDomains (   $a_value)

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

Referenced by __read().

196  {
197  $a_value = explode(";", trim($a_value));
198  $this->allowed_domains = $a_value;
199  }
+ Here is the caller graph for this function:

◆ setApproveRecipientLogins()

ilRegistrationSettings::setApproveRecipientLogins (   $a_rec_string)

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

References $login, and ilObjUser\_lookupId().

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

◆ setPasswordGenerationStatus()

ilRegistrationSettings::setPasswordGenerationStatus (   $a_status)

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

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

◆ setRegistrationHashLifetime()

ilRegistrationSettings::setRegistrationHashLifetime (   $a_lifetime)

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

172  {
173  $this->reg_hash_life_time = $a_lifetime;
174 
175  return $this;
176  }

◆ setRegistrationType()

ilRegistrationSettings::setRegistrationType (   $a_type)

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

References $a_type.

73  {
74  $this->registration_type = $a_type;
75  }
$a_type
Definition: workflow.php:92

◆ setRoleType()

ilRegistrationSettings::setRoleType (   $a_type)

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

References $a_type.

167  {
168  $this->role_type = $a_type;
169  }
$a_type
Definition: workflow.php:92

◆ validate()

ilRegistrationSettings::validate ( )

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

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

207  {
208  $this->unknown = array();
209  $this->mail_perm = array();
210 
211  $login_arr = explode(',', $this->getApproveRecipientLogins());
212  $login_arr = $login_arr ? $login_arr : array();
213  foreach ($login_arr as $recipient) {
214  if (!$recipient = trim($recipient)) {
215  continue;
216  }
217  if (!ilObjUser::_lookupId($recipient)) {
218  $this->unknown[] = $recipient;
219  continue;
220  } else {
221  $valid = $recipient;
222  }
223  }
224  if (count($this->unknown)) {
225  return self::ERR_UNKNOWN_RCP;
226  }
227  if ($this->getRegistrationType() == IL_REG_APPROVE and !count((array) $valid)) {
228  return self::ERR_MISSING_RCP;
229  }
230  return 0;
231  }
$valid
static _lookupId($a_user_str)
Lookup id by login.
+ Here is the call graph for this function:

Field Documentation

◆ $access_limitation

ilRegistrationSettings::$access_limitation
private

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

Referenced by getAccessLimitation().

◆ $allowed_domains

ilRegistrationSettings::$allowed_domains
private

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

Referenced by getAllowedDomains().

◆ $approve_recipient_ids

ilRegistrationSettings::$approve_recipient_ids
private

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

◆ $approve_recipient_logins

ilRegistrationSettings::$approve_recipient_logins
private

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

Referenced by getApproveRecipientLogins().

◆ $password_generation_enabled

ilRegistrationSettings::$password_generation_enabled
private

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

Referenced by passwordGenerationEnabled().

◆ $reg_allow_codes

ilRegistrationSettings::$reg_allow_codes = false
private

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

Referenced by getAllowCodes().

◆ $reg_hash_life_time

ilRegistrationSettings::$reg_hash_life_time = 0
private

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

◆ $registration_type

ilRegistrationSettings::$registration_type
private

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

Referenced by getRegistrationType().

◆ $role_type

ilRegistrationSettings::$role_type
private

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

◆ $unknown

ilRegistrationSettings::$unknown
private

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

◆ ERR_MISSING_RCP

const ilRegistrationSettings::ERR_MISSING_RCP = 2

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

Referenced by ilRegistrationSettingsGUI\save().

◆ ERR_UNKNOWN_RCP

const ilRegistrationSettings::ERR_UNKNOWN_RCP = 1

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

Referenced by ilRegistrationSettingsGUI\save().

◆ REG_HASH_LIFETIME_MIN_VALUE

const ilRegistrationSettings::REG_HASH_LIFETIME_MIN_VALUE = 60

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