groups: add events to eventlog

This commit is contained in:
Girish Ramakrishnan
2024-12-04 09:48:25 +01:00
parent fdf8025a02
commit 3b9d617e37
13 changed files with 113 additions and 94 deletions

View File

@@ -85,8 +85,8 @@ async function setConfig(newConfig, auditSource) {
await settings.setJson(settings.EXTERNAL_LDAP_KEY, newConfig);
if (newConfig.provider === 'noop') {
await users.resetSource(); // otherwise, the owner could be 'ldap' source and lock themselves out
await groups.resetSource();
await users.resetSources(); // otherwise, the owner could be 'ldap' source and lock themselves out
await groups.resetSources();
}
await eventlog.add(eventlog.ACTION_EXTERNAL_LDAP_CONFIGURE, auditSource, { oldConfig: removePrivateFields(currentConfig), config: removePrivateFields(newConfig) });
@@ -416,7 +416,7 @@ async function syncGroups(config, progressCallback) {
if (!result) {
debug(`syncGroups: [adding group] groupname=${groupName}`);
const [error] = await safe(groups.add({ name: groupName, source: 'ldap' }));
const [error] = await safe(groups.add({ name: groupName, source: 'ldap' }, AuditSource.EXTERNAL_LDAP));
if (error) debug('syncGroups: Failed to create group', groupName, error);
} else {
// convert local group to ldap group. 2 reasons:
@@ -492,7 +492,7 @@ async function syncGroupMembers(config, progressCallback) {
userIds.push(userObject.id);
}
const [setError] = await safe(groups.setMembers(group, userIds, { skipSourceCheck: true }));
const [setError] = await safe(groups.setMembers(group, userIds, { skipSourceCheck: true }, AuditSource.EXTERNAL_LDAP));
if (setError) debug(`syncGroupMembers: Failed to set members of group ${group.name}. %o`, setError);
}