mirror of
https://github.com/LDAPAccountManager/lam.git
synced 2025-10-06 03:49:56 +02:00
#420 olcAccess editing improvement
This commit is contained in:
parent
4d7e0d277f
commit
c7ff8af927
3 changed files with 37 additions and 2 deletions
|
@ -2,6 +2,7 @@ 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)
|
- Multi-edit tool: change operations are combined by DN to allow e.g. adding object classes with required attributes (408)
|
||||||
|
- Tree view: better editing of olcAccess (420)
|
||||||
- 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)
|
||||||
|
|
|
@ -754,7 +754,8 @@ class TreeView {
|
||||||
if (($schemaAttribute !== null) && $schemaAttribute->isBinary()) {
|
if (($schemaAttribute !== null) && $schemaAttribute->isBinary()) {
|
||||||
$value = base64_encode($value);
|
$value = base64_encode($value);
|
||||||
}
|
}
|
||||||
if ($isMultiLine) {
|
$value = $this->preProcessValue(strtolower($attributeName), $value);
|
||||||
|
if ($isMultiLine || $this->isPseudoMultiLine(strtolower($attributeName))) {
|
||||||
$inputField = new htmlInputTextarea('lam_attr_' . $attributeName, $value, 50, 5);
|
$inputField = new htmlInputTextarea('lam_attr_' . $attributeName, $value, 50, 5);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1056,6 +1057,12 @@ class TreeView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// olcAccess needs removal of newlines
|
||||||
|
if (isset($ldapChanges['olcaccess'])) {
|
||||||
|
for ($i = 0; $i < count($ldapChanges['olcaccess']); $i++) {
|
||||||
|
$ldapChanges['olcaccess'][$i] = str_replace("\n", ' ', $ldapChanges['olcaccess'][$i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
// add ";binary" to binary attributes
|
// add ";binary" to binary attributes
|
||||||
foreach ($ldapChanges as $attributeName => $value) {
|
foreach ($ldapChanges as $attributeName => $value) {
|
||||||
if (!isset($schemaAttributes[$attributeName])) {
|
if (!isset($schemaAttributes[$attributeName])) {
|
||||||
|
@ -1709,6 +1716,30 @@ class TreeView {
|
||||||
return json_encode([]);
|
return json_encode([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the attribute should be rendered multi-line even if it is single-line defined in schema.
|
||||||
|
*
|
||||||
|
* @param string $attributeName attribute name
|
||||||
|
* @return bool render multi-line
|
||||||
|
*/
|
||||||
|
private function isPseudoMultiLine(string $attributeName): bool {
|
||||||
|
return ($attributeName === 'olcaccess');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preprocesses the value before rendering.
|
||||||
|
*
|
||||||
|
* @param string $attributeName attribute name
|
||||||
|
* @param string $value value
|
||||||
|
* @return string preprocessed value
|
||||||
|
*/
|
||||||
|
private function preProcessValue(string $attributeName, string $value): string {
|
||||||
|
if ($attributeName === 'olcaccess') {
|
||||||
|
return preg_replace('/\s+by\s+/', "\r\nby ", $value);
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3182,7 +3182,10 @@ window.lam.treeview.updateAttributePositionData = function(containerId) {
|
||||||
const container = document.getElementById(containerId);
|
const container = document.getElementById(containerId);
|
||||||
const childLiElements = container.children;
|
const childLiElements = container.children;
|
||||||
for (let i = 0; i < childLiElements.length; i++) {
|
for (let i = 0; i < childLiElements.length; i++) {
|
||||||
const inputField = childLiElements[i].querySelector('input');
|
let inputField = childLiElements[i].querySelector('input');
|
||||||
|
if (inputField === null) {
|
||||||
|
inputField = childLiElements[i].querySelector('textarea');
|
||||||
|
}
|
||||||
inputField.value = '{' + i + '}' + inputField.value.replace(/^\{[0-9]+\}/, '');
|
inputField.value = '{' + i + '}' + inputField.value.replace(/^\{[0-9]+\}/, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue