mirror of
https://github.com/LDAPAccountManager/lam.git
synced 2025-10-03 09:49:16 +02:00
#408 updated LDAP operations
This commit is contained in:
parent
335875fca5
commit
4084fd9951
2 changed files with 7 additions and 24 deletions
|
@ -1,6 +1,7 @@
|
||||||
June 2025 9.2
|
June 2025 9.2
|
||||||
- TAK support added
|
- TAK support added
|
||||||
- Active Directory: allow to restore deleted entries in tree view (415)
|
- Active Directory: allow to restore deleted entries in tree view (415)
|
||||||
|
- Multi-edit tool: change operations are combined by DN to allow e.g. adding object classes with required attributes (408)
|
||||||
- Fixed bugs:
|
- Fixed bugs:
|
||||||
-> Unix: profile editor for users not working (418)
|
-> Unix: profile editor for users not working (418)
|
||||||
-> Custom fields: problems with deleting facsimileTelephoneNumber (419)
|
-> Custom fields: problems with deleting facsimileTelephoneNumber (419)
|
||||||
|
|
|
@ -400,7 +400,7 @@ function generateActions(): array {
|
||||||
}
|
}
|
||||||
// find changed attributes
|
// find changed attributes
|
||||||
foreach ($newEntry as $name => $value) {
|
foreach ($newEntry as $name => $value) {
|
||||||
if (!isset($orig[$name]) || !areArrayContentsEqual($value, $orig[$name])) {
|
if (!isset($oldEntry[$name]) || !areArrayContentsEqual($value, $oldEntry[$name])) {
|
||||||
$actions[$dn][$name] = $value;
|
$actions[$dn][$name] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -502,6 +502,7 @@ function doModify(): array {
|
||||||
// initial action index
|
// initial action index
|
||||||
if (!isset($_SESSION['multiEdit_status']['index'])) {
|
if (!isset($_SESSION['multiEdit_status']['index'])) {
|
||||||
$_SESSION['multiEdit_status']['index'] = 0;
|
$_SESSION['multiEdit_status']['index'] = 0;
|
||||||
|
$_SESSION['multiEdit_status']['dnList'] = array_keys($_SESSION['multiEdit_status']['actions']);
|
||||||
}
|
}
|
||||||
// initial content
|
// initial content
|
||||||
if (!isset($_SESSION['multiEdit_status']['modContent'])) {
|
if (!isset($_SESSION['multiEdit_status']['modContent'])) {
|
||||||
|
@ -509,31 +510,12 @@ function doModify(): array {
|
||||||
}
|
}
|
||||||
// run 10 modifications in each call
|
// run 10 modifications in each call
|
||||||
$localCount = 0;
|
$localCount = 0;
|
||||||
while (($localCount < 10) && ($_SESSION['multiEdit_status']['index'] < count($_SESSION['multiEdit_status']['actions']))) {
|
while (($localCount < 10) && ($_SESSION['multiEdit_status']['index'] < count($_SESSION['multiEdit_status']['dnList']))) {
|
||||||
$action = $_SESSION['multiEdit_status']['actions'][$_SESSION['multiEdit_status']['index']];
|
$dn = $_SESSION['multiEdit_status']['dnList'][$_SESSION['multiEdit_status']['index']];
|
||||||
$opType = $action[0];
|
$changes = $_SESSION['multiEdit_status']['actions'][$dn];
|
||||||
$dn = $action[1];
|
|
||||||
$attr = $action[2];
|
|
||||||
$val = $action[3];
|
|
||||||
$_SESSION['multiEdit_status']['modContent'] .= htmlspecialchars($dn) . "<br>";
|
$_SESSION['multiEdit_status']['modContent'] .= htmlspecialchars($dn) . "<br>";
|
||||||
// run LDAP commands
|
// run LDAP commands
|
||||||
$success = false;
|
$success = ldap_modify($_SESSION['ldap']->server(), $dn, $changes);
|
||||||
switch ($opType) {
|
|
||||||
case ADD:
|
|
||||||
$success = ldap_mod_add($_SESSION['ldap']->server(), $dn, [$attr => [$val]]);
|
|
||||||
break;
|
|
||||||
case DEL:
|
|
||||||
if (empty($val)) {
|
|
||||||
$success = ldap_modify($_SESSION['ldap']->server(), $dn, [$attr => []]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$success = ldap_mod_del($_SESSION['ldap']->server(), $dn, [$attr => [$val]]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MOD:
|
|
||||||
$success = ldap_modify($_SESSION['ldap']->server(), $dn, [$attr => [$val]]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!$success || isset($_REQUEST['multiEdit_error'])) {
|
if (!$success || isset($_REQUEST['multiEdit_error'])) {
|
||||||
$msg = new htmlStatusMessage('ERROR', getDefaultLDAPErrorString($_SESSION['ldap']->server()));
|
$msg = new htmlStatusMessage('ERROR', getDefaultLDAPErrorString($_SESSION['ldap']->server()));
|
||||||
$_SESSION['multiEdit_status']['modContent'] .= getMessageHTML($msg);
|
$_SESSION['multiEdit_status']['modContent'] .= getMessageHTML($msg);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue