Elysia Tools
Navigation
Authentication & Directory Services
LDAP local attribute models
Read synthetic attributes, page a local label array and select predefined display fields without LDAP access.
Samples
Entries inside this sample collection
Read an invented attribute list
Select the first display value from a synthetic attribute array. Missing attributes yield an empty string; no directory connection exists.
function firstAttribute(attributes, name) {
const entry = attributes.find(a => a.name === name);
return entry?.values[0] ?? '';
}
const fixture = [{ name: 'cn', values: ['Demo Reader'] }];
const result = [firstAttribute(fixture, 'cn'), firstAttribute(fixture, 'description')];
console.log(JSON.stringify(result));Page synthetic labels locally
Take a local slice with integer bounds and a maximum page size of five. This is not an LDAP paging control or a search.
function localPage(labels, offset, size) {
if (!Number.isInteger(offset) || offset < 0 || !Number.isInteger(size) || size < 1 || size > 5) return [];
return labels.slice(offset, offset + size);
}
const result = localPage(['alpha', 'beta', 'gamma'], 1, 2);
console.log(JSON.stringify(result));Select permitted display fields
Retain two predefined field names and discard duplicates. The output is an array, not a filter, query or permission change.
function displayFields(requested) {
if (!Array.isArray(requested) || requested.length > 8) return [];
const allowed = new Set(['cn', 'description']);
return [...new Set(requested.filter(name => allowed.has(name)))];
}
const result = displayFields(['cn', 'other', 'cn', 'description']);
console.log(JSON.stringify(result));Tools
Tools frequently paired with this sample
Related
Related sample collections
Related