ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 248 of file class.ilRegistrationSettings.php.

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

Referenced by __construct().

249  {
250  global $ilias;
251 
252  //static method validates value
253  $this->registration_type = self::_lookupRegistrationType();
254 
255  $this->role_type = $ilias->getSetting('reg_role_assignment', 1);
256  $this->password_generation_enabled = $ilias->getSetting('passwd_reg_auto_generate');
257  $this->access_limitation = $ilias->getSetting('reg_access_limitation');
258  $this->reg_hash_life_time = $ilias->getSetting('reg_hash_life_time');
259  $this->reg_allow_codes = (bool) $ilias->getSetting('reg_allow_codes');
260 
261  $this->approve_recipient_ids = unserialize(stripslashes($ilias->getSetting('approve_recipient')));
262  $this->approve_recipient_ids = $this->approve_recipient_ids ?
263  $this->approve_recipient_ids :
264  array();
265 
266  // create login array
267  $tmp_logins = array();
268  foreach ($this->approve_recipient_ids as $id) {
269  if ($login = ilObjUser::_lookupLogin($id)) {
270  $tmp_logins[] = $login;
271  }
272  }
273  $this->approve_recipient_logins = implode(',', $tmp_logins);
274 
275  $this->setAllowedDomains($ilias->getSetting('reg_allowed_domains'));
276  }
static _lookupLogin($a_user_id)
lookup login
if(!array_key_exists('StateId', $_REQUEST)) $id
Create styles array
The data for the language used.
+ 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 $ilSetting, $ret, and IL_REG_DISABLED.

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

78  {
79  global $ilSetting;
80 
81  $ret = (int) $ilSetting->get('new_registration_type', IL_REG_DISABLED);
82 
83  if ($ret < 1 or $ret > 5) {
84  //data is corrupted and should be processed like "No Registration possible" (#18261)
86  }
87 
88  return $ret;
89  }
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 103 of file class.ilRegistrationSettings.php.

References IL_REG_ACTIVATION.

104  {
105  return $this->registration_type == IL_REG_ACTIVATION;
106  }
const IL_REG_ACTIVATION

◆ approveEnabled()

ilRegistrationSettings::approveEnabled ( )

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

References IL_REG_APPROVE.

100  {
101  return $this->registration_type == IL_REG_APPROVE;
102  }

◆ automaticRoleAssignmentEnabled()

ilRegistrationSettings::automaticRoleAssignmentEnabled ( )

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

References IL_REG_ROLES_EMAIL.

161  {
162  return $this->role_type == IL_REG_ROLES_EMAIL;
163  }
const IL_REG_ROLES_EMAIL

◆ directEnabled()

ilRegistrationSettings::directEnabled ( )

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

References IL_REG_DIRECT.

96  {
97  return $this->registration_type == IL_REG_DIRECT;
98  }

◆ enabled()

ilRegistrationSettings::enabled ( )

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

References IL_REG_DISABLED.

92  {
93  return $this->registration_type != IL_REG_DISABLED;
94  }

◆ getAccessLimitation()

ilRegistrationSettings::getAccessLimitation ( )

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

References $access_limitation.

◆ getAllowCodes()

ilRegistrationSettings::getAllowCodes ( )

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

References $reg_allow_codes.

◆ getAllowedDomains()

ilRegistrationSettings::getAllowedDomains ( )

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

References $allowed_domains, and array.

200  {
201  return (array) $this->allowed_domains;
202  }
Create styles array
The data for the language used.

◆ getApproveRecipientLogins()

ilRegistrationSettings::getApproveRecipientLogins ( )

Definition at line 143 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 147 of file class.ilRegistrationSettings.php.

References array.

148  {
149  return $this->approve_recipient_ids ? $this->approve_recipient_ids : array();
150  }
Create styles array
The data for the language used.

◆ getRegistrationHashLifetime()

ilRegistrationSettings::getRegistrationHashLifetime ( )

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

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

◆ 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 151 of file class.ilRegistrationSettings.php.

152  {
153  return implode(',', $this->unknown);
154  }

◆ passwordGenerationEnabled()

ilRegistrationSettings::passwordGenerationEnabled ( )

◆ registrationCodeRequired()

ilRegistrationSettings::registrationCodeRequired ( )

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

References IL_REG_CODES.

108  {
109  return $this->registration_type == IL_REG_CODES;
110  }

◆ roleSelectionEnabled()

ilRegistrationSettings::roleSelectionEnabled ( )

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

References IL_REG_ROLES_FIXED.

157  {
158  return $this->role_type == IL_REG_ROLES_FIXED;
159  }
const IL_REG_ROLES_FIXED

◆ save()

ilRegistrationSettings::save ( )

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

233  {
234  global $ilias;
235 
236  $ilias->setSetting('reg_role_assignment', $this->role_type);
237  $ilias->setSetting('new_registration_type', $this->registration_type);
238  $ilias->setSetting('passwd_reg_auto_generate', $this->password_generation_enabled);
239  $ilias->setSetting('approve_recipient', addslashes(serialize($this->approve_recipient_ids)));
240  $ilias->setSetting('reg_access_limitation', $this->access_limitation);
241  $ilias->setSetting('reg_hash_life_time', $this->reg_hash_life_time);
242  $ilias->setSetting('reg_allow_codes', $this->reg_allow_codes);
243  $ilias->setSetting('reg_allowed_domains', implode(';', $this->allowed_domains));
244 
245  return true;
246  }

◆ setAccessLimitation()

ilRegistrationSettings::setAccessLimitation (   $a_access_limitation)

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

127  {
128  $this->access_limitation = $a_access_limitation;
129  }

◆ setAllowCodes()

ilRegistrationSettings::setAllowCodes (   $a_allow_codes)

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

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

◆ setAllowedDomains()

ilRegistrationSettings::setAllowedDomains (   $a_value)

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

Referenced by __read().

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

◆ setApproveRecipientLogins()

ilRegistrationSettings::setApproveRecipientLogins (   $a_rec_string)

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

References ilObjUser\_lookupId(), and array.

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

◆ setPasswordGenerationStatus()

ilRegistrationSettings::setPasswordGenerationStatus (   $a_status)

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

117  {
118  $this->password_generation_enabled = $a_status;
119  }

◆ setRegistrationHashLifetime()

ilRegistrationSettings::setRegistrationHashLifetime (   $a_lifetime)

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

170  {
171  $this->reg_hash_life_time = $a_lifetime;
172 
173  return $this;
174  }

◆ 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 164 of file class.ilRegistrationSettings.php.

References $a_type.

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

◆ validate()

ilRegistrationSettings::validate ( )

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

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

205  {
206  $this->unknown = array();
207  $this->mail_perm = array();
208 
209  $login_arr = explode(',', $this->getApproveRecipientLogins());
210  $login_arr = $login_arr ? $login_arr : array();
211  foreach ($login_arr as $recipient) {
212  if (!$recipient = trim($recipient)) {
213  continue;
214  }
215  if (!ilObjUser::_lookupId($recipient)) {
216  $this->unknown[] = $recipient;
217  continue;
218  } else {
219  $valid = $recipient;
220  }
221  }
222  if (count($this->unknown)) {
223  return self::ERR_UNKNOWN_RCP;
224  }
225  if ($this->getRegistrationType() == IL_REG_APPROVE and !count((array) $valid)) {
226  return self::ERR_MISSING_RCP;
227  }
228  return 0;
229  }
$valid
static _lookupId($a_user_str)
Lookup id by login.
Create styles array
The data for the language used.
+ 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: