1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-05 23:53:21 +00:00

overwriteExisting on org user import

This commit is contained in:
Kyle Spearrin
2019-05-06 21:32:25 -04:00
parent 5d8193c348
commit 976fcad098
5 changed files with 17 additions and 4 deletions

2
jslib

Submodule jslib updated: bc43c68eb9...b0b6ad4ebd

View File

@@ -190,6 +190,13 @@
<label class="form-check-label" for="removeDisabled">{{'removeDisabled' | i18n}}</label>
</div>
</div>
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="overwriteExisting"
[(ngModel)]="sync.overwriteExisting" name="OverwriteExisting">
<label class="form-check-label" for="overwriteExisting">{{'overwriteExisting' | i18n}}</label>
</div>
</div>
<div [hidden]="directory != directoryType.Ldap">
<div [hidden]="ldap.ad">
<div class="form-group">

View File

@@ -577,5 +577,8 @@
"example": "server"
}
}
},
"overwriteExisting": {
"message": "Overwrite existing organization users based on current sync settings."
}
}

View File

@@ -5,6 +5,7 @@ export class SyncConfiguration {
userFilter: string;
groupFilter: string;
removeDisabled = false;
overwriteExisting = false;
// Ldap properties
groupObjectClass: string;
userObjectClass: string;

View File

@@ -48,7 +48,7 @@ export class SyncService {
this.messagingService.send('dirSyncStarted');
try {
const entries = await directoryService.getEntries(force, test);
const entries = await directoryService.getEntries(force || syncConfig.overwriteExisting, test);
let groups = entries[0];
let users = entries[1];
@@ -65,7 +65,7 @@ export class SyncService {
return [groups, users];
}
const req = this.buildRequest(groups, users, syncConfig.removeDisabled);
const req = this.buildRequest(groups, users, syncConfig.removeDisabled, syncConfig.overwriteExisting);
const reqJson = JSON.stringify(req);
let hash: string = null;
@@ -128,8 +128,10 @@ export class SyncService {
}
}
private buildRequest(groups: GroupEntry[], users: UserEntry[], removeDisabled: boolean): ImportDirectoryRequest {
private buildRequest(groups: GroupEntry[], users: UserEntry[], removeDisabled: boolean,
overwriteExisting: boolean): ImportDirectoryRequest {
const model = new ImportDirectoryRequest();
model.overwriteExisting = overwriteExisting;
if (groups != null) {
for (const g of groups) {