new remote API
This commit is contained in:
parent
e899bf8c82
commit
b89a227f7c
|
@ -732,7 +732,9 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
elseif (!in_array($temp[0], $this->lamdaemonServers)) {
|
elseif (!in_array($temp[0], $this->lamdaemonServers)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$result = lamdaemon(
|
$remote = new \LAM\REMOTE\Remote();
|
||||||
|
$remote->connect($server);
|
||||||
|
$result = $remote->execute(
|
||||||
implode(
|
implode(
|
||||||
self::$SPLIT_DELIMITER,
|
self::$SPLIT_DELIMITER,
|
||||||
array(
|
array(
|
||||||
|
@ -743,11 +745,11 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
"0".$_SESSION['config']->get_scriptRights(),
|
"0".$_SESSION['config']->get_scriptRights(),
|
||||||
$this->attributes['uidNumber'][0],
|
$this->attributes['uidNumber'][0],
|
||||||
$this->attributes['gidNumber'][0])
|
$this->attributes['gidNumber'][0])
|
||||||
),
|
));
|
||||||
$server);
|
$remote->disconnect();
|
||||||
// lamdaemon results
|
// lamdaemon results
|
||||||
if (is_array($result)) {
|
if (!empty($result)) {
|
||||||
$singleresult = explode(",", $result[0]);
|
$singleresult = explode(",", $result);
|
||||||
if (($singleresult[0] == 'ERROR') || ($singleresult[0] == 'INFO') || ($singleresult[0] == 'WARN')) {
|
if (($singleresult[0] == 'ERROR') || ($singleresult[0] == 'INFO') || ($singleresult[0] == 'WARN')) {
|
||||||
$messages[] = $singleresult;
|
$messages[] = $singleresult;
|
||||||
}
|
}
|
||||||
|
@ -767,7 +769,9 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
$temp = explode(":", $lamdaemonServers[$i]);
|
$temp = explode(":", $lamdaemonServers[$i]);
|
||||||
$server = $temp[0];
|
$server = $temp[0];
|
||||||
$result = lamdaemon(
|
$remote = new \LAM\REMOTE\Remote();
|
||||||
|
$remote->connect($server);
|
||||||
|
$result = $remote->execute(
|
||||||
implode(
|
implode(
|
||||||
self::$SPLIT_DELIMITER,
|
self::$SPLIT_DELIMITER,
|
||||||
array(
|
array(
|
||||||
|
@ -777,11 +781,11 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
$this->orig[$homeDirAttr][0],
|
$this->orig[$homeDirAttr][0],
|
||||||
$this->attributes['uidNumber'][0],
|
$this->attributes['uidNumber'][0],
|
||||||
$this->attributes[$homeDirAttr][0])
|
$this->attributes[$homeDirAttr][0])
|
||||||
),
|
));
|
||||||
$server);
|
$remote->disconnect();
|
||||||
// lamdaemon results
|
// lamdaemon results
|
||||||
if (is_array($result)) {
|
if (!empty($result)) {
|
||||||
$singleresult = explode(",", $result[0]);
|
$singleresult = explode(",", $result);
|
||||||
if (($singleresult[0] == 'ERROR') || ($singleresult[0] == 'INFO') || ($singleresult[0] == 'WARN')) {
|
if (($singleresult[0] == 'ERROR') || ($singleresult[0] == 'INFO') || ($singleresult[0] == 'WARN')) {
|
||||||
$messages[] = $singleresult;
|
$messages[] = $singleresult;
|
||||||
}
|
}
|
||||||
|
@ -798,7 +802,9 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
$temp = explode(":", $lamdaemonServers[$i]);
|
$temp = explode(":", $lamdaemonServers[$i]);
|
||||||
$server = $temp[0];
|
$server = $temp[0];
|
||||||
$result = lamdaemon(
|
$remote = new \LAM\REMOTE\Remote();
|
||||||
|
$remote->connect($server);
|
||||||
|
$result = $remote->execute(
|
||||||
implode(
|
implode(
|
||||||
self::$SPLIT_DELIMITER,
|
self::$SPLIT_DELIMITER,
|
||||||
array(
|
array(
|
||||||
|
@ -808,11 +814,11 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
$this->orig[$homeDirAttr][0],
|
$this->orig[$homeDirAttr][0],
|
||||||
$this->attributes['uidNumber'][0],
|
$this->attributes['uidNumber'][0],
|
||||||
$this->attributes['gidNumber'][0])
|
$this->attributes['gidNumber'][0])
|
||||||
),
|
));
|
||||||
$server);
|
$remote->disconnect();
|
||||||
// lamdaemon results
|
// lamdaemon results
|
||||||
if (is_array($result)) {
|
if (!empty($result)) {
|
||||||
$singleresult = explode(",", $result[0]);
|
$singleresult = explode(",", $result);
|
||||||
if (($singleresult[0] == 'ERROR') || ($singleresult[0] == 'INFO') || ($singleresult[0] == 'WARN')) {
|
if (($singleresult[0] == 'ERROR') || ($singleresult[0] == 'INFO') || ($singleresult[0] == 'WARN')) {
|
||||||
$messages[] = $singleresult;
|
$messages[] = $singleresult;
|
||||||
}
|
}
|
||||||
|
@ -935,7 +941,9 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
// try to delete directory on all servers
|
// try to delete directory on all servers
|
||||||
for ($i = 0; $i < sizeof($lamdaemonServers); $i++) {
|
for ($i = 0; $i < sizeof($lamdaemonServers); $i++) {
|
||||||
$result = lamdaemon(
|
$remote = new \LAM\REMOTE\Remote();
|
||||||
|
$remote->connect($lamdaemonServers[$i]);
|
||||||
|
$result = $remote->execute(
|
||||||
implode(
|
implode(
|
||||||
self::$SPLIT_DELIMITER,
|
self::$SPLIT_DELIMITER,
|
||||||
array(
|
array(
|
||||||
|
@ -945,12 +953,11 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
$this->attributes[$homeDirAttr][0],
|
$this->attributes[$homeDirAttr][0],
|
||||||
$this->attributes['uidNumber'][0]
|
$this->attributes['uidNumber'][0]
|
||||||
)
|
)
|
||||||
),
|
));
|
||||||
$lamdaemonServers[$i]);
|
$remote->disconnect();
|
||||||
// lamdaemon results
|
// lamdaemon results
|
||||||
if (is_array($result)) {
|
if (!empty($result)) {
|
||||||
foreach ($result as $singleresult) {
|
$singleresult = explode(",", $result);
|
||||||
$singleresult = explode(",", $singleresult);
|
|
||||||
if (is_array($singleresult)) {
|
if (is_array($singleresult)) {
|
||||||
if (($singleresult[0] == 'ERROR') || ($singleresult[0] == 'WARN') || ($singleresult[0] == 'INFO')) {
|
if (($singleresult[0] == 'ERROR') || ($singleresult[0] == 'WARN') || ($singleresult[0] == 'INFO')) {
|
||||||
$return[] = $singleresult;
|
$return[] = $singleresult;
|
||||||
|
@ -959,7 +966,6 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// delete sudo rights
|
// delete sudo rights
|
||||||
if (isset($_POST['deleteSudoers']) && ($_POST['deleteSudoers'] == 'on')) {
|
if (isset($_POST['deleteSudoers']) && ($_POST['deleteSudoers'] == 'on')) {
|
||||||
$result = searchLDAPByAttribute('sudoUser', $this->attributes['uid'][0], 'sudoRole', array('dn'), array('sudo'));
|
$result = searchLDAPByAttribute('sudoUser', $this->attributes['uid'][0], 'sudoRole', array('dn'), array('sudo'));
|
||||||
|
@ -1270,7 +1276,9 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
$temp = explode(":", $lamdaemonServers[$i]);
|
$temp = explode(":", $lamdaemonServers[$i]);
|
||||||
$server = $temp[0];
|
$server = $temp[0];
|
||||||
if (isset($_POST['form_subpage_' . get_class($this) . '_homedir_create_' . $i])) {
|
if (isset($_POST['form_subpage_' . get_class($this) . '_homedir_create_' . $i])) {
|
||||||
$result = lamdaemon(
|
$remote = new \LAM\REMOTE\Remote();
|
||||||
|
$remote->connect($server);
|
||||||
|
$result = $remote->execute(
|
||||||
implode(
|
implode(
|
||||||
self::$SPLIT_DELIMITER,
|
self::$SPLIT_DELIMITER,
|
||||||
array(
|
array(
|
||||||
|
@ -1281,12 +1289,11 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
"0".$_SESSION['config']->get_scriptRights(),
|
"0".$_SESSION['config']->get_scriptRights(),
|
||||||
$this->attributes['uidNumber'][0],
|
$this->attributes['uidNumber'][0],
|
||||||
$this->attributes['gidNumber'][0])
|
$this->attributes['gidNumber'][0])
|
||||||
),
|
));
|
||||||
$server);
|
$remote->disconnect();
|
||||||
// lamdaemon results
|
// lamdaemon results
|
||||||
if (is_array($result)) {
|
if (!empty($result)) {
|
||||||
foreach ($result as $singleresult) {
|
$singleresult = explode(",", $result);
|
||||||
$singleresult = explode(",", $singleresult);
|
|
||||||
if (is_array($singleresult)) {
|
if (is_array($singleresult)) {
|
||||||
if (($singleresult[0] == 'ERROR') || ($singleresult[0] == 'WARN') || ($singleresult[0] == 'INFO')) {
|
if (($singleresult[0] == 'ERROR') || ($singleresult[0] == 'WARN') || ($singleresult[0] == 'INFO')) {
|
||||||
$return[] = $singleresult;
|
$return[] = $singleresult;
|
||||||
|
@ -1294,9 +1301,10 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
elseif (isset($_POST['form_subpage_' . get_class($this) . '_homedir_delete_' . $i])) {
|
elseif (isset($_POST['form_subpage_' . get_class($this) . '_homedir_delete_' . $i])) {
|
||||||
$result = lamdaemon(
|
$remote = new \LAM\REMOTE\Remote();
|
||||||
|
$remote->connect($server);
|
||||||
|
$result = $remote->execute(
|
||||||
implode(
|
implode(
|
||||||
self::$SPLIT_DELIMITER,
|
self::$SPLIT_DELIMITER,
|
||||||
array(
|
array(
|
||||||
|
@ -1306,12 +1314,11 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
$this->attributes[$homeDirAttr][0],
|
$this->attributes[$homeDirAttr][0],
|
||||||
$this->attributes['uidNumber'][0]
|
$this->attributes['uidNumber'][0]
|
||||||
)
|
)
|
||||||
),
|
));
|
||||||
$server);
|
$remote->disconnect();
|
||||||
// lamdaemon results
|
// lamdaemon results
|
||||||
if (is_array($result)) {
|
if (!empty($result)) {
|
||||||
foreach ($result as $singleresult) {
|
$singleresult = explode(",", $result);
|
||||||
$singleresult = explode(",", $singleresult);
|
|
||||||
if (is_array($singleresult)) {
|
if (is_array($singleresult)) {
|
||||||
if (($singleresult[0] == 'ERROR') || ($singleresult[0] == 'WARN') || ($singleresult[0] == 'INFO')) {
|
if (($singleresult[0] == 'ERROR') || ($singleresult[0] == 'WARN') || ($singleresult[0] == 'INFO')) {
|
||||||
$return[] = $singleresult;
|
$return[] = $singleresult;
|
||||||
|
@ -1320,7 +1327,6 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1660,7 +1666,9 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
if (isset($temp[1])) {
|
if (isset($temp[1])) {
|
||||||
$label = $temp[1];
|
$label = $temp[1];
|
||||||
}
|
}
|
||||||
$result = lamdaemon(
|
$remote = new \LAM\REMOTE\Remote();
|
||||||
|
$remote->connect($server);
|
||||||
|
$result = $remote->execute(
|
||||||
implode(
|
implode(
|
||||||
self::$SPLIT_DELIMITER,
|
self::$SPLIT_DELIMITER,
|
||||||
array(
|
array(
|
||||||
|
@ -1668,11 +1676,11 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
"home",
|
"home",
|
||||||
"check",
|
"check",
|
||||||
$this->attributes[$homeDirAttr][0])
|
$this->attributes[$homeDirAttr][0])
|
||||||
),
|
));
|
||||||
$server);
|
$remote->disconnect();
|
||||||
// lamdaemon results
|
// lamdaemon results
|
||||||
if (is_array($result)) {
|
if (!empty($result)) {
|
||||||
$returnValue = trim($result[0]);
|
$returnValue = trim($result);
|
||||||
if ($returnValue == 'ok') {
|
if ($returnValue == 'ok') {
|
||||||
$homeServerContainer->addElement(new htmlOutputText($label));
|
$homeServerContainer->addElement(new htmlOutputText($label));
|
||||||
$homeServerContainer->addElement(new htmlSpacer('5px', null));
|
$homeServerContainer->addElement(new htmlSpacer('5px', null));
|
||||||
|
@ -2531,7 +2539,9 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
// create home directories
|
// create home directories
|
||||||
elseif ($temp['counter'] < (sizeof($temp['groups']) + sizeof($temp['createHomes']))) {
|
elseif ($temp['counter'] < (sizeof($temp['groups']) + sizeof($temp['createHomes']))) {
|
||||||
$pos = $temp['createHomes'][$temp['counter'] - sizeof($temp['groups'])];
|
$pos = $temp['createHomes'][$temp['counter'] - sizeof($temp['groups'])];
|
||||||
$result = lamdaemon(
|
$remote = new \LAM\REMOTE\Remote();
|
||||||
|
$remote->connect($data[$pos][$ids['posixAccount_createHomeDir']]);
|
||||||
|
$result = $remote->execute(
|
||||||
implode(
|
implode(
|
||||||
self::$SPLIT_DELIMITER,
|
self::$SPLIT_DELIMITER,
|
||||||
array(
|
array(
|
||||||
|
@ -2543,11 +2553,11 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
$accounts[$pos]['uidNumber'],
|
$accounts[$pos]['uidNumber'],
|
||||||
$accounts[$pos]['gidNumber'],
|
$accounts[$pos]['gidNumber'],
|
||||||
)
|
)
|
||||||
),
|
));
|
||||||
$data[$pos][$ids['posixAccount_createHomeDir']]);
|
$remote->disconnect();
|
||||||
$errors = array();
|
$errors = array();
|
||||||
if (($result != false) && (sizeof($result) == 1)) {
|
if (!empty($result)) {
|
||||||
$parts = explode(",", $result[0]);
|
$parts = explode(",", $result);
|
||||||
if (in_array($parts[0], array('ERROR', 'WARN'))) {
|
if (in_array($parts[0], array('ERROR', 'WARN'))) {
|
||||||
$errors[] = $parts;
|
$errors[] = $parts;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue