mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-15 07:43:27 +00:00
overwriteExisting on org user import
This commit is contained in:
2
jslib
2
jslib
Submodule jslib updated: bc43c68eb9...b0b6ad4ebd
@@ -190,6 +190,13 @@
|
|||||||
<label class="form-check-label" for="removeDisabled">{{'removeDisabled' | i18n}}</label>
|
<label class="form-check-label" for="removeDisabled">{{'removeDisabled' | i18n}}</label>
|
||||||
</div>
|
</div>
|
||||||
</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]="directory != directoryType.Ldap">
|
||||||
<div [hidden]="ldap.ad">
|
<div [hidden]="ldap.ad">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
@@ -577,5 +577,8 @@
|
|||||||
"example": "server"
|
"example": "server"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"overwriteExisting": {
|
||||||
|
"message": "Overwrite existing organization users based on current sync settings."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export class SyncConfiguration {
|
|||||||
userFilter: string;
|
userFilter: string;
|
||||||
groupFilter: string;
|
groupFilter: string;
|
||||||
removeDisabled = false;
|
removeDisabled = false;
|
||||||
|
overwriteExisting = false;
|
||||||
// Ldap properties
|
// Ldap properties
|
||||||
groupObjectClass: string;
|
groupObjectClass: string;
|
||||||
userObjectClass: string;
|
userObjectClass: string;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export class SyncService {
|
|||||||
|
|
||||||
this.messagingService.send('dirSyncStarted');
|
this.messagingService.send('dirSyncStarted');
|
||||||
try {
|
try {
|
||||||
const entries = await directoryService.getEntries(force, test);
|
const entries = await directoryService.getEntries(force || syncConfig.overwriteExisting, test);
|
||||||
let groups = entries[0];
|
let groups = entries[0];
|
||||||
let users = entries[1];
|
let users = entries[1];
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ export class SyncService {
|
|||||||
return [groups, users];
|
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);
|
const reqJson = JSON.stringify(req);
|
||||||
|
|
||||||
let hash: string = null;
|
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();
|
const model = new ImportDirectoryRequest();
|
||||||
|
model.overwriteExisting = overwriteExisting;
|
||||||
|
|
||||||
if (groups != null) {
|
if (groups != null) {
|
||||||
for (const g of groups) {
|
for (const g of groups) {
|
||||||
|
|||||||
Reference in New Issue
Block a user