fixed PHP notices for hosts

This commit is contained in:
Roland Gruber 2016-01-09 19:20:28 +00:00
parent ed0673332f
commit 06f47376e5
1 changed files with 14 additions and 2 deletions

View File

@ -1460,9 +1460,14 @@ class posixAccount extends baseModule implements passwordService {
} }
if ($this->manageCn() && (!isset($this->attributes['cn'][0]) || ($this->attributes['cn'][0] == ''))) { if ($this->manageCn() && (!isset($this->attributes['cn'][0]) || ($this->attributes['cn'][0] == ''))) {
// set a default value for common name // set a default value for common name
if (($this->get_scope() == 'host') && isset($_POST['uid']) && (substr($_POST['uid'], -1, 1) == '$')) { if (($this->get_scope() == 'host') && isset($_POST['uid'])) {
if (substr($_POST['uid'], -1, 1) == '$') {
$this->attributes['cn'][0] = substr($_POST['uid'], 0, strlen($_POST['uid']) - 1); $this->attributes['cn'][0] = substr($_POST['uid'], 0, strlen($_POST['uid']) - 1);
} }
else {
$this->attributes['cn'][0] = $_POST['uid'];
}
}
elseif ($this->getAccountContainer()->getAccountModule('inetOrgPerson') != null) { elseif ($this->getAccountContainer()->getAccountModule('inetOrgPerson') != null) {
$attrs = $this->getAccountContainer()->getAccountModule('inetOrgPerson')->getAttributes(); $attrs = $this->getAccountContainer()->getAccountModule('inetOrgPerson')->getAttributes();
if ($attrs['givenName'][0]) { if ($attrs['givenName'][0]) {
@ -2340,6 +2345,13 @@ class posixAccount extends baseModule implements passwordService {
if (!checkIfWriteAccessIsAllowed($this->get_scope())) { if (!checkIfWriteAccessIsAllowed($this->get_scope())) {
die(); die();
} }
if ($this->get_scope() != 'user') {
return array(
'status' => 'finished',
'progress' => 100,
'errors' => array()
);
}
// on first call generate list of ldap operations // on first call generate list of ldap operations
if (!isset($temp['counter'])) { if (!isset($temp['counter'])) {
$temp['groups'] = array(); $temp['groups'] = array();