From 06f47376e5bff87571286c39c996227668966b86 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 9 Jan 2016 19:20:28 +0000 Subject: [PATCH] fixed PHP notices for hosts --- lam/lib/modules/posixAccount.inc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index 3c1c9aec..42b9e1e7 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -1460,8 +1460,13 @@ class posixAccount extends baseModule implements passwordService { } if ($this->manageCn() && (!isset($this->attributes['cn'][0]) || ($this->attributes['cn'][0] == ''))) { // set a default value for common name - if (($this->get_scope() == 'host') && isset($_POST['uid']) && (substr($_POST['uid'], -1, 1) == '$')) { - $this->attributes['cn'][0] = substr($_POST['uid'], 0, strlen($_POST['uid']) - 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); + } + else { + $this->attributes['cn'][0] = $_POST['uid']; + } } elseif ($this->getAccountContainer()->getAccountModule('inetOrgPerson') != null) { $attrs = $this->getAccountContainer()->getAccountModule('inetOrgPerson')->getAttributes(); @@ -2340,6 +2345,13 @@ class posixAccount extends baseModule implements passwordService { if (!checkIfWriteAccessIsAllowed($this->get_scope())) { die(); } + if ($this->get_scope() != 'user') { + return array( + 'status' => 'finished', + 'progress' => 100, + 'errors' => array() + ); + } // on first call generate list of ldap operations if (!isset($temp['counter'])) { $temp['groups'] = array();