made uid optional (closes 1757215)

This commit is contained in:
Roland Gruber 2007-07-21 09:47:48 +00:00
parent 7048f58c1d
commit 9faa1c220f
1 changed files with 8 additions and 6 deletions

View File

@ -512,12 +512,14 @@ class inetOrgPerson extends baseModule {
$modules = $_SESSION['config']->get_AccountModules($this->get_scope()); $modules = $_SESSION['config']->get_AccountModules($this->get_scope());
if (!in_array('posixAccount', $modules)) { if (!in_array('posixAccount', $modules)) {
// uid // uid
if (isset($_POST['userName']) && ($_POST['userName'] != '')) {
if (!get_preg($_POST['userName'], 'username')) { if (!get_preg($_POST['userName'], 'username')) {
$errors[] = $this->messages['uid'][0]; $errors[] = $this->messages['uid'][0];
} }
else { else {
$this->attributes['uid'][0] = $_POST['userName']; $this->attributes['uid'][0] = $_POST['userName'];
} }
}
// cn // cn
if ($_POST['cn'] == '') { if ($_POST['cn'] == '') {
if ($_POST['givenName'] != '') { if ($_POST['givenName'] != '') {
@ -591,7 +593,7 @@ class inetOrgPerson extends baseModule {
if (!in_array('posixAccount', $modules)) { if (!in_array('posixAccount', $modules)) {
$uid = ''; $uid = '';
if (isset($this->attributes['uid'][0])) $uid = $this->attributes['uid'][0]; if (isset($this->attributes['uid'][0])) $uid = $this->attributes['uid'][0];
$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('User name') . '*' ), $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('User name')),
array('kind' => 'input', 'name' => 'userName', 'type' => 'text', 'size' => '30', array('kind' => 'input', 'name' => 'userName', 'type' => 'text', 'size' => '30',
'maxlength' => '255', 'value' => $uid), 'maxlength' => '255', 'value' => $uid),
array('kind' => 'help', 'value' => 'uid')); array('kind' => 'help', 'value' => 'uid'));