ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 258 of file class.ilRegistrationSettings.php.

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

Referenced by __construct().

259  {
260  global $ilias;
261 
262  //static method validates value
263  $this->registration_type = self::_lookupRegistrationType();
264 
265  $this->role_type = $ilias->getSetting('reg_role_assignment',1);
266  $this->password_generation_enabled = $ilias->getSetting('passwd_reg_auto_generate');
267  $this->access_limitation = $ilias->getSetting('reg_access_limitation');
268  $this->reg_hash_life_time = $ilias->getSetting('reg_hash_life_time');
269  $this->reg_allow_codes = (bool)$ilias->getSetting('reg_allow_codes');
270 
271  $this->approve_recipient_ids = unserialize(stripslashes($ilias->getSetting('approve_recipient')));
272  $this->approve_recipient_ids = $this->approve_recipient_ids ?
273  $this->approve_recipient_ids :
274  array();
275 
276  // create login array
277  $tmp_logins = array();
278  foreach($this->approve_recipient_ids as $id)
279  {
280  if($login = ilObjUser::_lookupLogin($id))
281  {
282  $tmp_logins[] = $login;
283  }
284  }
285  $this->approve_recipient_logins = implode(',',$tmp_logins);
286 
287  $this->setAllowedDomains($ilias->getSetting('reg_allowed_domains'));
288  }
static _lookupLogin($a_user_id)
lookup login
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  {
85  //data is corrupted and should be processed like "No Registration possible" (#18261)
87  }
88 
89  return $ret;
90  }
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 104 of file class.ilRegistrationSettings.php.

References IL_REG_ACTIVATION.

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

◆ approveEnabled()

ilRegistrationSettings::approveEnabled ( )

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

References IL_REG_APPROVE.

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

◆ automaticRoleAssignmentEnabled()

ilRegistrationSettings::automaticRoleAssignmentEnabled ( )

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

References IL_REG_ROLES_EMAIL.

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

◆ directEnabled()

ilRegistrationSettings::directEnabled ( )

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

References IL_REG_DIRECT.

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

◆ enabled()

ilRegistrationSettings::enabled ( )

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

References IL_REG_DISABLED.

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

◆ getAccessLimitation()

ilRegistrationSettings::getAccessLimitation ( )

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

References $access_limitation.

◆ getAllowCodes()

ilRegistrationSettings::getAllowCodes ( )

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

References $reg_allow_codes.

◆ getAllowedDomains()

ilRegistrationSettings::getAllowedDomains ( )

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

References $allowed_domains, and array.

203  {
205  }
Create styles array
The data for the language used.

◆ getApproveRecipientLogins()

ilRegistrationSettings::getApproveRecipientLogins ( )

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

References array.

151  {
152  return $this->approve_recipient_ids ? $this->approve_recipient_ids : array();
153  }
Create styles array
The data for the language used.

◆ getRegistrationHashLifetime()

ilRegistrationSettings::getRegistrationHashLifetime ( )

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

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

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

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

◆ passwordGenerationEnabled()

ilRegistrationSettings::passwordGenerationEnabled ( )

◆ registrationCodeRequired()

ilRegistrationSettings::registrationCodeRequired ( )

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

References IL_REG_CODES.

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

◆ roleSelectionEnabled()

ilRegistrationSettings::roleSelectionEnabled ( )

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

References IL_REG_ROLES_FIXED.

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

◆ save()

ilRegistrationSettings::save ( )

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

243  {
244  global $ilias;
245 
246  $ilias->setSetting('reg_role_assignment',$this->role_type);
247  $ilias->setSetting('new_registration_type',$this->registration_type);
248  $ilias->setSetting('passwd_reg_auto_generate',$this->password_generation_enabled);
249  $ilias->setSetting('approve_recipient',addslashes(serialize($this->approve_recipient_ids)));
250  $ilias->setSetting('reg_access_limitation',$this->access_limitation);
251  $ilias->setSetting('reg_hash_life_time',$this->reg_hash_life_time);
252  $ilias->setSetting('reg_allow_codes',$this->reg_allow_codes);
253  $ilias->setSetting('reg_allowed_domains',implode(';', $this->allowed_domains));
254 
255  return true;
256  }

◆ setAccessLimitation()

ilRegistrationSettings::setAccessLimitation (   $a_access_limitation)

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

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

◆ setAllowCodes()

ilRegistrationSettings::setAllowCodes (   $a_allow_codes)

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

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

◆ setAllowedDomains()

ilRegistrationSettings::setAllowedDomains (   $a_value)

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

Referenced by __read().

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

◆ setApproveRecipientLogins()

ilRegistrationSettings::setApproveRecipientLogins (   $a_rec_string)

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

References ilObjUser\_lookupId(), and array.

133  {
134  $this->approve_recipient_logins = $a_rec_string;
135  $this->approve_recipient_ids = array();
136 
137  // convert logins to array of ids
138  foreach(explode(',',trim($this->approve_recipient_logins)) as $login)
139  {
140  if($uid = ilObjUser::_lookupId(trim($login)))
141  {
142  $this->approve_recipient_ids[] = $uid;
143  }
144  }
145  }
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 117 of file class.ilRegistrationSettings.php.

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

◆ setRegistrationHashLifetime()

ilRegistrationSettings::setRegistrationHashLifetime (   $a_lifetime)

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

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

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

◆ setRoleType()

ilRegistrationSettings::setRoleType (   $a_type)

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

References $a_type.

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

◆ validate()

ilRegistrationSettings::validate ( )

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

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

208  {
209  $this->unknown = array();
210  $this->mail_perm = array();
211 
212  $login_arr = explode(',',$this->getApproveRecipientLogins());
213  $login_arr = $login_arr ? $login_arr : array();
214  foreach($login_arr as $recipient)
215  {
216  if(!$recipient = trim($recipient))
217  {
218  continue;
219  }
220  if(!ilObjUser::_lookupId($recipient))
221  {
222  $this->unknown[] = $recipient;
223  continue;
224  }
225  else
226  {
227  $valid = $recipient;
228  }
229  }
230  if(count($this->unknown))
231  {
232  return self::ERR_UNKNOWN_RCP;
233  }
234  if($this->getRegistrationType() == IL_REG_APPROVE and !count((array) $valid))
235  {
236  return self::ERR_MISSING_RCP;
237  }
238  return 0;
239  }
$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: