mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-05 23:53:21 +00:00
Upgrade prettier (#409)
This commit is contained in:
@@ -19,7 +19,7 @@ export abstract class StateService extends BaseStateServiceAbstraction<Account>
|
||||
| GSuiteConfiguration
|
||||
| AzureConfiguration
|
||||
| OktaConfiguration
|
||||
| OneLoginConfiguration
|
||||
| OneLoginConfiguration,
|
||||
) => Promise<any>;
|
||||
getLdapConfiguration: (options?: StorageOptions) => Promise<LdapConfiguration>;
|
||||
setLdapConfiguration: (value: LdapConfiguration, options?: StorageOptions) => Promise<void>;
|
||||
@@ -32,7 +32,7 @@ export abstract class StateService extends BaseStateServiceAbstraction<Account>
|
||||
getOneLoginConfiguration: (options?: StorageOptions) => Promise<OneLoginConfiguration>;
|
||||
setOneLoginConfiguration: (
|
||||
value: OneLoginConfiguration,
|
||||
options?: StorageOptions
|
||||
options?: StorageOptions,
|
||||
) => Promise<void>;
|
||||
getOrganizationId: (options?: StorageOptions) => Promise<string>;
|
||||
setOrganizationId: (value: string, options?: StorageOptions) => Promise<void>;
|
||||
|
||||
@@ -41,7 +41,7 @@ export class ApiKeyComponent {
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private modalService: ModalService,
|
||||
private logService: LogService,
|
||||
private stateService: StateService
|
||||
private stateService: StateService,
|
||||
) {}
|
||||
|
||||
async submit() {
|
||||
@@ -49,7 +49,7 @@ export class ApiKeyComponent {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("clientIdRequired")
|
||||
this.i18nService.t("clientIdRequired"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ export class ApiKeyComponent {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("orgApiKeyRequired")
|
||||
this.i18nService.t("orgApiKeyRequired"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ export class ApiKeyComponent {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("clientSecretRequired")
|
||||
this.i18nService.t("clientSecretRequired"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -75,14 +75,14 @@ export class ApiKeyComponent {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("invalidClientId")
|
||||
this.i18nService.t("invalidClientId"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.formPromise = this.authService.logIn(
|
||||
new ApiLogInCredentials(this.clientId, this.clientSecret)
|
||||
new ApiLogInCredentials(this.clientId, this.clientSecret),
|
||||
);
|
||||
await this.formPromise;
|
||||
const organizationId = await this.stateService.getEntityId();
|
||||
@@ -96,7 +96,7 @@ export class ApiKeyComponent {
|
||||
async settings() {
|
||||
const [modalRef, childComponent] = await this.modalService.openViewRef<EnvironmentComponent>(
|
||||
EnvironmentComponent,
|
||||
this.environmentModal
|
||||
this.environmentModal,
|
||||
);
|
||||
|
||||
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
||||
|
||||
@@ -13,7 +13,7 @@ export class EnvironmentComponent extends BaseEnvironmentComponent {
|
||||
constructor(
|
||||
environmentService: EnvironmentService,
|
||||
i18nService: I18nService,
|
||||
platformUtilsService: PlatformUtilsService
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
) {
|
||||
super(platformUtilsService, environmentService, i18nService);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ export class AppComponent implements OnInit {
|
||||
private messagingService: MessagingService,
|
||||
private syncService: SyncService,
|
||||
private stateService: StateService,
|
||||
private logService: LogService
|
||||
private logService: LogService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -123,7 +123,7 @@ export class AppComponent implements OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"warning",
|
||||
this.i18nService.t("loggedOut"),
|
||||
this.i18nService.t("loginExpired")
|
||||
this.i18nService.t("loginExpired"),
|
||||
);
|
||||
}
|
||||
this.router.navigate(["login"]);
|
||||
@@ -142,7 +142,7 @@ export class AppComponent implements OnInit {
|
||||
} else {
|
||||
msg.text.forEach(
|
||||
(t: string) =>
|
||||
(message += "<p>" + this.sanitizer.sanitize(SecurityContext.HTML, t) + "</p>")
|
||||
(message += "<p>" + this.sanitizer.sanitize(SecurityContext.HTML, t) + "</p>"),
|
||||
);
|
||||
options.enableHtml = true;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,10 @@ import { StateService } from "../../abstractions/state.service";
|
||||
|
||||
@Injectable()
|
||||
export class AuthGuardService implements CanActivate {
|
||||
constructor(private stateService: StateService, private messagingService: MessagingService) {}
|
||||
constructor(
|
||||
private stateService: StateService,
|
||||
private messagingService: MessagingService,
|
||||
) {}
|
||||
|
||||
async canActivate() {
|
||||
const isAuthed = await this.stateService.getIsAuthenticated();
|
||||
|
||||
@@ -5,7 +5,10 @@ import { StateService } from "../../abstractions/state.service";
|
||||
|
||||
@Injectable()
|
||||
export class LaunchGuardService implements CanActivate {
|
||||
constructor(private stateService: StateService, private router: Router) {}
|
||||
constructor(
|
||||
private stateService: StateService,
|
||||
private router: Router,
|
||||
) {}
|
||||
|
||||
async canActivate() {
|
||||
const isAuthed = await this.stateService.getIsAuthenticated();
|
||||
|
||||
@@ -45,7 +45,7 @@ export function initFactory(
|
||||
i18nService: I18nService,
|
||||
platformUtilsService: PlatformUtilsServiceAbstraction,
|
||||
stateService: StateServiceAbstraction,
|
||||
cryptoService: CryptoServiceAbstraction
|
||||
cryptoService: CryptoServiceAbstraction,
|
||||
): () => Promise<void> {
|
||||
return async () => {
|
||||
await stateService.init();
|
||||
@@ -108,7 +108,7 @@ export function initFactory(
|
||||
useFactory: (
|
||||
i18nService: I18nServiceAbstraction,
|
||||
messagingService: MessagingServiceAbstraction,
|
||||
stateService: StateServiceAbstraction
|
||||
stateService: StateServiceAbstraction,
|
||||
) => new ElectronPlatformUtilsService(i18nService, messagingService, false, stateService),
|
||||
deps: [I18nServiceAbstraction, MessagingServiceAbstraction, StateServiceAbstraction],
|
||||
},
|
||||
@@ -120,7 +120,7 @@ export function initFactory(
|
||||
platformUtilsService: PlatformUtilsServiceAbstraction,
|
||||
environmentService: EnvironmentServiceAbstraction,
|
||||
messagingService: MessagingServiceAbstraction,
|
||||
appIdService: AppIdServiceAbstraction
|
||||
appIdService: AppIdServiceAbstraction,
|
||||
) =>
|
||||
new NodeApiService(
|
||||
tokenService,
|
||||
@@ -132,7 +132,7 @@ export function initFactory(
|
||||
platformUtilsService.getApplicationVersion() +
|
||||
" (" +
|
||||
platformUtilsService.getDeviceString().toUpperCase() +
|
||||
")"
|
||||
")",
|
||||
),
|
||||
deps: [
|
||||
TokenServiceAbstraction,
|
||||
@@ -179,12 +179,12 @@ export function initFactory(
|
||||
provide: StateMigrationServiceAbstraction,
|
||||
useFactory: (
|
||||
storageService: StorageServiceAbstraction,
|
||||
secureStorageService: StorageServiceAbstraction
|
||||
secureStorageService: StorageServiceAbstraction,
|
||||
) =>
|
||||
new StateMigrationService(
|
||||
storageService,
|
||||
secureStorageService,
|
||||
new StateFactory(GlobalState, Account)
|
||||
new StateFactory(GlobalState, Account),
|
||||
),
|
||||
deps: [StorageServiceAbstraction, "SECURE_STORAGE"],
|
||||
},
|
||||
@@ -194,7 +194,7 @@ export function initFactory(
|
||||
storageService: StorageServiceAbstraction,
|
||||
secureStorageService: StorageServiceAbstraction,
|
||||
logService: LogServiceAbstraction,
|
||||
stateMigrationService: StateMigrationServiceAbstraction
|
||||
stateMigrationService: StateMigrationServiceAbstraction,
|
||||
) =>
|
||||
new StateService(
|
||||
storageService,
|
||||
@@ -202,7 +202,7 @@ export function initFactory(
|
||||
logService,
|
||||
stateMigrationService,
|
||||
true,
|
||||
new StateFactory(GlobalState, Account)
|
||||
new StateFactory(GlobalState, Account),
|
||||
),
|
||||
deps: [
|
||||
StorageServiceAbstraction,
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
<p>
|
||||
{{ "lastGroupSync" | i18n }}:
|
||||
<span *ngIf="!lastGroupSync">-</span>
|
||||
{{ lastGroupSync | date : "medium" }}
|
||||
{{ lastGroupSync | date: "medium" }}
|
||||
<br />
|
||||
{{ "lastUserSync" | i18n }}:
|
||||
<span *ngIf="!lastUserSync">-</span>
|
||||
{{ lastUserSync | date : "medium" }}
|
||||
{{ lastUserSync | date: "medium" }}
|
||||
</p>
|
||||
<p>
|
||||
{{ "syncStatus" | i18n }}:
|
||||
|
||||
@@ -40,7 +40,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
private messagingService: MessagingService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private changeDetectorRef: ChangeDetectorRef,
|
||||
private stateService: StateService
|
||||
private stateService: StateService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -88,7 +88,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("syncCounts", groupCount.toString(), userCount.toString())
|
||||
this.i18nService.t("syncCounts", groupCount.toString(), userCount.toString()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
this.simPromise = ConnectorUtils.simulate(
|
||||
this.syncService,
|
||||
this.i18nService,
|
||||
this.simSinceLast
|
||||
this.simSinceLast,
|
||||
);
|
||||
const result = await this.simPromise;
|
||||
this.simGroups = result.groups;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<p>
|
||||
{{ "bitwardenDirectoryConnector" | i18n }}
|
||||
<br />
|
||||
{{ "version" | i18n : version }} <br />
|
||||
{{ "version" | i18n: version }} <br />
|
||||
© Bitwarden Inc. LLC 2015-{{ year }}
|
||||
</p>
|
||||
<button
|
||||
|
||||
@@ -25,7 +25,7 @@ export class MoreComponent implements OnInit {
|
||||
private broadcasterService: BroadcasterService,
|
||||
private ngZone: NgZone,
|
||||
private changeDetectorRef: ChangeDetectorRef,
|
||||
private stateService: StateService
|
||||
private stateService: StateService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -63,7 +63,7 @@ export class MoreComponent implements OnInit {
|
||||
this.i18nService.t("logOutConfirmation"),
|
||||
this.i18nService.t("logOut"),
|
||||
this.i18nService.t("yes"),
|
||||
this.i18nService.t("cancel")
|
||||
this.i18nService.t("cancel"),
|
||||
);
|
||||
if (confirmed) {
|
||||
this.messagingService.send("logout");
|
||||
|
||||
@@ -37,7 +37,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
private changeDetectorRef: ChangeDetectorRef,
|
||||
private ngZone: NgZone,
|
||||
private logService: LogService,
|
||||
private stateService: StateService
|
||||
private stateService: StateService,
|
||||
) {
|
||||
this.directoryOptions = [
|
||||
{ name: this.i18nService.t("select"), value: null },
|
||||
@@ -58,7 +58,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
this.gsuite;
|
||||
this.azure =
|
||||
(await this.stateService.getDirectory<AzureConfiguration>(
|
||||
DirectoryType.AzureActiveDirectory
|
||||
DirectoryType.AzureActiveDirectory,
|
||||
)) || this.azure;
|
||||
this.okta =
|
||||
(await this.stateService.getDirectory<OktaConfiguration>(DirectoryType.Okta)) || this.okta;
|
||||
|
||||
34
src/bwdc.ts
34
src/bwdc.ts
@@ -90,7 +90,7 @@ export class Main {
|
||||
} else if (process.platform === "darwin") {
|
||||
this.dataFilePath = path.join(
|
||||
process.env.HOME,
|
||||
"Library/Application Support/" + applicationName
|
||||
"Library/Application Support/" + applicationName,
|
||||
);
|
||||
} else if (process.platform === "win32") {
|
||||
this.dataFilePath = path.join(process.env.APPDATA, applicationName);
|
||||
@@ -104,11 +104,11 @@ export class Main {
|
||||
this.i18nService = new I18nService("en", "./locales");
|
||||
this.platformUtilsService = new CliPlatformUtilsService(
|
||||
ClientType.DirectoryConnector,
|
||||
packageJson
|
||||
packageJson,
|
||||
);
|
||||
this.logService = new ConsoleLogService(
|
||||
this.platformUtilsService.isDev(),
|
||||
(level) => process.env.BITWARDENCLI_CONNECTOR_DEBUG !== "true" && level <= LogLevelType.Info
|
||||
(level) => process.env.BITWARDENCLI_CONNECTOR_DEBUG !== "true" && level <= LogLevelType.Info,
|
||||
);
|
||||
this.cryptoFunctionService = new NodeCryptoFunctionService();
|
||||
this.storageService = new LowdbStorageService(
|
||||
@@ -116,7 +116,7 @@ export class Main {
|
||||
null,
|
||||
this.dataFilePath,
|
||||
false,
|
||||
true
|
||||
true,
|
||||
);
|
||||
this.secureStorageService = plaintextSecrets
|
||||
? this.storageService
|
||||
@@ -125,7 +125,7 @@ export class Main {
|
||||
this.stateMigrationService = new StateMigrationService(
|
||||
this.storageService,
|
||||
this.secureStorageService,
|
||||
new StateFactory(GlobalState, Account)
|
||||
new StateFactory(GlobalState, Account),
|
||||
);
|
||||
|
||||
this.stateService = new StateService(
|
||||
@@ -134,14 +134,14 @@ export class Main {
|
||||
this.logService,
|
||||
this.stateMigrationService,
|
||||
process.env.BITWARDENCLI_CONNECTOR_PLAINTEXT_SECRETS !== "true",
|
||||
new StateFactory(GlobalState, Account)
|
||||
new StateFactory(GlobalState, Account),
|
||||
);
|
||||
|
||||
this.cryptoService = new CryptoService(
|
||||
this.cryptoFunctionService,
|
||||
this.platformUtilsService,
|
||||
this.logService,
|
||||
this.stateService
|
||||
this.stateService,
|
||||
);
|
||||
|
||||
this.appIdService = new AppIdService(this.storageService);
|
||||
@@ -161,7 +161,7 @@ export class Main {
|
||||
this.environmentService,
|
||||
this.appIdService,
|
||||
async (expired: boolean) => await this.logout(),
|
||||
customUserAgent
|
||||
customUserAgent,
|
||||
);
|
||||
this.containerService = new ContainerService(this.cryptoService);
|
||||
|
||||
@@ -174,7 +174,7 @@ export class Main {
|
||||
this.tokenService,
|
||||
this.logService,
|
||||
this.organizationService,
|
||||
this.cryptoFunctionService
|
||||
this.cryptoFunctionService,
|
||||
);
|
||||
|
||||
this.twoFactorService = new NoopTwoFactorService();
|
||||
@@ -191,7 +191,7 @@ export class Main {
|
||||
this.environmentService,
|
||||
this.stateService,
|
||||
this.twoFactorService,
|
||||
this.i18nService
|
||||
this.i18nService,
|
||||
);
|
||||
|
||||
this.syncService = new SyncService(
|
||||
@@ -201,19 +201,19 @@ export class Main {
|
||||
this.messagingService,
|
||||
this.i18nService,
|
||||
this.environmentService,
|
||||
this.stateService
|
||||
this.stateService,
|
||||
);
|
||||
|
||||
this.policyService = new PolicyService(
|
||||
this.stateService,
|
||||
this.organizationService,
|
||||
this.apiService
|
||||
this.apiService,
|
||||
);
|
||||
|
||||
this.passwordGenerationService = new PasswordGenerationService(
|
||||
this.cryptoService,
|
||||
this.policyService,
|
||||
this.stateService
|
||||
this.stateService,
|
||||
);
|
||||
|
||||
this.settingsService = new SettingsService(this.stateService);
|
||||
@@ -228,7 +228,7 @@ export class Main {
|
||||
this.i18nService,
|
||||
() => searchService,
|
||||
this.logService,
|
||||
this.stateService
|
||||
this.stateService,
|
||||
);
|
||||
|
||||
this.searchService = new SearchService(this.cipherService, this.logService, this.i18nService);
|
||||
@@ -238,13 +238,13 @@ export class Main {
|
||||
this.apiService,
|
||||
this.i18nService,
|
||||
this.cipherService,
|
||||
this.stateService
|
||||
this.stateService,
|
||||
);
|
||||
|
||||
this.collectionService = new CollectionService(
|
||||
this.cryptoService,
|
||||
this.i18nService,
|
||||
this.stateService
|
||||
this.stateService,
|
||||
);
|
||||
|
||||
this.sendService = new SendService(
|
||||
@@ -253,7 +253,7 @@ export class Main {
|
||||
this.fileUploadService,
|
||||
this.i18nService,
|
||||
this.cryptoFunctionService,
|
||||
this.stateService
|
||||
this.stateService,
|
||||
);
|
||||
|
||||
this.providerService = new ProviderService(this.stateService);
|
||||
|
||||
@@ -7,7 +7,10 @@ import { MessageResponse } from "@/jslib/node/src/cli/models/response/messageRes
|
||||
import { StateService } from "../abstractions/state.service";
|
||||
|
||||
export class ClearCacheCommand {
|
||||
constructor(private i18nService: I18nService, private stateService: StateService) {}
|
||||
constructor(
|
||||
private i18nService: I18nService,
|
||||
private stateService: StateService,
|
||||
) {}
|
||||
|
||||
async run(cmd: program.OptionValues): Promise<Response> {
|
||||
try {
|
||||
|
||||
@@ -28,7 +28,7 @@ export class ConfigCommand {
|
||||
constructor(
|
||||
private environmentService: EnvironmentService,
|
||||
private i18nService: I18nService,
|
||||
private stateService: StateService
|
||||
private stateService: StateService,
|
||||
) {}
|
||||
|
||||
async run(setting: string, value: string, options: program.OptionValues): Promise<Response> {
|
||||
@@ -129,7 +129,7 @@ export class ConfigCommand {
|
||||
this.gsuite;
|
||||
this.azure =
|
||||
(await this.stateService.getDirectory<AzureConfiguration>(
|
||||
DirectoryType.AzureActiveDirectory
|
||||
DirectoryType.AzureActiveDirectory,
|
||||
)) || this.azure;
|
||||
this.okta =
|
||||
(await this.stateService.getDirectory<OktaConfiguration>(DirectoryType.Okta)) || this.okta;
|
||||
|
||||
@@ -12,7 +12,7 @@ export class LastSyncCommand {
|
||||
case "groups": {
|
||||
const groupsDate = await this.stateService.getLastGroupSync();
|
||||
const groupsRes = new StringResponse(
|
||||
groupsDate == null ? null : groupsDate.toISOString()
|
||||
groupsDate == null ? null : groupsDate.toISOString(),
|
||||
);
|
||||
return Response.success(groupsRes);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,10 @@ import { MessageResponse } from "@/jslib/node/src/cli/models/response/messageRes
|
||||
import { SyncService } from "../services/sync.service";
|
||||
|
||||
export class SyncCommand {
|
||||
constructor(private syncService: SyncService, private i18nService: I18nService) {}
|
||||
constructor(
|
||||
private syncService: SyncService,
|
||||
private i18nService: I18nService,
|
||||
) {}
|
||||
|
||||
async run(): Promise<Response> {
|
||||
try {
|
||||
@@ -14,7 +17,7 @@ export class SyncCommand {
|
||||
const userCount = result[1] != null ? result[1].length : 0;
|
||||
const res = new MessageResponse(
|
||||
this.i18nService.t("syncingComplete"),
|
||||
this.i18nService.t("syncCounts", groupCount.toString(), userCount.toString())
|
||||
this.i18nService.t("syncCounts", groupCount.toString(), userCount.toString()),
|
||||
);
|
||||
return Response.success(res);
|
||||
} catch (e) {
|
||||
|
||||
@@ -8,14 +8,17 @@ import { SyncService } from "../services/sync.service";
|
||||
import { ConnectorUtils } from "../utils";
|
||||
|
||||
export class TestCommand {
|
||||
constructor(private syncService: SyncService, private i18nService: I18nService) {}
|
||||
constructor(
|
||||
private syncService: SyncService,
|
||||
private i18nService: I18nService,
|
||||
) {}
|
||||
|
||||
async run(cmd: program.OptionValues): Promise<Response> {
|
||||
try {
|
||||
const result = await ConnectorUtils.simulate(
|
||||
this.syncService,
|
||||
this.i18nService,
|
||||
cmd.last || false
|
||||
cmd.last || false,
|
||||
);
|
||||
const res = new TestResponse(result);
|
||||
return Response.success(res);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
|
||||
12
src/main.ts
12
src/main.ts
@@ -63,7 +63,7 @@ export class Main {
|
||||
this.logService,
|
||||
null,
|
||||
true,
|
||||
new StateFactory(GlobalState, Account)
|
||||
new StateFactory(GlobalState, Account),
|
||||
);
|
||||
|
||||
this.windowMain = new WindowMain(
|
||||
@@ -73,7 +73,7 @@ export class Main {
|
||||
800,
|
||||
600,
|
||||
(arg) => this.processDeepLink(arg),
|
||||
null
|
||||
null,
|
||||
);
|
||||
|
||||
this.menuMain = new MenuMain(this);
|
||||
@@ -90,7 +90,7 @@ export class Main {
|
||||
() => {
|
||||
this.messagingService.send("doneCheckingForUpdate");
|
||||
},
|
||||
"bitwardenDirectoryConnector"
|
||||
"bitwardenDirectoryConnector",
|
||||
);
|
||||
|
||||
this.trayMain = new TrayMain(this.windowMain, this.i18nService, this.stateService);
|
||||
@@ -99,14 +99,14 @@ export class Main {
|
||||
this.windowMain,
|
||||
this.menuMain,
|
||||
this.updaterMain,
|
||||
this.trayMain
|
||||
this.trayMain,
|
||||
);
|
||||
this.messagingService = new ElectronMainMessagingService(this.windowMain, (message) => {
|
||||
this.messagingMain.onMessage(message);
|
||||
});
|
||||
|
||||
this.credentialStorageListener = new DCCredentialStorageListener(
|
||||
"Bitwarden Directory Connector"
|
||||
"Bitwarden Directory Connector",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ export class Main {
|
||||
(e: any) => {
|
||||
// eslint-disable-next-line
|
||||
console.error(e);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ export class MenuMain extends BaseMenu {
|
||||
0,
|
||||
{
|
||||
label: this.main.i18nService.t(
|
||||
process.platform === "darwin" ? "hideToMenuBar" : "hideToTray"
|
||||
process.platform === "darwin" ? "hideToMenuBar" : "hideToTray",
|
||||
),
|
||||
click: () => this.main.messagingService.send("hideToTray"),
|
||||
accelerator: "CmdOrCtrl+Shift+M",
|
||||
@@ -60,7 +60,7 @@ export class MenuMain extends BaseMenu {
|
||||
checked: this.windowMain.win.isAlwaysOnTop(),
|
||||
click: () => this.main.windowMain.toggleAlwaysOnTop(),
|
||||
accelerator: "CmdOrCtrl+Shift+T",
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
this.menu = Menu.buildFromTemplate(template);
|
||||
|
||||
@@ -15,7 +15,7 @@ export class MessagingMain {
|
||||
private windowMain: WindowMain,
|
||||
private menuMain: MenuMain,
|
||||
private updaterMain: UpdaterMain,
|
||||
private trayMain: TrayMain
|
||||
private trayMain: TrayMain,
|
||||
) {}
|
||||
|
||||
init() {
|
||||
|
||||
@@ -19,7 +19,7 @@ export class OrganizationLogInStrategy extends LogInStrategy {
|
||||
credentials.clientId,
|
||||
credentials.clientSecret,
|
||||
await this.buildTwoFactor(),
|
||||
await this.buildDeviceRequest()
|
||||
await this.buildDeviceRequest(),
|
||||
);
|
||||
|
||||
return this.startLogIn();
|
||||
@@ -60,7 +60,7 @@ export class OrganizationLogInStrategy extends LogInStrategy {
|
||||
},
|
||||
directorySettings: new DirectorySettings(),
|
||||
directoryConfigurations: new DirectoryConfigurations(),
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ export class Program extends BaseProgram {
|
||||
this.main.cryptoService,
|
||||
this.main.policyService,
|
||||
this.main.twoFactorService,
|
||||
"connector"
|
||||
"connector",
|
||||
);
|
||||
|
||||
if (!Utils.isNullOrWhitespace(clientId)) {
|
||||
@@ -133,7 +133,7 @@ export class Program extends BaseProgram {
|
||||
const command = new LogoutCommand(
|
||||
this.main.authService,
|
||||
this.main.i18nService,
|
||||
async () => await this.main.logout()
|
||||
async () => await this.main.logout(),
|
||||
);
|
||||
const response = await command.run();
|
||||
this.processResponse(response);
|
||||
@@ -227,7 +227,7 @@ export class Program extends BaseProgram {
|
||||
const command = new ConfigCommand(
|
||||
this.main.environmentService,
|
||||
this.main.i18nService,
|
||||
this.main.stateService
|
||||
this.main.stateService,
|
||||
);
|
||||
const response = await command.run(setting, value, options);
|
||||
this.processResponse(response);
|
||||
@@ -244,7 +244,7 @@ export class Program extends BaseProgram {
|
||||
})
|
||||
.action(() => {
|
||||
this.processResponse(
|
||||
Response.success(new StringResponse(path.join(this.main.dataFilePath, "data.json")))
|
||||
Response.success(new StringResponse(path.join(this.main.dataFilePath, "data.json"))),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -285,7 +285,7 @@ export class Program extends BaseProgram {
|
||||
this.main.i18nService,
|
||||
"directory-connector",
|
||||
"bwdc",
|
||||
false
|
||||
false,
|
||||
);
|
||||
const response = await command.run();
|
||||
this.processResponse(response);
|
||||
@@ -305,7 +305,7 @@ export class Program extends BaseProgram {
|
||||
const id = await this.stateService.getEntityId();
|
||||
this.processResponse(
|
||||
Response.error("You are already logged in as " + type + "." + id + "."),
|
||||
true
|
||||
true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export class AuthService extends AuthServiceBase {
|
||||
environmentService: EnvironmentService,
|
||||
stateService: StateService,
|
||||
twoFactorService: TwoFactorService,
|
||||
i18nService: I18nService
|
||||
i18nService: I18nService,
|
||||
) {
|
||||
super(
|
||||
cryptoService,
|
||||
@@ -43,7 +43,7 @@ export class AuthService extends AuthServiceBase {
|
||||
environmentService,
|
||||
stateService,
|
||||
twoFactorService,
|
||||
i18nService
|
||||
i18nService,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ export class AuthService extends AuthServiceBase {
|
||||
this.messagingService,
|
||||
this.logService,
|
||||
this.stateService,
|
||||
this.twoFactorService
|
||||
this.twoFactorService,
|
||||
);
|
||||
|
||||
return strategy.logIn(credentials);
|
||||
|
||||
@@ -42,7 +42,7 @@ export class AzureDirectoryService extends BaseDirectoryService implements IDire
|
||||
constructor(
|
||||
private logService: LogService,
|
||||
private i18nService: I18nService,
|
||||
private stateService: StateService
|
||||
private stateService: StateService,
|
||||
) {
|
||||
super();
|
||||
this.init();
|
||||
@@ -55,7 +55,7 @@ export class AzureDirectoryService extends BaseDirectoryService implements IDire
|
||||
}
|
||||
|
||||
this.dirConfig = await this.stateService.getDirectory<AzureConfiguration>(
|
||||
DirectoryType.AzureActiveDirectory
|
||||
DirectoryType.AzureActiveDirectory,
|
||||
);
|
||||
if (this.dirConfig == null) {
|
||||
return;
|
||||
@@ -95,7 +95,7 @@ export class AzureDirectoryService extends BaseDirectoryService implements IDire
|
||||
// Get the users in the excludedGroups and filter them out from all users
|
||||
} else if (setFilter != null && setFilter[0] === UserSetType.ExcludeGroup) {
|
||||
(await this.getUsersByGroups(setFilter)).forEach((user: graphType.User) =>
|
||||
userIdsToExclude.add(user.id)
|
||||
userIdsToExclude.add(user.id),
|
||||
);
|
||||
const userReq = this.client.api("/users" + UserSelectParams);
|
||||
users = await this.getUsersByResource(userReq);
|
||||
@@ -275,7 +275,7 @@ export class AzureDirectoryService extends BaseDirectoryService implements IDire
|
||||
|
||||
private async filterOutUserResult(
|
||||
setFilter: [UserSetType, Set<string>],
|
||||
user: UserEntry
|
||||
user: UserEntry,
|
||||
): Promise<boolean> {
|
||||
if (setFilter == null) {
|
||||
return false;
|
||||
@@ -371,7 +371,7 @@ export class AzureDirectoryService extends BaseDirectoryService implements IDire
|
||||
const users: graphType.User[] = [];
|
||||
for (const group of setFilter[1]) {
|
||||
const groupUsersReq = this.client.api(
|
||||
`/groups/${group}/transitiveMembers` + UserSelectParams
|
||||
`/groups/${group}/transitiveMembers` + UserSelectParams,
|
||||
);
|
||||
users.push(...(await this.getUsersByResource(groupUsersReq)));
|
||||
}
|
||||
@@ -381,7 +381,7 @@ export class AzureDirectoryService extends BaseDirectoryService implements IDire
|
||||
private async buildUserEntries(
|
||||
users: graphType.User[],
|
||||
userIdsToExclude: Set<string>,
|
||||
setFilter: [UserSetType, Set<string>]
|
||||
setFilter: [UserSetType, Set<string>],
|
||||
) {
|
||||
const entryIds = new Set<string>();
|
||||
const entries: UserEntry[] = [];
|
||||
@@ -510,7 +510,7 @@ export class AzureDirectoryService extends BaseDirectoryService implements IDire
|
||||
done(err, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
)
|
||||
.on("error", (err) => {
|
||||
done(err, null);
|
||||
|
||||
@@ -70,7 +70,7 @@ export abstract class BaseDirectoryService {
|
||||
users: UserEntry[],
|
||||
groups: GroupEntry[],
|
||||
setFilter: [boolean, Set<string>],
|
||||
syncConfig: SyncConfiguration
|
||||
syncConfig: SyncConfiguration,
|
||||
): UserEntry[] {
|
||||
if (setFilter == null || users == null) {
|
||||
return users;
|
||||
|
||||
@@ -24,7 +24,7 @@ export class GSuiteDirectoryService extends BaseDirectoryService implements IDir
|
||||
constructor(
|
||||
private logService: LogService,
|
||||
private i18nService: I18nService,
|
||||
private stateService: StateService
|
||||
private stateService: StateService,
|
||||
) {
|
||||
super();
|
||||
this.service = google.admin("directory_v1");
|
||||
@@ -37,7 +37,7 @@ export class GSuiteDirectoryService extends BaseDirectoryService implements IDir
|
||||
}
|
||||
|
||||
this.dirConfig = await this.stateService.getDirectory<GSuiteConfiguration>(
|
||||
DirectoryType.GSuite
|
||||
DirectoryType.GSuite,
|
||||
);
|
||||
if (this.dirConfig == null) {
|
||||
return;
|
||||
@@ -104,7 +104,7 @@ export class GSuiteDirectoryService extends BaseDirectoryService implements IDir
|
||||
this.logService.info("Querying deleted users - nextPageToken:" + nextPageToken);
|
||||
const p = Object.assign(
|
||||
{ showDeleted: true, query: query, pageToken: nextPageToken },
|
||||
this.authParams
|
||||
this.authParams,
|
||||
);
|
||||
const delRes = await this.service.users.list(p);
|
||||
if (delRes.status !== 200) {
|
||||
@@ -148,7 +148,7 @@ export class GSuiteDirectoryService extends BaseDirectoryService implements IDir
|
||||
|
||||
private async getGroups(
|
||||
setFilter: [boolean, Set<string>],
|
||||
users: UserEntry[]
|
||||
users: UserEntry[],
|
||||
): Promise<GroupEntry[]> {
|
||||
const entries: GroupEntry[] = [];
|
||||
const query = this.createDirectoryQuery(this.syncConfig.groupFilter);
|
||||
|
||||
@@ -8,7 +8,7 @@ export class I18nService extends BaseI18nService {
|
||||
super(systemLanguage, localesDirectory, (formattedLocale: string) => {
|
||||
const filePath = path.join(
|
||||
__dirname,
|
||||
this.localesDirectory + "/" + formattedLocale + "/messages.json"
|
||||
this.localesDirectory + "/" + formattedLocale + "/messages.json",
|
||||
);
|
||||
const localesJson = fs.readFileSync(filePath, "utf8");
|
||||
const locales = JSON.parse(localesJson.replace(/^\uFEFF/, "")); // strip the BOM
|
||||
|
||||
@@ -26,7 +26,7 @@ export class LdapDirectoryService implements IDirectoryService {
|
||||
constructor(
|
||||
private logService: LogService,
|
||||
private i18nService: I18nService,
|
||||
private stateService: StateService
|
||||
private stateService: StateService,
|
||||
) {}
|
||||
|
||||
async getEntries(force: boolean, test: boolean): Promise<[GroupEntry[], UserEntry[]]> {
|
||||
@@ -75,7 +75,7 @@ export class LdapDirectoryService implements IDirectoryService {
|
||||
this.logService.info("User search: " + path + " => " + filter);
|
||||
|
||||
const regularUsers = await this.search<UserEntry>(path, filter, (se: any) =>
|
||||
this.buildUser(se, false)
|
||||
this.buildUser(se, false),
|
||||
);
|
||||
if (!this.dirConfig.ad) {
|
||||
return regularUsers;
|
||||
@@ -96,7 +96,7 @@ export class LdapDirectoryService implements IDirectoryService {
|
||||
deletedPath,
|
||||
deletedFilter,
|
||||
(se: any) => this.buildUser(se, true),
|
||||
[delControl]
|
||||
[delControl],
|
||||
);
|
||||
return regularUsers.concat(deletedUsers);
|
||||
} catch (e) {
|
||||
@@ -146,7 +146,7 @@ export class LdapDirectoryService implements IDirectoryService {
|
||||
const lastSync = await this.stateService.getLastUserSync();
|
||||
const originalFilter = this.buildBaseFilter(
|
||||
this.syncConfig.groupObjectClass,
|
||||
this.syncConfig.groupFilter
|
||||
this.syncConfig.groupFilter,
|
||||
);
|
||||
let filter = originalFilter;
|
||||
const revisionFilter = this.buildRevisionFilter(filter, force, lastSync);
|
||||
@@ -170,7 +170,7 @@ export class LdapDirectoryService implements IDirectoryService {
|
||||
|
||||
const userFilter = this.buildBaseFilter(
|
||||
this.syncConfig.userObjectClass,
|
||||
this.syncConfig.userFilter
|
||||
this.syncConfig.userFilter,
|
||||
);
|
||||
const userPath = this.makeSearchPath(this.syncConfig.userPath);
|
||||
const userIdMap = new Map<string, string>();
|
||||
@@ -321,7 +321,7 @@ export class LdapDirectoryService implements IDirectoryService {
|
||||
path: string,
|
||||
filter: string,
|
||||
processEntry: (searchEntry: any) => T,
|
||||
controls: ldap.Control[] = []
|
||||
controls: ldap.Control[] = [],
|
||||
): Promise<T[]> {
|
||||
const options: ldap.SearchOptions = {
|
||||
filter: filter,
|
||||
|
||||
@@ -10,7 +10,7 @@ export class LowdbStorageService extends LowdbStorageServiceBase {
|
||||
defaults?: any,
|
||||
dir?: string,
|
||||
allowCache = false,
|
||||
private requireLock = false
|
||||
private requireLock = false,
|
||||
) {
|
||||
super(logService, defaults, dir, allowCache);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export class OktaDirectoryService extends BaseDirectoryService implements IDirec
|
||||
constructor(
|
||||
private logService: LogService,
|
||||
private i18nService: I18nService,
|
||||
private stateService: StateService
|
||||
private stateService: StateService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
@@ -71,7 +71,7 @@ export class OktaDirectoryService extends BaseDirectoryService implements IDirec
|
||||
|
||||
this.logService.info("Querying users.");
|
||||
const usersPromise = this.apiGetMany(
|
||||
"users?filter=" + this.encodeUrlParameter(oktaFilter)
|
||||
"users?filter=" + this.encodeUrlParameter(oktaFilter),
|
||||
).then((users: any[]) => {
|
||||
for (const user of users) {
|
||||
const entry = this.buildUser(user);
|
||||
@@ -89,7 +89,7 @@ export class OktaDirectoryService extends BaseDirectoryService implements IDirec
|
||||
deactOktaFilter = "(" + oktaFilter + ") and " + deactOktaFilter;
|
||||
}
|
||||
deactUsersPromise = this.apiGetMany(
|
||||
"users?filter=" + this.encodeUrlParameter(deactOktaFilter)
|
||||
"users?filter=" + this.encodeUrlParameter(deactOktaFilter),
|
||||
).then((users: any[]) => {
|
||||
for (const user of users) {
|
||||
const entry = this.buildUser(user);
|
||||
@@ -118,7 +118,7 @@ export class OktaDirectoryService extends BaseDirectoryService implements IDirec
|
||||
|
||||
private async getGroups(
|
||||
force: boolean,
|
||||
setFilter: [boolean, Set<string>]
|
||||
setFilter: [boolean, Set<string>],
|
||||
): Promise<GroupEntry[]> {
|
||||
const entries: GroupEntry[] = [];
|
||||
const lastSync = await this.stateService.getLastGroupSync();
|
||||
@@ -128,14 +128,14 @@ export class OktaDirectoryService extends BaseDirectoryService implements IDirec
|
||||
await this.apiGetMany("groups?filter=" + this.encodeUrlParameter(oktaFilter)).then(
|
||||
async (groups: any[]) => {
|
||||
for (const group of groups.filter(
|
||||
(g) => !this.filterOutResult(setFilter, g.profile.name)
|
||||
(g) => !this.filterOutResult(setFilter, g.profile.name),
|
||||
)) {
|
||||
const entry = await this.buildGroup(group);
|
||||
if (entry != null) {
|
||||
entries.push(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
return entries;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ export class OktaDirectoryService extends BaseDirectoryService implements IDirec
|
||||
res.on("error", () => {
|
||||
resolve(null);
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export class OneLoginDirectoryService extends BaseDirectoryService implements ID
|
||||
constructor(
|
||||
private logService: LogService,
|
||||
private i18nService: I18nService,
|
||||
private stateService: StateService
|
||||
private stateService: StateService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
@@ -35,7 +35,7 @@ export class OneLoginDirectoryService extends BaseDirectoryService implements ID
|
||||
}
|
||||
|
||||
this.dirConfig = await this.stateService.getDirectory<OneLoginConfiguration>(
|
||||
DirectoryType.OneLogin
|
||||
DirectoryType.OneLogin,
|
||||
);
|
||||
if (this.dirConfig == null) {
|
||||
return;
|
||||
@@ -110,7 +110,7 @@ export class OneLoginDirectoryService extends BaseDirectoryService implements ID
|
||||
|
||||
private async getGroups(
|
||||
force: boolean,
|
||||
setFilter: [boolean, Set<string>]
|
||||
setFilter: [boolean, Set<string>],
|
||||
): Promise<GroupEntry[]> {
|
||||
const entries: GroupEntry[] = [];
|
||||
const query = this.createDirectoryQuery(this.syncConfig.groupFilter);
|
||||
@@ -156,7 +156,7 @@ export class OneLoginDirectoryService extends BaseDirectoryService implements ID
|
||||
body: JSON.stringify({
|
||||
grant_type: "client_credentials",
|
||||
}),
|
||||
}
|
||||
},
|
||||
);
|
||||
if (response.status === 200) {
|
||||
const responseJson = await response.json();
|
||||
|
||||
@@ -49,7 +49,7 @@ export class StateService
|
||||
protected logService: LogService,
|
||||
protected stateMigrationService: StateMigrationService,
|
||||
private useSecureStorageForSecrets = true,
|
||||
protected stateFactory: StateFactory<GlobalState, Account>
|
||||
protected stateFactory: StateFactory<GlobalState, Account>,
|
||||
) {
|
||||
super(storageService, secureStorageService, logService, stateMigrationService, stateFactory);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ export class StateService
|
||||
| GSuiteConfiguration
|
||||
| AzureConfiguration
|
||||
| OktaConfiguration
|
||||
| OneLoginConfiguration
|
||||
| OneLoginConfiguration,
|
||||
): Promise<any> {
|
||||
if (this.useSecureStorageForSecrets) {
|
||||
switch (type) {
|
||||
@@ -149,7 +149,7 @@ export class StateService
|
||||
return null;
|
||||
}
|
||||
return await this.secureStorageService.get<string>(
|
||||
`${options.userId}_${SecureStorageKeys.ldap}`
|
||||
`${options.userId}_${SecureStorageKeys.ldap}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ export class StateService
|
||||
await this.secureStorageService.save(
|
||||
`${options.userId}_${SecureStorageKeys.ldap}`,
|
||||
value,
|
||||
options
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ export class StateService
|
||||
return null;
|
||||
}
|
||||
return await this.secureStorageService.get<string>(
|
||||
`${options.userId}_${SecureStorageKeys.gsuite}`
|
||||
`${options.userId}_${SecureStorageKeys.gsuite}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ export class StateService
|
||||
await this.secureStorageService.save(
|
||||
`${options.userId}_${SecureStorageKeys.gsuite}`,
|
||||
value,
|
||||
options
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ export class StateService
|
||||
return null;
|
||||
}
|
||||
return await this.secureStorageService.get<string>(
|
||||
`${options.userId}_${SecureStorageKeys.azure}`
|
||||
`${options.userId}_${SecureStorageKeys.azure}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ export class StateService
|
||||
await this.secureStorageService.save(
|
||||
`${options.userId}_${SecureStorageKeys.azure}`,
|
||||
value,
|
||||
options
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ export class StateService
|
||||
return null;
|
||||
}
|
||||
return await this.secureStorageService.get<string>(
|
||||
`${options.userId}_${SecureStorageKeys.okta}`
|
||||
`${options.userId}_${SecureStorageKeys.okta}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ export class StateService
|
||||
await this.secureStorageService.save(
|
||||
`${options.userId}_${SecureStorageKeys.okta}`,
|
||||
value,
|
||||
options
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ export class StateService
|
||||
return null;
|
||||
}
|
||||
return await this.secureStorageService.get<string>(
|
||||
`${options.userId}_${SecureStorageKeys.oneLogin}`
|
||||
`${options.userId}_${SecureStorageKeys.oneLogin}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ export class StateService
|
||||
await this.secureStorageService.save(
|
||||
`${options.userId}_${SecureStorageKeys.oneLogin}`,
|
||||
value,
|
||||
options
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -276,12 +276,12 @@ export class StateService
|
||||
|
||||
async setLdapConfiguration(value: LdapConfiguration, options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.directoryConfigurations.ldap = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -293,15 +293,15 @@ export class StateService
|
||||
|
||||
async setGsuiteConfiguration(
|
||||
value: GSuiteConfiguration,
|
||||
options?: StorageOptions
|
||||
options?: StorageOptions,
|
||||
): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.directoryConfigurations.gsuite = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -313,12 +313,12 @@ export class StateService
|
||||
|
||||
async setAzureConfiguration(value: AzureConfiguration, options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.directoryConfigurations.azure = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -330,12 +330,12 @@ export class StateService
|
||||
|
||||
async setOktaConfiguration(value: OktaConfiguration, options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.directoryConfigurations.okta = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -347,15 +347,15 @@ export class StateService
|
||||
|
||||
async setOneLoginConfiguration(
|
||||
value: OneLoginConfiguration,
|
||||
options?: StorageOptions
|
||||
options?: StorageOptions,
|
||||
): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.directoryConfigurations.oneLogin = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -372,12 +372,12 @@ export class StateService
|
||||
}
|
||||
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.directorySettings.organizationId = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -389,12 +389,12 @@ export class StateService
|
||||
|
||||
async setSync(value: SyncConfiguration, options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.directorySettings.sync = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -410,12 +410,12 @@ export class StateService
|
||||
await this.clearSyncSettings();
|
||||
}
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.directorySettings.directoryType = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -428,12 +428,12 @@ export class StateService
|
||||
|
||||
async setLastUserSync(value: Date, options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.directorySettings.lastUserSync = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -446,12 +446,12 @@ export class StateService
|
||||
|
||||
async setLastGroupSync(value: Date, options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.directorySettings.lastGroupSync = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -463,12 +463,12 @@ export class StateService
|
||||
|
||||
async setLastSyncHash(value: string, options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.directorySettings.lastSyncHash = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ export class StateService
|
||||
|
||||
async setSyncingDir(value: boolean, options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, this.defaultInMemoryOptions)
|
||||
this.reconcileOptions(options, this.defaultInMemoryOptions),
|
||||
);
|
||||
account.directorySettings.syncingDir = value;
|
||||
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
|
||||
@@ -493,12 +493,12 @@ export class StateService
|
||||
|
||||
async setUserDelta(value: string, options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.directorySettings.userDelta = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -510,12 +510,12 @@ export class StateService
|
||||
|
||||
async setGroupDelta(value: string, options?: StorageOptions): Promise<void> {
|
||||
const account = await this.getAccount(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
account.directorySettings.groupDelta = value;
|
||||
await this.saveAccount(
|
||||
account,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions())
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -536,7 +536,7 @@ export class StateService
|
||||
protected async scaffoldNewAccountDiskStorage(account: Account): Promise<void> {
|
||||
const storageOptions = this.reconcileOptions(
|
||||
{ userId: account.profile.userId },
|
||||
await this.defaultOnDiskLocalOptions()
|
||||
await this.defaultOnDiskLocalOptions(),
|
||||
);
|
||||
|
||||
const storedAccount = await this.getAccount(storageOptions);
|
||||
@@ -549,7 +549,7 @@ export class StateService
|
||||
account.settings = await this.storageService.get<any>(keys.tempAccountSettings);
|
||||
account.directorySettings = await this.storageService.get<any>(keys.tempDirectorySettings);
|
||||
account.directoryConfigurations = await this.storageService.get<any>(
|
||||
keys.tempDirectoryConfigs
|
||||
keys.tempDirectoryConfigs,
|
||||
);
|
||||
await this.storageService.remove(keys.tempAccountSettings);
|
||||
await this.storageService.remove(keys.tempDirectorySettings);
|
||||
|
||||
@@ -157,7 +157,7 @@ export class StateMigrationService extends BaseStateMigrationService {
|
||||
if (await this.secureStorageService.has(SecureStorageKeys[key])) {
|
||||
await this.secureStorageService.save(
|
||||
`${userId}_${SecureStorageKeys[key]}`,
|
||||
await this.secureStorageService.get(SecureStorageKeys[key])
|
||||
await this.secureStorageService.get(SecureStorageKeys[key]),
|
||||
);
|
||||
await this.secureStorageService.remove(SecureStorageKeys[key]);
|
||||
}
|
||||
@@ -175,18 +175,18 @@ export class StateMigrationService extends BaseStateMigrationService {
|
||||
// Fix for userDelta and groupDelta being put into secure storage when they should not have
|
||||
if (await this.secureStorageService.has(`${userId}_${Keys.userDelta}`)) {
|
||||
account.directorySettings.userDelta = await this.secureStorageService.get(
|
||||
`${userId}_${Keys.userDelta}`
|
||||
`${userId}_${Keys.userDelta}`,
|
||||
);
|
||||
await this.secureStorageService.remove(`${userId}_${Keys.userDelta}`);
|
||||
}
|
||||
if (await this.secureStorageService.has(`${userId}_${Keys.groupDelta}`)) {
|
||||
account.directorySettings.groupDelta = await this.secureStorageService.get(
|
||||
`${userId}_${Keys.groupDelta}`
|
||||
`${userId}_${Keys.groupDelta}`,
|
||||
);
|
||||
await this.secureStorageService.remove(`${userId}_${Keys.groupDelta}`);
|
||||
}
|
||||
await this.set(userId, account);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ export class SyncService {
|
||||
private messagingService: MessagingService,
|
||||
private i18nService: I18nService,
|
||||
private environmentService: EnvironmentService,
|
||||
private stateService: StateService
|
||||
private stateService: StateService,
|
||||
) {}
|
||||
|
||||
async sync(force: boolean, test: boolean): Promise<[GroupEntry[], UserEntry[]]> {
|
||||
@@ -53,7 +53,7 @@ export class SyncService {
|
||||
try {
|
||||
const entries = await directoryService.getEntries(
|
||||
force || syncConfig.overwriteExisting,
|
||||
test
|
||||
test,
|
||||
);
|
||||
let groups = entries[0];
|
||||
let users = this.filterUnsupportedUsers(entries[1]);
|
||||
@@ -83,7 +83,7 @@ export class SyncService {
|
||||
users,
|
||||
syncConfig.removeDisabled,
|
||||
syncConfig.overwriteExisting,
|
||||
syncConfig.largeImport
|
||||
syncConfig.largeImport,
|
||||
);
|
||||
const reqJson = JSON.stringify(req);
|
||||
|
||||
@@ -96,7 +96,7 @@ export class SyncService {
|
||||
let hashLegacy: string = null;
|
||||
const hashBuffLegacy = await this.cryptoFunctionService.hash(
|
||||
this.environmentService.getApiUrl() + reqJson,
|
||||
"sha256"
|
||||
"sha256",
|
||||
);
|
||||
if (hashBuffLegacy != null) {
|
||||
hashLegacy = Utils.fromBufferToB64(hashBuffLegacy);
|
||||
@@ -104,7 +104,7 @@ export class SyncService {
|
||||
let hash: string = null;
|
||||
const hashBuff = await this.cryptoFunctionService.hash(
|
||||
this.environmentService.getApiUrl() + orgId + reqJson,
|
||||
"sha256"
|
||||
"sha256",
|
||||
);
|
||||
if (hashBuff != null) {
|
||||
hash = Utils.fromBufferToB64(hashBuff);
|
||||
@@ -220,7 +220,7 @@ export class SyncService {
|
||||
users: UserEntry[],
|
||||
removeDisabled: boolean,
|
||||
overwriteExisting: boolean,
|
||||
largeImport = false
|
||||
largeImport = false,
|
||||
) {
|
||||
return new OrganizationImportRequest({
|
||||
groups: (groups ?? []).map((g) => {
|
||||
|
||||
@@ -11,7 +11,7 @@ export class ConnectorUtils {
|
||||
static async simulate(
|
||||
syncService: SyncService,
|
||||
i18nService: I18nService,
|
||||
sinceLast: boolean
|
||||
sinceLast: boolean,
|
||||
): Promise<SimResult> {
|
||||
// eslint-disable-next-line
|
||||
return new Promise(async (resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user