mirror of
https://github.com/bitwarden/browser
synced 2025-12-25 20:53:22 +00:00
[deps] Autofill: Update prettier to v3 (#7014)
* [deps] Autofill: Update prettier to v3 * prettier formatting updates --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
This commit is contained in:
@@ -4,5 +4,8 @@ export class AdminAuthRequestUpdateRequest {
|
||||
* @param requestApproved - Whether the request was approved/denied. If true, the key must be provided.
|
||||
* @param encryptedUserKey The user key that has been encrypted with a device public key if the request was approved.
|
||||
*/
|
||||
constructor(public requestApproved: boolean, public encryptedUserKey?: string) {}
|
||||
constructor(
|
||||
public requestApproved: boolean,
|
||||
public encryptedUserKey?: string,
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export class OrganizationAuthRequestService {
|
||||
`/organizations/${organizationId}/auth-requests`,
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
const listResponse = new ListResponse(r, PendingOrganizationAuthRequestResponse);
|
||||
@@ -34,21 +34,21 @@ export class OrganizationAuthRequestService {
|
||||
`/organizations/${organizationId}/auth-requests/deny`,
|
||||
new BulkDenyAuthRequestsRequest(requestIds),
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
async approvePendingRequest(
|
||||
organizationId: string,
|
||||
requestId: string,
|
||||
encryptedKey: EncString
|
||||
encryptedKey: EncString,
|
||||
): Promise<void> {
|
||||
await this.apiService.send(
|
||||
"POST",
|
||||
`/organizations/${organizationId}/auth-requests/${requestId}`,
|
||||
new AdminAuthRequestUpdateRequest(true, encryptedKey.encryptedString),
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,14 +46,14 @@
|
||||
<tr bitRow alignContent="top" *ngFor="let r of rows$ | async">
|
||||
<td bitCell class="tw-flex-col">
|
||||
<div>{{ r.email }}</div>
|
||||
<code class="tw-text-sm">{{ r.publicKey | fingerprint : r.email | async }}</code>
|
||||
<code class="tw-text-sm">{{ r.publicKey | fingerprint: r.email | async }}</code>
|
||||
</td>
|
||||
<td bitCell class="tw-flex-col">
|
||||
<div>{{ r.requestDeviceType }}</div>
|
||||
<div class="tw-text-sm">{{ r.requestIpAddress }}</div>
|
||||
</td>
|
||||
<td bitCell class="tw-flex-col tw-text-muted">
|
||||
{{ r.creationDate | date : "medium" }}
|
||||
{{ r.creationDate | date: "medium" }}
|
||||
</td>
|
||||
<td bitCell class="tw-align-middle">
|
||||
<button
|
||||
|
||||
@@ -41,7 +41,7 @@ export class DeviceApprovalsComponent implements OnInit, OnDestroy {
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService,
|
||||
private logService: LogService,
|
||||
private validationService: ValidationService
|
||||
private validationService: ValidationService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -52,11 +52,11 @@ export class DeviceApprovalsComponent implements OnInit, OnDestroy {
|
||||
this.refresh$.pipe(
|
||||
tap(() => (this.loading = true)),
|
||||
switchMap(() =>
|
||||
this.organizationAuthRequestService.listPendingRequests(this.organizationId)
|
||||
)
|
||||
)
|
||||
this.organizationAuthRequestService.listPendingRequests(this.organizationId),
|
||||
),
|
||||
),
|
||||
),
|
||||
takeUntil(this.destroy$)
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe((r) => {
|
||||
this.tableDataSource.data = r;
|
||||
@@ -72,7 +72,7 @@ export class DeviceApprovalsComponent implements OnInit, OnDestroy {
|
||||
*/
|
||||
private async getEncryptedUserKey(
|
||||
devicePublicKey: string,
|
||||
resetPasswordDetails: OrganizationUserResetPasswordDetailsResponse
|
||||
resetPasswordDetails: OrganizationUserResetPasswordDetailsResponse,
|
||||
): Promise<EncString> {
|
||||
const encryptedUserKey = resetPasswordDetails.resetPasswordKey;
|
||||
const encryptedOrgPrivateKey = resetPasswordDetails.encryptedPrivateKey;
|
||||
@@ -82,7 +82,7 @@ export class DeviceApprovalsComponent implements OnInit, OnDestroy {
|
||||
const orgSymKey = await this.cryptoService.getOrgKey(this.organizationId);
|
||||
const decOrgPrivateKey = await this.cryptoService.decryptToBytes(
|
||||
new EncString(encryptedOrgPrivateKey),
|
||||
orgSymKey
|
||||
orgSymKey,
|
||||
);
|
||||
|
||||
// Decrypt user key with decrypted org private key
|
||||
@@ -97,7 +97,7 @@ export class DeviceApprovalsComponent implements OnInit, OnDestroy {
|
||||
await this.performAsyncAction(async () => {
|
||||
const details = await this.organizationUserService.getOrganizationUserResetPasswordDetails(
|
||||
this.organizationId,
|
||||
authRequest.organizationUserId
|
||||
authRequest.organizationUserId,
|
||||
);
|
||||
|
||||
// The user must be enrolled in account recovery (password reset) in order for the request to be approved.
|
||||
@@ -105,7 +105,7 @@ export class DeviceApprovalsComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("resetPasswordDetailsError")
|
||||
this.i18nService.t("resetPasswordDetailsError"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -115,13 +115,13 @@ export class DeviceApprovalsComponent implements OnInit, OnDestroy {
|
||||
await this.organizationAuthRequestService.approvePendingRequest(
|
||||
this.organizationId,
|
||||
authRequest.id,
|
||||
encryptedKey
|
||||
encryptedKey,
|
||||
);
|
||||
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("loginRequestApproved")
|
||||
this.i18nService.t("loginRequestApproved"),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -141,12 +141,12 @@ export class DeviceApprovalsComponent implements OnInit, OnDestroy {
|
||||
await this.performAsyncAction(async () => {
|
||||
await this.organizationAuthRequestService.denyPendingRequests(
|
||||
this.organizationId,
|
||||
...this.tableDataSource.data.map((r) => r.id)
|
||||
...this.tableDataSource.data.map((r) => r.id),
|
||||
);
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("allLoginRequestsDenied")
|
||||
this.i18nService.t("allLoginRequestsDenied"),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||
domainNameValidator(this.i18nService.t("invalidDomainNameMessage")),
|
||||
uniqueInArrayValidator(
|
||||
this.data.existingDomainNames,
|
||||
this.i18nService.t("duplicateDomainError")
|
||||
this.i18nService.t("duplicateDomainError"),
|
||||
),
|
||||
],
|
||||
],
|
||||
@@ -66,7 +66,7 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||
private orgDomainApiService: OrgDomainApiServiceAbstraction,
|
||||
private orgDomainService: OrgDomainServiceAbstraction,
|
||||
private validationService: ValidationService,
|
||||
private dialogService: DialogService
|
||||
private dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
// Angular Method Implementations
|
||||
@@ -98,7 +98,7 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||
// Google uses 43 chars for their TXT record value: https://support.google.com/a/answer/2716802
|
||||
// So, chose a magic # of 33 bytes to achieve at least that once converted to base 64 (47 char length).
|
||||
const generatedTxt = `bw=${Utils.fromBufferToB64(
|
||||
await this.cryptoFunctionService.randomBytes(33)
|
||||
await this.cryptoFunctionService.randomBytes(33),
|
||||
)}`;
|
||||
this.txtCtrl.setValue(generatedTxt);
|
||||
}
|
||||
@@ -131,7 +131,7 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||
|
||||
const request: OrganizationDomainRequest = new OrganizationDomainRequest(
|
||||
this.txtCtrl.value,
|
||||
this.domainNameCtrl.value
|
||||
this.domainNameCtrl.value,
|
||||
);
|
||||
|
||||
try {
|
||||
@@ -162,7 +162,7 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.rejectedDomainNameValidator = uniqueInArrayValidator(
|
||||
this.rejectedDomainNames,
|
||||
this.i18nService.t("domainNotAvailable", this.domainNameCtrl.value)
|
||||
this.i18nService.t("domainNotAvailable", this.domainNameCtrl.value),
|
||||
);
|
||||
|
||||
this.domainNameCtrl.addValidators(this.rejectedDomainNameValidator);
|
||||
@@ -195,7 +195,7 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||
try {
|
||||
this.data.orgDomain = await this.orgDomainApiService.verify(
|
||||
this.data.organizationId,
|
||||
this.data.orgDomain.id
|
||||
this.data.orgDomain.id,
|
||||
);
|
||||
|
||||
if (this.data.orgDomain.verifiedDate) {
|
||||
@@ -245,7 +245,7 @@ export class DomainAddEditDialogComponent implements OnInit, OnDestroy {
|
||||
// Update this item so the last checked date gets updated.
|
||||
await this.orgDomainApiService.getByOrgIdAndOrgDomainId(
|
||||
this.data.organizationId,
|
||||
this.data.orgDomain.id
|
||||
this.data.orgDomain.id,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
}}</span>
|
||||
</td>
|
||||
<td bitCell class="tw-text-muted">
|
||||
{{ orgDomain.lastCheckedDate | date : "medium" }}
|
||||
{{ orgDomain.lastCheckedDate | date: "medium" }}
|
||||
</td>
|
||||
|
||||
<td bitCell class="table-list-options tw-text-right">
|
||||
|
||||
@@ -36,7 +36,7 @@ export class DomainVerificationComponent implements OnInit, OnDestroy {
|
||||
private orgDomainApiService: OrgDomainApiServiceAbstraction,
|
||||
private orgDomainService: OrgDomainServiceAbstraction,
|
||||
private dialogService: DialogService,
|
||||
private validationService: ValidationService
|
||||
private validationService: ValidationService,
|
||||
) {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
@@ -52,7 +52,7 @@ export class DomainVerificationComponent implements OnInit, OnDestroy {
|
||||
this.organizationId = params.organizationId;
|
||||
await this.load();
|
||||
}),
|
||||
takeUntil(this.componentDestroyed$)
|
||||
takeUntil(this.componentDestroyed$),
|
||||
)
|
||||
.subscribe();
|
||||
}
|
||||
@@ -106,7 +106,7 @@ export class DomainVerificationComponent implements OnInit, OnDestroy {
|
||||
try {
|
||||
const orgDomain: OrganizationDomainResponse = await this.orgDomainApiService.verify(
|
||||
this.organizationId,
|
||||
orgDomainId
|
||||
orgDomainId,
|
||||
);
|
||||
|
||||
if (orgDomain.verifiedDate) {
|
||||
@@ -115,7 +115,7 @@ export class DomainVerificationComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("domainNotVerified", domainName)
|
||||
this.i18nService.t("domainNotVerified", domainName),
|
||||
);
|
||||
// Update this item so the last checked date gets updated.
|
||||
await this.updateOrgDomain(orgDomainId);
|
||||
@@ -141,7 +141,7 @@ export class DomainVerificationComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("domainNotAvailable", domainName)
|
||||
this.i18nService.t("domainNotAvailable", domainName),
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -47,7 +47,7 @@ export class ScimComponent implements OnInit {
|
||||
private i18nService: I18nService,
|
||||
private environmentService: EnvironmentService,
|
||||
private organizationApiService: OrganizationApiServiceAbstraction,
|
||||
private dialogService: DialogService
|
||||
private dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -62,7 +62,7 @@ export class ScimComponent implements OnInit {
|
||||
const connection = await this.apiService.getOrganizationConnection(
|
||||
this.organizationId,
|
||||
OrganizationConnectionType.Scim,
|
||||
ScimConfigApi
|
||||
ScimConfigApi,
|
||||
);
|
||||
await this.setConnectionFormValues(connection);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ export class ScimComponent implements OnInit {
|
||||
apiKeyRequest.masterPasswordHash = "N/A";
|
||||
const apiKeyResponse = await this.organizationApiService.getOrCreateApiKey(
|
||||
this.organizationId,
|
||||
apiKeyRequest
|
||||
apiKeyRequest,
|
||||
);
|
||||
this.formData.setValue({
|
||||
endpointUrl: this.getScimEndpointUrl(),
|
||||
@@ -127,7 +127,7 @@ export class ScimComponent implements OnInit {
|
||||
this.organizationId,
|
||||
OrganizationConnectionType.Scim,
|
||||
true,
|
||||
new ScimConfigRequest(this.enabled.value)
|
||||
new ScimConfigRequest(this.enabled.value),
|
||||
);
|
||||
if (this.existingConnectionId == null) {
|
||||
this.formPromise = this.apiService.createOrganizationConnection(request, ScimConfigApi);
|
||||
@@ -135,7 +135,7 @@ export class ScimComponent implements OnInit {
|
||||
this.formPromise = this.apiService.updateOrganizationConnection(
|
||||
request,
|
||||
ScimConfigApi,
|
||||
this.existingConnectionId
|
||||
this.existingConnectionId,
|
||||
);
|
||||
}
|
||||
const response = (await this.formPromise) as OrganizationConnectionResponse<ScimConfigApi>;
|
||||
|
||||
@@ -29,7 +29,10 @@ export class MaximumVaultTimeoutPolicyComponent extends BasePolicyComponent {
|
||||
action: new FormControl<string>(null),
|
||||
});
|
||||
|
||||
constructor(private formBuilder: FormBuilder, private i18nService: I18nService) {
|
||||
constructor(
|
||||
private formBuilder: FormBuilder,
|
||||
private i18nService: I18nService,
|
||||
) {
|
||||
super();
|
||||
this.vaultTimeoutActionOptions = [
|
||||
{ name: i18nService.t("userPreference"), value: null },
|
||||
|
||||
@@ -31,7 +31,7 @@ export class AddOrganizationComponent implements OnInit {
|
||||
private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private validationService: ValidationService,
|
||||
private dialogService: DialogService
|
||||
private dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -66,7 +66,7 @@ export class AddOrganizationComponent implements OnInit {
|
||||
try {
|
||||
await this.webProviderService.addOrganizationToProvider(
|
||||
this.data.providerId,
|
||||
organization.id
|
||||
organization.id,
|
||||
);
|
||||
} catch (e) {
|
||||
this.validationService.showError(e);
|
||||
@@ -76,7 +76,7 @@ export class AddOrganizationComponent implements OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("organizationJoinedProvider")
|
||||
this.i18nService.t("organizationJoinedProvider"),
|
||||
);
|
||||
|
||||
this.dialogRef.close(true);
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</ng-container>
|
||||
|
||||
<ng-container
|
||||
*ngIf="!loading && (clients | search : searchText : 'organizationName' : 'id') as searchedClients"
|
||||
*ngIf="!loading && (clients | search: searchText : 'organizationName' : 'id') as searchedClients"
|
||||
>
|
||||
<p *ngIf="!searchedClients.length">{{ "noClientsInList" | i18n }}</p>
|
||||
<ng-container *ngIf="searchedClients.length">
|
||||
|
||||
@@ -63,7 +63,7 @@ export class ClientsComponent implements OnInit {
|
||||
private modalService: ModalService,
|
||||
private organizationService: OrganizationService,
|
||||
private organizationApiService: OrganizationApiServiceAbstraction,
|
||||
private dialogService: DialogService
|
||||
private dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -86,12 +86,12 @@ export class ClientsComponent implements OnInit {
|
||||
this.manageOrganizations =
|
||||
(await this.providerService.get(this.providerId)).type === ProviderUserType.ProviderAdmin;
|
||||
const candidateOrgs = (await this.organizationService.getAll()).filter(
|
||||
(o) => o.isOwner && o.providerId == null
|
||||
(o) => o.isOwner && o.providerId == null,
|
||||
);
|
||||
const allowedOrgsIds = await Promise.all(
|
||||
candidateOrgs.map((o) => this.organizationApiService.get(o.id))
|
||||
candidateOrgs.map((o) => this.organizationApiService.get(o.id)),
|
||||
).then((orgs) =>
|
||||
orgs.filter((o) => !DisallowedPlanTypes.includes(o.planType)).map((o) => o.id)
|
||||
orgs.filter((o) => !DisallowedPlanTypes.includes(o.planType)).map((o) => o.id),
|
||||
);
|
||||
this.addableOrganizations = candidateOrgs.filter((o) => allowedOrgsIds.includes(o.id));
|
||||
|
||||
@@ -127,7 +127,7 @@ export class ClientsComponent implements OnInit {
|
||||
}
|
||||
if (this.clients.length > pagedLength) {
|
||||
this.pagedClients = this.pagedClients.concat(
|
||||
this.clients.slice(pagedLength, pagedLength + pagedSize)
|
||||
this.clients.slice(pagedLength, pagedLength + pagedSize),
|
||||
);
|
||||
}
|
||||
this.pagedClientsCount = this.pagedClients.length;
|
||||
@@ -158,14 +158,14 @@ export class ClientsComponent implements OnInit {
|
||||
|
||||
this.actionPromise = this.webProviderService.detachOrganization(
|
||||
this.providerId,
|
||||
organization.id
|
||||
organization.id,
|
||||
);
|
||||
try {
|
||||
await this.actionPromise;
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("detachedOrganization", organization.organizationName)
|
||||
this.i18nService.t("detachedOrganization", organization.organizationName),
|
||||
);
|
||||
await this.load();
|
||||
} catch (e) {
|
||||
|
||||
@@ -17,7 +17,7 @@ const providerFactory = (props: Partial<Provider> = {}) =>
|
||||
enabled: true,
|
||||
type: ProviderUserType.ServiceUser,
|
||||
},
|
||||
props
|
||||
props,
|
||||
);
|
||||
|
||||
describe("Provider Permissions Guard", () => {
|
||||
@@ -43,7 +43,7 @@ describe("Provider Permissions Guard", () => {
|
||||
providerService,
|
||||
router,
|
||||
mock<PlatformUtilsService>(),
|
||||
mock<I18nService>()
|
||||
mock<I18nService>(),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ export class ProviderPermissionsGuard implements CanActivate {
|
||||
private providerService: ProviderService,
|
||||
private router: Router,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService
|
||||
private i18nService: I18nService,
|
||||
) {}
|
||||
|
||||
async canActivate(route: ActivatedRouteSnapshot) {
|
||||
|
||||
@@ -25,7 +25,7 @@ export class AcceptProviderComponent extends BaseAcceptComponent {
|
||||
route: ActivatedRoute,
|
||||
stateService: StateService,
|
||||
private apiService: ApiService,
|
||||
platformUtilService: PlatformUtilsService
|
||||
platformUtilService: PlatformUtilsService,
|
||||
) {
|
||||
super(router, platformUtilService, i18nService, route, stateService);
|
||||
}
|
||||
@@ -37,13 +37,13 @@ export class AcceptProviderComponent extends BaseAcceptComponent {
|
||||
await this.apiService.postProviderUserAccept(
|
||||
qParams.providerId,
|
||||
qParams.providerUserId,
|
||||
request
|
||||
request,
|
||||
);
|
||||
this.platformUtilService.showToast(
|
||||
"success",
|
||||
this.i18nService.t("inviteAccepted"),
|
||||
this.i18nService.t("providerInviteAcceptedDesc"),
|
||||
{ timeout: 10000 }
|
||||
{ timeout: 10000 },
|
||||
);
|
||||
this.router.navigate(["/vault"]);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let e of events">
|
||||
<td>{{ e.date | date : "medium" }}</td>
|
||||
<td>{{ e.date | date: "medium" }}</td>
|
||||
<td>
|
||||
<i
|
||||
class="text-muted bwi bwi-lg {{ e.appIcon }}"
|
||||
|
||||
@@ -36,7 +36,7 @@ export class EventsComponent extends BaseEventsComponent implements OnInit {
|
||||
private router: Router,
|
||||
logService: LogService,
|
||||
private userNamePipe: UserNamePipe,
|
||||
fileDownloadService: FileDownloadService
|
||||
fileDownloadService: FileDownloadService,
|
||||
) {
|
||||
super(
|
||||
eventService,
|
||||
@@ -44,7 +44,7 @@ export class EventsComponent extends BaseEventsComponent implements OnInit {
|
||||
exportService,
|
||||
platformUtilsService,
|
||||
logService,
|
||||
fileDownloadService
|
||||
fileDownloadService,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ export class EventsComponent extends BaseEventsComponent implements OnInit {
|
||||
this.providerId,
|
||||
startDate,
|
||||
endDate,
|
||||
continuationToken
|
||||
continuationToken,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,10 @@ export class ManageComponent implements OnInit {
|
||||
provider: Provider;
|
||||
accessEvents = false;
|
||||
|
||||
constructor(private route: ActivatedRoute, private providerService: ProviderService) {}
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private providerService: ProviderService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
!loading &&
|
||||
(isPaging()
|
||||
? pagedUsers
|
||||
: (users | search : searchText : 'name' : 'email' : 'id')) as searchedUsers
|
||||
: (users | search: searchText : 'name' : 'email' : 'id')) as searchedUsers
|
||||
"
|
||||
>
|
||||
<p *ngIf="!searchedUsers.length">{{ "noUsersInList" | i18n }}</p>
|
||||
|
||||
@@ -69,7 +69,7 @@ export class PeopleComponent
|
||||
userNamePipe: UserNamePipe,
|
||||
stateService: StateService,
|
||||
private providerService: ProviderService,
|
||||
dialogService: DialogService
|
||||
dialogService: DialogService,
|
||||
) {
|
||||
super(
|
||||
apiService,
|
||||
@@ -83,7 +83,7 @@ export class PeopleComponent
|
||||
searchPipe,
|
||||
userNamePipe,
|
||||
stateService,
|
||||
dialogService
|
||||
dialogService,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ export class PeopleComponent
|
||||
modal.close();
|
||||
this.removeUser(user);
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ export class PeopleComponent
|
||||
(comp) => {
|
||||
comp.providerId = this.providerId;
|
||||
comp.users = this.getCheckedUsers();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
await modal.onClosedPromise();
|
||||
@@ -207,7 +207,7 @@ export class PeopleComponent
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("noSelectedUsersApplicable")
|
||||
this.i18nService.t("noSelectedUsersApplicable"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -219,7 +219,7 @@ export class PeopleComponent
|
||||
users,
|
||||
filteredUsers,
|
||||
response,
|
||||
this.i18nService.t("bulkReinviteMessage")
|
||||
this.i18nService.t("bulkReinviteMessage"),
|
||||
);
|
||||
} catch (e) {
|
||||
this.validationService.showError(e);
|
||||
@@ -238,7 +238,7 @@ export class PeopleComponent
|
||||
(comp) => {
|
||||
comp.providerId = this.providerId;
|
||||
comp.users = this.getCheckedUsers();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
await modal.onClosedPromise();
|
||||
@@ -249,14 +249,14 @@ export class PeopleComponent
|
||||
users: ProviderUserUserDetailsResponse[],
|
||||
filteredUsers: ProviderUserUserDetailsResponse[],
|
||||
request: Promise<ListResponse<ProviderUserBulkResponse>>,
|
||||
successfullMessage: string
|
||||
successfullMessage: string,
|
||||
) {
|
||||
const [modal, childComponent] = await this.modalService.openViewRef(
|
||||
BulkStatusComponent,
|
||||
this.bulkStatusModalRef,
|
||||
(comp) => {
|
||||
comp.loading = true;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// Workaround to handle closing the modal shortly after it has been opened
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
required
|
||||
appAutoFocus
|
||||
/>
|
||||
<small class="text-muted">{{ "inviteMultipleEmailDesc" | i18n : "20" }}</small>
|
||||
<small class="text-muted">{{ "inviteMultipleEmailDesc" | i18n: "20" }}</small>
|
||||
</div>
|
||||
</ng-container>
|
||||
<h3>
|
||||
|
||||
@@ -38,7 +38,7 @@ export class UserAddEditComponent implements OnInit {
|
||||
private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private logService: LogService,
|
||||
private dialogService: DialogService
|
||||
private dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -68,7 +68,7 @@ export class UserAddEditComponent implements OnInit {
|
||||
this.formPromise = this.apiService.putProviderUser(
|
||||
this.providerId,
|
||||
this.providerUserId,
|
||||
request
|
||||
request,
|
||||
);
|
||||
} else {
|
||||
const request = new ProviderUserInviteRequest();
|
||||
@@ -80,7 +80,7 @@ export class UserAddEditComponent implements OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t(this.editMode ? "editedUserId" : "invitedUsers", this.name)
|
||||
this.i18nService.t(this.editMode ? "editedUserId" : "invitedUsers", this.name),
|
||||
);
|
||||
this.onSavedUser.emit();
|
||||
} catch (e) {
|
||||
@@ -109,7 +109,7 @@ export class UserAddEditComponent implements OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("removedUserId", this.name)
|
||||
this.i18nService.t("removedUserId", this.name),
|
||||
);
|
||||
this.onDeletedUser.emit();
|
||||
} catch (e) {
|
||||
|
||||
@@ -13,7 +13,10 @@ export class ProvidersLayoutComponent {
|
||||
provider: Provider;
|
||||
private providerId: string;
|
||||
|
||||
constructor(private route: ActivatedRoute, private providerService: ProviderService) {}
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private providerService: ProviderService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
document.body.classList.remove("layout_frontend");
|
||||
|
||||
@@ -10,7 +10,7 @@ export class WebProviderService {
|
||||
constructor(
|
||||
private cryptoService: CryptoService,
|
||||
private syncService: SyncService,
|
||||
private apiService: ApiService
|
||||
private apiService: ApiService,
|
||||
) {}
|
||||
|
||||
async addOrganizationToProvider(providerId: string, organizationId: string) {
|
||||
|
||||
@@ -29,7 +29,7 @@ export class AccountComponent {
|
||||
private route: ActivatedRoute,
|
||||
private syncService: SyncService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private logService: LogService
|
||||
private logService: LogService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
|
||||
@@ -9,7 +9,10 @@ import { ProviderService } from "@bitwarden/common/admin-console/abstractions/pr
|
||||
})
|
||||
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
||||
export class SettingsComponent {
|
||||
constructor(private route: ActivatedRoute, private providerService: ProviderService) {}
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private providerService: ProviderService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
|
||||
|
||||
@@ -35,7 +35,7 @@ export class SetupComponent implements OnInit {
|
||||
private cryptoService: CryptoService,
|
||||
private apiService: ApiService,
|
||||
private syncService: SyncService,
|
||||
private validationService: ValidationService
|
||||
private validationService: ValidationService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -49,7 +49,7 @@ export class SetupComponent implements OnInit {
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("emergencyInviteAcceptFailed"),
|
||||
{ timeout: 10000 }
|
||||
{ timeout: 10000 },
|
||||
);
|
||||
this.router.navigate(["/"]);
|
||||
return;
|
||||
|
||||
@@ -116,7 +116,7 @@ export class SsoComponent implements OnInit, OnDestroy {
|
||||
metadataAddress: new FormControl(),
|
||||
redirectBehavior: new FormControl(
|
||||
OpenIdConnectRedirectBehavior.RedirectGet,
|
||||
Validators.required
|
||||
Validators.required,
|
||||
),
|
||||
getClaimsFromUserInfoEndpoint: new FormControl(),
|
||||
additionalScopes: new FormControl(),
|
||||
@@ -128,7 +128,7 @@ export class SsoComponent implements OnInit, OnDestroy {
|
||||
},
|
||||
{
|
||||
updateOn: "blur",
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
protected samlForm = this.formBuilder.group<ControlsOf<SsoConfigView["saml"]>>(
|
||||
@@ -152,7 +152,7 @@ export class SsoComponent implements OnInit, OnDestroy {
|
||||
},
|
||||
{
|
||||
updateOn: "blur",
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
protected ssoConfigForm = this.formBuilder.group<ControlsOf<SsoConfigView>>({
|
||||
@@ -185,7 +185,7 @@ export class SsoComponent implements OnInit, OnDestroy {
|
||||
private i18nService: I18nService,
|
||||
private organizationService: OrganizationService,
|
||||
private organizationApiService: OrganizationApiServiceAbstraction,
|
||||
private configService: ConfigServiceAbstraction
|
||||
private configService: ConfigServiceAbstraction,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -231,12 +231,12 @@ export class SsoComponent implements OnInit, OnDestroy {
|
||||
this.organizationId = params.organizationId;
|
||||
await this.load();
|
||||
}),
|
||||
takeUntil(this.destroy$)
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
const tdeFeatureFlag = await this.configService.getFeatureFlag<boolean>(
|
||||
FeatureFlag.TrustedDeviceEncryption
|
||||
FeatureFlag.TrustedDeviceEncryption,
|
||||
);
|
||||
|
||||
this.showTdeOptions = tdeFeatureFlag;
|
||||
@@ -370,7 +370,7 @@ export class SsoComponent implements OnInit, OnDestroy {
|
||||
const errorCount = this.getErrorCount(this.ssoConfigForm);
|
||||
const errorCountText = this.i18nService.t(
|
||||
errorCount === 1 ? "formErrorSummarySingle" : "formErrorSummaryPlural",
|
||||
errorCount.toString()
|
||||
errorCount.toString(),
|
||||
);
|
||||
|
||||
const div = document.createElement("div");
|
||||
|
||||
@@ -17,7 +17,7 @@ import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.serv
|
||||
*/
|
||||
export const canActivateSM: CanActivateFn = async (
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot
|
||||
state: RouterStateSnapshot,
|
||||
) => {
|
||||
const syncService = inject(SyncService);
|
||||
const authService = inject(AuthService);
|
||||
|
||||
@@ -14,8 +14,11 @@ export class NavigationComponent {
|
||||
protected readonly logo = SecretsManagerLogo;
|
||||
protected orgFilter = (org: Organization) => org.canAccessSecretsManager;
|
||||
protected isAdmin$ = this.route.params.pipe(
|
||||
map((params) => this.organizationService.get(params.organizationId)?.isAdmin)
|
||||
map((params) => this.organizationService.get(params.organizationId)?.isAdmin),
|
||||
);
|
||||
|
||||
constructor(private route: ActivatedRoute, private organizationService: OrganizationService) {}
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private organizationService: OrganizationService,
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ export class OrgSwitcherComponent {
|
||||
orgs
|
||||
.filter((org) => this.filter(org))
|
||||
.sort((a, b) => a.name.localeCompare(b.name))
|
||||
.sort((a, b) => (a.enabled ? -1 : 1))
|
||||
)
|
||||
.sort((a, b) => (a.enabled ? -1 : 1)),
|
||||
),
|
||||
);
|
||||
|
||||
protected activeOrganization$: Observable<Organization> = combineLatest([
|
||||
@@ -49,7 +49,10 @@ export class OrgSwitcherComponent {
|
||||
@Input()
|
||||
hideNewButton = false;
|
||||
|
||||
constructor(private route: ActivatedRoute, private organizationService: OrganizationService) {}
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private organizationService: OrganizationService,
|
||||
) {}
|
||||
|
||||
protected toggle(event?: MouseEvent) {
|
||||
event?.stopPropagation();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="tw-text-lg">{{ title }}</div>
|
||||
<bit-progress class="tw-flex-1" [showText]="false" [barWidth]="barWidth"></bit-progress>
|
||||
<span *ngIf="tasks.length > 0; else spinner">
|
||||
{{ "complete" | i18n : amountCompleted : tasks.length }}
|
||||
{{ "complete" | i18n: amountCompleted : tasks.length }}
|
||||
</span>
|
||||
<i
|
||||
class="bwi tw-my-auto"
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
[projects]="view.latestProjects"
|
||||
></sm-projects-list>
|
||||
<div *ngIf="view.allProjects.length > 0" class="tw-ml-auto tw-mt-4 tw-max-w-max">
|
||||
{{ "showingPortionOfTotal" | i18n : view.latestProjects.length : view.allProjects.length }}
|
||||
{{ "showingPortionOfTotal" | i18n: view.latestProjects.length : view.allProjects.length }}
|
||||
<a bitLink routerLink="projects" class="tw-ml-2">{{ "viewAll" | i18n }}</a>
|
||||
</div>
|
||||
</sm-section>
|
||||
@@ -67,7 +67,7 @@
|
||||
[secrets]="view.latestSecrets"
|
||||
></sm-secrets-list>
|
||||
<div *ngIf="view.allSecrets.length > 0" class="tw-ml-auto tw-mt-4 tw-max-w-max">
|
||||
{{ "showingPortionOfTotal" | i18n : view.latestSecrets.length : view.allSecrets.length }}
|
||||
{{ "showingPortionOfTotal" | i18n: view.latestSecrets.length : view.allSecrets.length }}
|
||||
<a bitLink routerLink="secrets" class="tw-ml-2">{{ "viewAll" | i18n }}</a>
|
||||
</div>
|
||||
</sm-section>
|
||||
|
||||
@@ -89,19 +89,19 @@ export class OverviewComponent implements OnInit, OnDestroy {
|
||||
private organizationService: OrganizationService,
|
||||
private stateService: StateService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService
|
||||
private i18nService: I18nService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
const orgId$ = this.route.params.pipe(
|
||||
map((p) => p.organizationId),
|
||||
distinctUntilChanged()
|
||||
distinctUntilChanged(),
|
||||
);
|
||||
|
||||
orgId$
|
||||
.pipe(
|
||||
map((orgId) => this.organizationService.get(orgId)),
|
||||
takeUntil(this.destroy$)
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe((org) => {
|
||||
this.organizationId = org.id;
|
||||
@@ -116,7 +116,7 @@ export class OverviewComponent implements OnInit, OnDestroy {
|
||||
this.projectService.project$.pipe(startWith(null)),
|
||||
]).pipe(
|
||||
switchMap(([orgId]) => this.projectService.getProjects(orgId)),
|
||||
share()
|
||||
share(),
|
||||
);
|
||||
|
||||
const secrets$ = combineLatest([
|
||||
@@ -125,7 +125,7 @@ export class OverviewComponent implements OnInit, OnDestroy {
|
||||
this.projectService.project$.pipe(startWith(null)),
|
||||
]).pipe(
|
||||
switchMap(([orgId]) => this.secretService.getSecrets(orgId)),
|
||||
share()
|
||||
share(),
|
||||
);
|
||||
|
||||
const serviceAccounts$ = combineLatest([
|
||||
@@ -133,7 +133,7 @@ export class OverviewComponent implements OnInit, OnDestroy {
|
||||
this.serviceAccountService.serviceAccount$.pipe(startWith(null)),
|
||||
]).pipe(
|
||||
switchMap(([orgId]) => this.serviceAccountService.getServiceAccounts(orgId, false)),
|
||||
share()
|
||||
share(),
|
||||
);
|
||||
|
||||
this.view$ = orgId$.pipe(
|
||||
@@ -150,16 +150,16 @@ export class OverviewComponent implements OnInit, OnDestroy {
|
||||
createProject: projects.length > 0,
|
||||
createServiceAccount: serviceAccounts.length > 0,
|
||||
}),
|
||||
}))
|
||||
)
|
||||
)
|
||||
})),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// Refresh onboarding status when orgId changes by fetching the first value from view$.
|
||||
orgId$
|
||||
.pipe(
|
||||
switchMap(() => this.view$.pipe(take(1))),
|
||||
takeUntil(this.destroy$)
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe((view) => {
|
||||
this.showOnboarding = Object.values(view.tasks).includes(false);
|
||||
@@ -182,11 +182,11 @@ export class OverviewComponent implements OnInit, OnDestroy {
|
||||
|
||||
private async saveCompletedTasks(
|
||||
organizationId: string,
|
||||
orgTasks: OrganizationTasks
|
||||
orgTasks: OrganizationTasks,
|
||||
): Promise<OrganizationTasks> {
|
||||
const prevTasks = ((await this.stateService.getSMOnboardingTasks()) || {}) as Tasks;
|
||||
const newlyCompletedOrgTasks = Object.fromEntries(
|
||||
Object.entries(orgTasks).filter(([_k, v]) => v === true)
|
||||
Object.entries(orgTasks).filter(([_k, v]) => v === true),
|
||||
);
|
||||
const nextOrgTasks = {
|
||||
importSecrets: false,
|
||||
@@ -294,7 +294,7 @@ export class OverviewComponent implements OnInit, OnDestroy {
|
||||
id,
|
||||
this.platformUtilsService,
|
||||
this.i18nService,
|
||||
this.secretService
|
||||
this.secretService,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,14 +38,14 @@ export class ProjectDeleteDialogComponent implements OnInit {
|
||||
private projectService: ProjectService,
|
||||
private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private dialogService: DialogService
|
||||
private dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (!(this.data.projects?.length >= 1)) {
|
||||
this.dialogRef.close();
|
||||
throw new Error(
|
||||
"The project delete dialog was not called with the appropriate operation values."
|
||||
"The project delete dialog was not called with the appropriate operation values.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ export class ProjectDialogComponent implements OnInit {
|
||||
private projectService: ProjectService,
|
||||
private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private router: Router
|
||||
private router: Router,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -68,7 +68,7 @@ export class ProjectDialogComponent implements OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("projectsCannotCreate")
|
||||
this.i18nService.t("projectsCannotCreate"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export class ProjectService {
|
||||
constructor(
|
||||
private cryptoService: CryptoService,
|
||||
private apiService: ApiService,
|
||||
private encryptService: EncryptService
|
||||
private encryptService: EncryptService,
|
||||
) {}
|
||||
|
||||
async getByProjectId(projectId: string): Promise<ProjectView> {
|
||||
@@ -41,7 +41,7 @@ export class ProjectService {
|
||||
"/organizations/" + organizationId + "/projects",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
const results = new ListResponse(r, ProjectListItemResponse);
|
||||
return await this.createProjectsListView(organizationId, results.data);
|
||||
@@ -54,7 +54,7 @@ export class ProjectService {
|
||||
"/organizations/" + organizationId + "/projects",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
const project = await this.createProjectView(new ProjectResponse(r));
|
||||
@@ -87,7 +87,7 @@ export class ProjectService {
|
||||
|
||||
private async getProjectRequest(
|
||||
organizationId: string,
|
||||
projectView: ProjectView
|
||||
projectView: ProjectView,
|
||||
): Promise<ProjectRequest> {
|
||||
const orgKey = await this.getOrganizationKey(organizationId);
|
||||
const request = new ProjectRequest();
|
||||
@@ -108,14 +108,14 @@ export class ProjectService {
|
||||
projectView.write = projectResponse.write;
|
||||
projectView.name = await this.encryptService.decryptToUtf8(
|
||||
new EncString(projectResponse.name),
|
||||
orgKey
|
||||
orgKey,
|
||||
);
|
||||
return projectView;
|
||||
}
|
||||
|
||||
private async createProjectsListView(
|
||||
organizationId: string,
|
||||
projects: ProjectListItemResponse[]
|
||||
projects: ProjectListItemResponse[],
|
||||
): Promise<ProjectListView[]> {
|
||||
const orgKey = await this.getOrganizationKey(organizationId);
|
||||
return await Promise.all(
|
||||
@@ -127,12 +127,12 @@ export class ProjectService {
|
||||
projectListView.write = s.write;
|
||||
projectListView.name = await this.encryptService.decryptToUtf8(
|
||||
new EncString(s.name),
|
||||
orgKey
|
||||
orgKey,
|
||||
);
|
||||
projectListView.creationDate = s.creationDate;
|
||||
projectListView.revisionDate = s.revisionDate;
|
||||
return projectListView;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,12 +35,12 @@ export class ProjectPeopleComponent implements OnInit, OnDestroy {
|
||||
switchMap(([params]) =>
|
||||
this.accessPolicyService.getProjectPeopleAccessPolicies(params.projectId).then((policies) => {
|
||||
return convertToAccessPolicyItemViews(policies);
|
||||
})
|
||||
}),
|
||||
),
|
||||
catchError(() => {
|
||||
this.router.navigate(["/sm", this.organizationId, "projects"]);
|
||||
return EMPTY;
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
private potentialGrantees$ = combineLatest([this.route.params]).pipe(
|
||||
@@ -49,8 +49,8 @@ export class ProjectPeopleComponent implements OnInit, OnDestroy {
|
||||
.getPeoplePotentialGrantees(params.organizationId)
|
||||
.then((grantees) => {
|
||||
return convertPotentialGranteesToApItemViewType(grantees);
|
||||
})
|
||||
)
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
protected formGroup = new FormGroup({
|
||||
@@ -69,7 +69,7 @@ export class ProjectPeopleComponent implements OnInit, OnDestroy {
|
||||
private router: Router,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService,
|
||||
private accessPolicySelectorService: AccessPolicySelectorService
|
||||
private accessPolicySelectorService: AccessPolicySelectorService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -101,7 +101,7 @@ export class ProjectPeopleComponent implements OnInit, OnDestroy {
|
||||
const showAccessRemovalWarning =
|
||||
await this.accessPolicySelectorService.showAccessRemovalWarning(
|
||||
this.organizationId,
|
||||
this.formGroup.value.accessPolicies
|
||||
this.formGroup.value.accessPolicies,
|
||||
);
|
||||
|
||||
if (showAccessRemovalWarning) {
|
||||
@@ -115,11 +115,11 @@ export class ProjectPeopleComponent implements OnInit, OnDestroy {
|
||||
try {
|
||||
const projectPeopleView = convertToProjectPeopleAccessPoliciesView(
|
||||
this.projectId,
|
||||
this.formGroup.value.accessPolicies
|
||||
this.formGroup.value.accessPolicies,
|
||||
);
|
||||
const peoplePoliciesViews = await this.accessPolicyService.putProjectPeopleAccessPolicies(
|
||||
this.projectId,
|
||||
projectPeopleView
|
||||
projectPeopleView,
|
||||
);
|
||||
this.currentAccessPolicies = convertToAccessPolicyItemViews(peoplePoliciesViews);
|
||||
|
||||
@@ -129,7 +129,7 @@ export class ProjectPeopleComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("projectAccessUpdated")
|
||||
this.i18nService.t("projectAccessUpdated"),
|
||||
);
|
||||
} catch (e) {
|
||||
this.validationService.showError(e);
|
||||
|
||||
@@ -41,20 +41,20 @@ export class ProjectSecretsComponent {
|
||||
private dialogService: DialogService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService,
|
||||
private organizationService: OrganizationService
|
||||
private organizationService: OrganizationService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
// Refresh list if project is edited
|
||||
const currentProjectEdited = this.projectService.project$.pipe(
|
||||
filter((p) => p?.id === this.projectId),
|
||||
startWith(null)
|
||||
startWith(null),
|
||||
);
|
||||
|
||||
this.project$ = combineLatest([this.route.params, currentProjectEdited]).pipe(
|
||||
switchMap(([params, _]) => {
|
||||
return this.projectService.getByProjectId(params.projectId);
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
this.secrets$ = this.secretService.secret$.pipe(
|
||||
@@ -65,7 +65,7 @@ export class ProjectSecretsComponent {
|
||||
this.projectId = params.projectId;
|
||||
this.organizationEnabled = this.organizationService.get(params.organizationId)?.enabled;
|
||||
return await this.getSecretsByProject();
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ export class ProjectSecretsComponent {
|
||||
id,
|
||||
this.platformUtilsService,
|
||||
this.i18nService,
|
||||
this.secretService
|
||||
this.secretService,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ export class ProjectServiceAccountsComponent implements OnInit, OnDestroy {
|
||||
this.accessPolicyService.projectAccessPolicyChanges$.pipe(
|
||||
startWith(null),
|
||||
switchMap(() =>
|
||||
this.accessPolicyService.getProjectAccessPolicies(this.organizationId, this.projectId)
|
||||
this.accessPolicyService.getProjectAccessPolicies(this.organizationId, this.projectId),
|
||||
),
|
||||
map((policies) =>
|
||||
policies.serviceAccountAccessPolicies.map((policy) => ({
|
||||
@@ -40,14 +40,14 @@ export class ProjectServiceAccountsComponent implements OnInit, OnDestroy {
|
||||
write: policy.write,
|
||||
icon: AccessSelectorComponent.serviceAccountIcon,
|
||||
static: false,
|
||||
}))
|
||||
)
|
||||
})),
|
||||
),
|
||||
);
|
||||
|
||||
protected async handleUpdateAccessPolicy(policy: AccessSelectorRowView) {
|
||||
try {
|
||||
return await this.accessPolicyService.updateAccessPolicy(
|
||||
AccessSelectorComponent.getBaseAccessPolicyView(policy)
|
||||
AccessSelectorComponent.getBaseAccessPolicyView(policy),
|
||||
);
|
||||
} catch (e) {
|
||||
this.validationService.showError(e);
|
||||
@@ -58,7 +58,7 @@ export class ProjectServiceAccountsComponent implements OnInit, OnDestroy {
|
||||
const projectAccessPoliciesView = new ProjectAccessPoliciesView();
|
||||
projectAccessPoliciesView.serviceAccountAccessPolicies = selected
|
||||
.filter(
|
||||
(selection) => AccessSelectorComponent.getAccessItemType(selection) === "serviceAccount"
|
||||
(selection) => AccessSelectorComponent.getAccessItemType(selection) === "serviceAccount",
|
||||
)
|
||||
.map((filtered) => {
|
||||
const view = new ServiceAccountProjectAccessPolicyView();
|
||||
@@ -72,7 +72,7 @@ export class ProjectServiceAccountsComponent implements OnInit, OnDestroy {
|
||||
return this.accessPolicyService.createProjectAccessPolicies(
|
||||
this.organizationId,
|
||||
this.projectId,
|
||||
projectAccessPoliciesView
|
||||
projectAccessPoliciesView,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ export class ProjectServiceAccountsComponent implements OnInit, OnDestroy {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private validationService: ValidationService,
|
||||
private accessPolicyService: AccessPolicyService
|
||||
private accessPolicyService: AccessPolicyService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
@@ -44,14 +44,14 @@ export class ProjectComponent implements OnInit, OnDestroy {
|
||||
private dialogService: DialogService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService,
|
||||
private organizationService: OrganizationService
|
||||
private organizationService: OrganizationService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
// Update project if it is edited
|
||||
const currentProjectEdited = this.projectService.project$.pipe(
|
||||
filter((p) => p?.id === this.projectId),
|
||||
startWith(null)
|
||||
startWith(null),
|
||||
);
|
||||
|
||||
this.project$ = combineLatest([this.route.params, currentProjectEdited]).pipe(
|
||||
@@ -61,11 +61,11 @@ export class ProjectComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("notFound", this.i18nService.t("project"))
|
||||
this.i18nService.t("notFound", this.i18nService.t("project")),
|
||||
);
|
||||
});
|
||||
return EMPTY;
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
this.route.params.pipe(takeUntil(this.destroy$)).subscribe((params) => {
|
||||
|
||||
@@ -40,7 +40,7 @@ export class ProjectsComponent implements OnInit {
|
||||
private projectService: ProjectService,
|
||||
private accessPolicyService: AccessPolicyService,
|
||||
private dialogService: DialogService,
|
||||
private organizationService: OrganizationService
|
||||
private organizationService: OrganizationService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -54,7 +54,7 @@ export class ProjectsComponent implements OnInit {
|
||||
this.organizationEnabled = this.organizationService.get(params.organizationId)?.enabled;
|
||||
|
||||
return await this.getProjects();
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ export class ProjectsComponent implements OnInit {
|
||||
message: "smProjectsDeleteBulkConfirmation",
|
||||
details: this.getBulkConfirmationDetails(readOnlyProjects),
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const result = await lastValueFrom(dialogRef.closed);
|
||||
|
||||
@@ -27,7 +27,7 @@ export class SecretDeleteDialogComponent {
|
||||
private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
@Inject(DIALOG_DATA) private data: SecretDeleteOperation,
|
||||
private dialogService: DialogService
|
||||
private dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
showSoftDeleteSecretWarning = this.data.secrets.length === 1;
|
||||
|
||||
@@ -67,7 +67,7 @@ export class SecretDialogComponent implements OnInit {
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private projectService: ProjectService,
|
||||
private dialogService: DialogService,
|
||||
private organizationService: OrganizationService
|
||||
private organizationService: OrganizationService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -208,12 +208,12 @@ export class SecretDialogComponent implements OnInit {
|
||||
data: {
|
||||
secrets: secretListView,
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// If the secret is deleted, chain close this dialog after the delete dialog
|
||||
lastValueFrom(dialogRef.closed).then(
|
||||
(closeData) => closeData !== undefined && this.dialogRef.close()
|
||||
(closeData) => closeData !== undefined && this.dialogRef.close(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ export class SecretService {
|
||||
constructor(
|
||||
private cryptoService: CryptoService,
|
||||
private apiService: ApiService,
|
||||
private encryptService: EncryptService
|
||||
private encryptService: EncryptService,
|
||||
) {}
|
||||
|
||||
async getBySecretId(secretId: string): Promise<SecretView> {
|
||||
@@ -45,7 +45,7 @@ export class SecretService {
|
||||
"/organizations/" + organizationId + "/secrets",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
const results = new SecretWithProjectsListResponse(r);
|
||||
@@ -58,7 +58,7 @@ export class SecretService {
|
||||
"/projects/" + projectId + "/secrets",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
const results = new SecretWithProjectsListResponse(r);
|
||||
@@ -72,7 +72,7 @@ export class SecretService {
|
||||
"/organizations/" + organizationId + "/secrets",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
this._secret.next(await this.createSecretView(new SecretResponse(r)));
|
||||
}
|
||||
@@ -103,7 +103,7 @@ export class SecretService {
|
||||
"/secrets/" + organizationId + "/trash",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
return await this.createSecretsListView(organizationId, new SecretWithProjectsListResponse(r));
|
||||
@@ -115,7 +115,7 @@ export class SecretService {
|
||||
"/secrets/" + organizationId + "/trash/empty",
|
||||
secretIds,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
this._secret.next(null);
|
||||
@@ -127,7 +127,7 @@ export class SecretService {
|
||||
"/secrets/" + organizationId + "/trash/restore",
|
||||
secretIds,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
this._secret.next(null);
|
||||
@@ -139,7 +139,7 @@ export class SecretService {
|
||||
|
||||
private async getSecretRequest(
|
||||
organizationId: string,
|
||||
secretView: SecretView
|
||||
secretView: SecretView,
|
||||
): Promise<SecretRequest> {
|
||||
const orgKey = await this.getOrganizationKey(organizationId);
|
||||
const request = new SecretRequest();
|
||||
@@ -182,7 +182,7 @@ export class SecretService {
|
||||
if (secretResponse.projects != null) {
|
||||
secretView.projects = await this.decryptProjectsMappedToSecrets(
|
||||
orgKey,
|
||||
secretResponse.projects
|
||||
secretResponse.projects,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -191,13 +191,13 @@ export class SecretService {
|
||||
|
||||
private async createSecretsListView(
|
||||
organizationId: string,
|
||||
secrets: SecretWithProjectsListResponse
|
||||
secrets: SecretWithProjectsListResponse,
|
||||
): Promise<SecretListView[]> {
|
||||
const orgKey = await this.getOrganizationKey(organizationId);
|
||||
|
||||
const projectsMappedToSecretsView = await this.decryptProjectsMappedToSecrets(
|
||||
orgKey,
|
||||
secrets.projects
|
||||
secrets.projects,
|
||||
);
|
||||
|
||||
return await Promise.all(
|
||||
@@ -207,27 +207,27 @@ export class SecretService {
|
||||
secretListView.organizationId = s.organizationId;
|
||||
secretListView.name = await this.encryptService.decryptToUtf8(
|
||||
new EncString(s.name),
|
||||
orgKey
|
||||
orgKey,
|
||||
);
|
||||
secretListView.creationDate = s.creationDate;
|
||||
secretListView.revisionDate = s.revisionDate;
|
||||
|
||||
const projectIds = s.projects?.map((p) => p.id);
|
||||
secretListView.projects = projectsMappedToSecretsView.filter((p) =>
|
||||
projectIds.includes(p.id)
|
||||
projectIds.includes(p.id),
|
||||
);
|
||||
|
||||
secretListView.read = s.read;
|
||||
secretListView.write = s.write;
|
||||
|
||||
return secretListView;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
private async decryptProjectsMappedToSecrets(
|
||||
orgKey: SymmetricCryptoKey,
|
||||
projects: SecretProjectResponse[]
|
||||
projects: SecretProjectResponse[],
|
||||
): Promise<SecretProjectView[]> {
|
||||
return await Promise.all(
|
||||
projects.map(async (s: SecretProjectResponse) => {
|
||||
@@ -237,7 +237,7 @@ export class SecretService {
|
||||
? await this.encryptService.decryptToUtf8(new EncString(s.name), orgKey)
|
||||
: null;
|
||||
return projectsMappedToSecretView;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export class SecretsComponent implements OnInit {
|
||||
private dialogService: DialogService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService,
|
||||
private organizationService: OrganizationService
|
||||
private organizationService: OrganizationService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -50,7 +50,7 @@ export class SecretsComponent implements OnInit {
|
||||
this.organizationEnabled = this.organizationService.get(params.organizationId)?.enabled;
|
||||
|
||||
return await this.getSecrets();
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
if (this.route.snapshot.queryParams.search) {
|
||||
@@ -100,7 +100,7 @@ export class SecretsComponent implements OnInit {
|
||||
id,
|
||||
this.platformUtilsService,
|
||||
this.i18nService,
|
||||
this.secretService
|
||||
this.secretService,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,9 +57,9 @@
|
||||
</td>
|
||||
<td bitCell>{{ token.name }}</td>
|
||||
<td bitCell>
|
||||
{{ token.expireAt === null ? ("never" | i18n) : (token.expireAt | date : "medium") }}
|
||||
{{ token.expireAt === null ? ("never" | i18n) : (token.expireAt | date: "medium") }}
|
||||
</td>
|
||||
<td bitCell>{{ token.revisionDate | date : "medium" }}</td>
|
||||
<td bitCell>{{ token.revisionDate | date: "medium" }}</td>
|
||||
<td bitCell>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -38,7 +38,7 @@ export class AccessTokenComponent implements OnInit, OnDestroy {
|
||||
private dialogService: DialogService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService,
|
||||
private serviceAccountService: ServiceAccountService
|
||||
private serviceAccountService: ServiceAccountService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -46,8 +46,8 @@ export class AccessTokenComponent implements OnInit, OnDestroy {
|
||||
startWith(null),
|
||||
combineLatestWith(this.route.params),
|
||||
switchMap(async ([_, params]) =>
|
||||
this.accessService.getAccessTokens(params.organizationId, params.serviceAccountId)
|
||||
)
|
||||
this.accessService.getAccessTokens(params.organizationId, params.serviceAccountId),
|
||||
),
|
||||
);
|
||||
|
||||
this.serviceAccountService.serviceAccount$
|
||||
@@ -57,10 +57,10 @@ export class AccessTokenComponent implements OnInit, OnDestroy {
|
||||
switchMap(([_, params]) =>
|
||||
this.serviceAccountService.getByServiceAccountId(
|
||||
params.serviceAccountId,
|
||||
params.organizationId
|
||||
)
|
||||
params.organizationId,
|
||||
),
|
||||
),
|
||||
takeUntil(this.destroy$)
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe((serviceAccountView) => {
|
||||
this.serviceAccountView = serviceAccountView;
|
||||
@@ -77,7 +77,7 @@ export class AccessTokenComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("noAccessTokenSelected")
|
||||
this.i18nService.t("noAccessTokenSelected"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ export class AccessTokenComponent implements OnInit, OnDestroy {
|
||||
|
||||
await this.accessService.revokeAccessTokens(
|
||||
this.serviceAccountView.id,
|
||||
tokens.map((t) => t.id)
|
||||
tokens.map((t) => t.id),
|
||||
);
|
||||
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("accessTokenRevoked"));
|
||||
@@ -97,7 +97,7 @@ export class AccessTokenComponent implements OnInit, OnDestroy {
|
||||
protected openNewAccessTokenDialog() {
|
||||
AccessTokenCreateDialogComponent.openNewAccessTokenDialog(
|
||||
this.dialogService,
|
||||
this.serviceAccountView
|
||||
this.serviceAccountView,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,19 +29,19 @@ export class AccessService {
|
||||
private cryptoService: CryptoService,
|
||||
private apiService: ApiService,
|
||||
private cryptoFunctionService: CryptoFunctionService,
|
||||
private encryptService: EncryptService
|
||||
private encryptService: EncryptService,
|
||||
) {}
|
||||
|
||||
async getAccessTokens(
|
||||
organizationId: string,
|
||||
serviceAccountId: string
|
||||
serviceAccountId: string,
|
||||
): Promise<AccessTokenView[]> {
|
||||
const r = await this.apiService.send(
|
||||
"GET",
|
||||
"/service-accounts/" + serviceAccountId + "/access-tokens",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
const results = new ListResponse(r, AccessTokenResponse);
|
||||
|
||||
@@ -51,7 +51,7 @@ export class AccessService {
|
||||
async createAccessToken(
|
||||
organizationId: string,
|
||||
serviceAccountId: string,
|
||||
accessTokenView: AccessTokenView
|
||||
accessTokenView: AccessTokenView,
|
||||
): Promise<string> {
|
||||
const keyMaterial = await this.cryptoFunctionService.aesGenerateKey(128);
|
||||
const key = await this.cryptoFunctionService.hkdf(
|
||||
@@ -59,21 +59,21 @@ export class AccessService {
|
||||
"bitwarden-accesstoken",
|
||||
"sm-access-token",
|
||||
64,
|
||||
"sha256"
|
||||
"sha256",
|
||||
);
|
||||
const encryptionKey = new SymmetricCryptoKey(key);
|
||||
|
||||
const request = await this.createAccessTokenRequest(
|
||||
organizationId,
|
||||
encryptionKey,
|
||||
accessTokenView
|
||||
accessTokenView,
|
||||
);
|
||||
const r = await this.apiService.send(
|
||||
"POST",
|
||||
"/service-accounts/" + serviceAccountId + "/access-tokens",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
const result = new AccessTokenCreationResponse(r);
|
||||
this._accessToken.next(null);
|
||||
@@ -90,7 +90,7 @@ export class AccessService {
|
||||
"/service-accounts/" + serviceAccountId + "/access-tokens/revoke",
|
||||
request,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
|
||||
this._accessToken.next(null);
|
||||
@@ -99,7 +99,7 @@ export class AccessService {
|
||||
private async createAccessTokenRequest(
|
||||
organizationId: string,
|
||||
encryptionKey: SymmetricCryptoKey,
|
||||
accessTokenView: AccessTokenView
|
||||
accessTokenView: AccessTokenView,
|
||||
): Promise<AccessTokenRequest> {
|
||||
const organizationKey = await this.getOrganizationKey(organizationId);
|
||||
const accessTokenRequest = new AccessTokenRequest();
|
||||
@@ -107,7 +107,7 @@ export class AccessService {
|
||||
await this.encryptService.encrypt(accessTokenView.name, organizationKey),
|
||||
await this.encryptService.encrypt(
|
||||
JSON.stringify({ encryptionKey: organizationKey.keyB64 }),
|
||||
encryptionKey
|
||||
encryptionKey,
|
||||
),
|
||||
await this.encryptService.encrypt(encryptionKey.keyB64, organizationKey),
|
||||
]);
|
||||
@@ -125,7 +125,7 @@ export class AccessService {
|
||||
|
||||
private async createAccessTokenViews(
|
||||
organizationId: string,
|
||||
accessTokenResponses: AccessTokenResponse[]
|
||||
accessTokenResponses: AccessTokenResponse[],
|
||||
): Promise<AccessTokenView[]> {
|
||||
const orgKey = await this.getOrganizationKey(organizationId);
|
||||
return await Promise.all(
|
||||
@@ -138,7 +138,7 @@ export class AccessService {
|
||||
view.creationDate = new Date(s.creationDate);
|
||||
view.revisionDate = new Date(s.revisionDate);
|
||||
return view;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,14 +33,14 @@ export class AccessTokenCreateDialogComponent implements OnInit {
|
||||
public dialogRef: DialogRef,
|
||||
@Inject(DIALOG_DATA) public data: AccessTokenOperation,
|
||||
private dialogService: DialogService,
|
||||
private accessService: AccessService
|
||||
private accessService: AccessService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
if (!this.data.serviceAccountView) {
|
||||
this.dialogRef.close();
|
||||
throw new Error(
|
||||
`The access token create dialog was not called with the appropriate operation values.`
|
||||
`The access token create dialog was not called with the appropriate operation values.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -57,12 +57,12 @@ export class AccessTokenCreateDialogComponent implements OnInit {
|
||||
const accessToken = await this.accessService.createAccessToken(
|
||||
this.data.serviceAccountView.organizationId,
|
||||
this.data.serviceAccountView.id,
|
||||
accessTokenView
|
||||
accessTokenView,
|
||||
);
|
||||
this.openAccessTokenDialog(
|
||||
this.data.serviceAccountView.name,
|
||||
accessToken,
|
||||
accessTokenView.expireAt
|
||||
accessTokenView.expireAt,
|
||||
);
|
||||
this.dialogRef.close();
|
||||
};
|
||||
@@ -70,7 +70,7 @@ export class AccessTokenCreateDialogComponent implements OnInit {
|
||||
private openAccessTokenDialog(
|
||||
serviceAccountName: string,
|
||||
accessToken: string,
|
||||
expirationDate?: Date
|
||||
expirationDate?: Date,
|
||||
) {
|
||||
this.dialogService.open<unknown, AccessTokenDetails>(AccessTokenDialogComponent, {
|
||||
data: {
|
||||
@@ -83,7 +83,7 @@ export class AccessTokenCreateDialogComponent implements OnInit {
|
||||
|
||||
static openNewAccessTokenDialog(
|
||||
dialogService: DialogService,
|
||||
serviceAccountView: ServiceAccountView
|
||||
serviceAccountView: ServiceAccountView,
|
||||
) {
|
||||
return dialogService.open<unknown, AccessTokenOperation>(AccessTokenCreateDialogComponent, {
|
||||
data: {
|
||||
|
||||
@@ -10,9 +10,7 @@
|
||||
<bit-callout type="info" [title]="'accessTokenCallOutTitle' | i18n">
|
||||
{{ "downloadAccessToken" | i18n }}<br />
|
||||
{{ "expiresOnAccessToken" | i18n }}
|
||||
{{
|
||||
data.expirationDate === null ? ("never" | i18n) : (data.expirationDate | date : "medium")
|
||||
}}
|
||||
{{ data.expirationDate === null ? ("never" | i18n) : (data.expirationDate | date: "medium") }}
|
||||
</bit-callout>
|
||||
|
||||
<bit-form-field class="tw-mb-0">
|
||||
@@ -20,7 +18,7 @@
|
||||
<textarea bitInput disabled rows="4">{{ data.accessToken }}</textarea>
|
||||
</bit-form-field>
|
||||
{{ "expiresOnAccessToken" | i18n }}
|
||||
{{ data.expirationDate === null ? ("never" | i18n) : (data.expirationDate | date : "medium") }}
|
||||
{{ data.expirationDate === null ? ("never" | i18n) : (data.expirationDate | date: "medium") }}
|
||||
</div>
|
||||
|
||||
<ng-container bitDialogFooter>
|
||||
|
||||
@@ -18,7 +18,7 @@ export class AccessTokenDialogComponent implements OnInit {
|
||||
public dialogRef: DialogRef,
|
||||
@Inject(DIALOG_DATA) public data: AccessTokenDetails,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService
|
||||
private i18nService: I18nService,
|
||||
) {
|
||||
this.dialogRef.disableClose = true;
|
||||
}
|
||||
@@ -36,7 +36,7 @@ export class AccessTokenDialogComponent implements OnInit {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("accessTokenCreatedAndCopied")
|
||||
this.i18nService.t("accessTokenCreatedAndCopied"),
|
||||
);
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<select bitInput formControlName="expires">
|
||||
<option ngValue="never">{{ "never" | i18n }}</option>
|
||||
<option *ngFor="let day of expirationDayOptions" [ngValue]="day">
|
||||
{{ "days" | i18n : day }}
|
||||
{{ "days" | i18n: day }}
|
||||
</option>
|
||||
<option ngValue="custom">{{ "custom" | i18n }}</option>
|
||||
</select>
|
||||
@@ -14,7 +14,7 @@
|
||||
<input
|
||||
bitInput
|
||||
type="datetime-local"
|
||||
[min]="currentDate | date : 'YYYY-MM-ddThh:mm'"
|
||||
[min]="currentDate | date: 'YYYY-MM-ddThh:mm'"
|
||||
formControlName="expireDateTime"
|
||||
/>
|
||||
</bit-form-field>
|
||||
|
||||
@@ -52,7 +52,10 @@ export class ExpirationOptionsComponent
|
||||
expireDateTime: new FormControl("", [Validators.required, this.expiresInFutureValidator()]),
|
||||
});
|
||||
|
||||
constructor(private datePipe: DatePipe, private i18nService: I18nService) {}
|
||||
constructor(
|
||||
private datePipe: DatePipe,
|
||||
private i18nService: I18nService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
this.form.valueChanges.pipe(takeUntil(this.destroy$)).subscribe(() => {
|
||||
|
||||
@@ -38,7 +38,7 @@ export class ServiceAccountDeleteDialogComponent {
|
||||
private serviceAccountService: ServiceAccountService,
|
||||
private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private dialogService: DialogService
|
||||
private dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
get title() {
|
||||
@@ -101,7 +101,7 @@ export class ServiceAccountDeleteDialogComponent {
|
||||
? this.i18nService.t("deleteProjectConfirmMessage", this.data.serviceAccounts[0].name)
|
||||
: this.i18nService.t(
|
||||
"deleteServiceAccountsConfirmMessage",
|
||||
this.data.serviceAccounts?.length.toString()
|
||||
this.data.serviceAccounts?.length.toString(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ export class ServiceAccountDialogComponent {
|
||||
updateOn: "submit",
|
||||
}),
|
||||
},
|
||||
{}
|
||||
{},
|
||||
);
|
||||
|
||||
protected loading = false;
|
||||
@@ -42,7 +42,7 @@ export class ServiceAccountDialogComponent {
|
||||
@Inject(DIALOG_DATA) private data: ServiceAccountOperation,
|
||||
private serviceAccountService: ServiceAccountService,
|
||||
private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -56,7 +56,7 @@ export class ServiceAccountDialogComponent {
|
||||
const serviceAccount: ServiceAccountView =
|
||||
await this.serviceAccountService.getByServiceAccountId(
|
||||
this.data.serviceAccountId,
|
||||
this.data.organizationId
|
||||
this.data.organizationId,
|
||||
);
|
||||
this.formGroup.patchValue({ name: serviceAccount.name });
|
||||
this.loading = false;
|
||||
@@ -67,7 +67,7 @@ export class ServiceAccountDialogComponent {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("serviceAccountsCannotCreate")
|
||||
this.i18nService.t("serviceAccountsCannotCreate"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ export class ServiceAccountDialogComponent {
|
||||
await this.serviceAccountService.update(
|
||||
this.data.serviceAccountId,
|
||||
this.data.organizationId,
|
||||
serviceAccountView
|
||||
serviceAccountView,
|
||||
);
|
||||
serviceAccountMessage = this.i18nService.t("serviceAccountUpdated");
|
||||
}
|
||||
|
||||
@@ -14,14 +14,14 @@ export class ServiceAccountEventLogApiService {
|
||||
serviceAccountId: string,
|
||||
start: string,
|
||||
end: string,
|
||||
token: string
|
||||
token: string,
|
||||
): Promise<ListResponse<EventResponse>> {
|
||||
const r = await this.apiService.send(
|
||||
"GET",
|
||||
this.addEventParameters("/sm/events/service-accounts/" + serviceAccountId, start, end, token),
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new ListResponse(r, EventResponse);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
</ng-container>
|
||||
<ng-template body>
|
||||
<tr bitRow *ngFor="let e of events" alignContent="top">
|
||||
<td bitCell class="tw-whitespace-nowrap">{{ e.date | date : "medium" }}</td>
|
||||
<td bitCell class="tw-whitespace-nowrap">{{ e.date | date: "medium" }}</td>
|
||||
<td bitCell>
|
||||
<span title="{{ e.appName }}, {{ e.ip }}">{{ e.appName }}</span>
|
||||
</td>
|
||||
|
||||
@@ -29,7 +29,7 @@ export class ServiceAccountEventsComponent extends BaseEventsComponent implement
|
||||
exportService: EventExportService,
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
logService: LogService,
|
||||
fileDownloadService: FileDownloadService
|
||||
fileDownloadService: FileDownloadService,
|
||||
) {
|
||||
super(
|
||||
eventService,
|
||||
@@ -37,7 +37,7 @@ export class ServiceAccountEventsComponent extends BaseEventsComponent implement
|
||||
exportService,
|
||||
platformUtilsService,
|
||||
logService,
|
||||
fileDownloadService
|
||||
fileDownloadService,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ export class ServiceAccountEventsComponent extends BaseEventsComponent implement
|
||||
this.serviceAccountId,
|
||||
startDate,
|
||||
endDate,
|
||||
continuationToken
|
||||
continuationToken,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ export const serviceAccountAccessGuard: CanActivateFn = async (route: ActivatedR
|
||||
try {
|
||||
const serviceAccount = await serviceAccountService.getByServiceAccountId(
|
||||
route.params.serviceAccountId,
|
||||
route.params.organizationId
|
||||
route.params.organizationId,
|
||||
);
|
||||
if (serviceAccount) {
|
||||
return true;
|
||||
|
||||
@@ -46,7 +46,7 @@ export class ServiceAccountPeopleComponent {
|
||||
startWith(null),
|
||||
combineLatestWith(this.route.params),
|
||||
switchMap(([_, params]) =>
|
||||
this.accessPolicyService.getServiceAccountAccessPolicies(params.serviceAccountId)
|
||||
this.accessPolicyService.getServiceAccountAccessPolicies(params.serviceAccountId),
|
||||
),
|
||||
map((policies) => {
|
||||
const rows: AccessSelectorRowView[] = [];
|
||||
@@ -80,7 +80,7 @@ export class ServiceAccountPeopleComponent {
|
||||
|
||||
return rows;
|
||||
}),
|
||||
share()
|
||||
share(),
|
||||
);
|
||||
|
||||
protected handleCreateAccessPolicies(selected: SelectItemView[]) {
|
||||
@@ -109,7 +109,7 @@ export class ServiceAccountPeopleComponent {
|
||||
|
||||
return this.accessPolicyService.createServiceAccountAccessPolicies(
|
||||
this.serviceAccountId,
|
||||
serviceAccountAccessPoliciesView
|
||||
serviceAccountAccessPoliciesView,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ export class ServiceAccountPeopleComponent {
|
||||
await this.accessPolicyService.needToShowAccessRemovalWarning(
|
||||
this.organizationId,
|
||||
policy,
|
||||
this.rows
|
||||
this.rows,
|
||||
)
|
||||
) {
|
||||
this.launchDeleteWarningDialog(policy);
|
||||
@@ -145,7 +145,7 @@ export class ServiceAccountPeopleComponent {
|
||||
private dialogService: DialogService,
|
||||
private i18nService: I18nService,
|
||||
private validationService: ValidationService,
|
||||
private accessPolicyService: AccessPolicyService
|
||||
private accessPolicyService: AccessPolicyService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
@@ -26,7 +26,7 @@ export class ServiceAccountProjectsComponent implements OnInit, OnDestroy {
|
||||
startWith(null),
|
||||
combineLatestWith(this.route.params),
|
||||
switchMap(([_, params]) =>
|
||||
this.accessPolicyService.getGrantedPolicies(params.serviceAccountId, params.organizationId)
|
||||
this.accessPolicyService.getGrantedPolicies(params.serviceAccountId, params.organizationId),
|
||||
),
|
||||
map((policies) => {
|
||||
return policies.map((policy) => {
|
||||
@@ -41,7 +41,7 @@ export class ServiceAccountProjectsComponent implements OnInit, OnDestroy {
|
||||
static: false,
|
||||
} as AccessSelectorRowView;
|
||||
});
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
protected handleCreateAccessPolicies(selected: SelectItemView[]) {
|
||||
@@ -59,14 +59,14 @@ export class ServiceAccountProjectsComponent implements OnInit, OnDestroy {
|
||||
return this.accessPolicyService.createGrantedPolicies(
|
||||
this.organizationId,
|
||||
this.serviceAccountId,
|
||||
serviceAccountProjectAccessPolicyView
|
||||
serviceAccountProjectAccessPolicyView,
|
||||
);
|
||||
}
|
||||
|
||||
protected async handleUpdateAccessPolicy(policy: AccessSelectorRowView) {
|
||||
try {
|
||||
return await this.accessPolicyService.updateAccessPolicy(
|
||||
AccessSelectorComponent.getBaseAccessPolicyView(policy)
|
||||
AccessSelectorComponent.getBaseAccessPolicyView(policy),
|
||||
);
|
||||
} catch (e) {
|
||||
this.validationService.showError(e);
|
||||
@@ -84,7 +84,7 @@ export class ServiceAccountProjectsComponent implements OnInit, OnDestroy {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private validationService: ValidationService,
|
||||
private accessPolicyService: AccessPolicyService
|
||||
private accessPolicyService: AccessPolicyService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
@@ -31,7 +31,7 @@ export class ServiceAccountComponent implements OnInit, OnDestroy {
|
||||
|
||||
private onChange$ = this.serviceAccountService.serviceAccount$.pipe(
|
||||
filter((sa) => sa?.id === this.serviceAccountId),
|
||||
startWith(null)
|
||||
startWith(null),
|
||||
);
|
||||
|
||||
private serviceAccountView: ServiceAccountView;
|
||||
@@ -39,19 +39,19 @@ export class ServiceAccountComponent implements OnInit, OnDestroy {
|
||||
switchMap(([params, _]) =>
|
||||
this.serviceAccountService.getByServiceAccountId(
|
||||
params.serviceAccountId,
|
||||
params.organizationId
|
||||
)
|
||||
params.organizationId,
|
||||
),
|
||||
),
|
||||
catchError(() => {
|
||||
this.router.navigate(["/sm", this.organizationId, "service-accounts"]).then(() => {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
null,
|
||||
this.i18nService.t("notFound", this.i18nService.t("serviceAccount"))
|
||||
this.i18nService.t("notFound", this.i18nService.t("serviceAccount")),
|
||||
);
|
||||
});
|
||||
return EMPTY;
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
constructor(
|
||||
@@ -60,7 +60,7 @@ export class ServiceAccountComponent implements OnInit, OnDestroy {
|
||||
private dialogService: DialogService,
|
||||
private router: Router,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService
|
||||
private i18nService: I18nService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -77,7 +77,7 @@ export class ServiceAccountComponent implements OnInit, OnDestroy {
|
||||
protected openNewAccessTokenDialog() {
|
||||
AccessTokenCreateDialogComponent.openNewAccessTokenDialog(
|
||||
this.dialogService,
|
||||
this.serviceAccountView
|
||||
this.serviceAccountView,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,12 +31,12 @@ export class ServiceAccountService {
|
||||
constructor(
|
||||
private cryptoService: CryptoService,
|
||||
private apiService: ApiService,
|
||||
private encryptService: EncryptService
|
||||
private encryptService: EncryptService,
|
||||
) {}
|
||||
|
||||
async getServiceAccounts(
|
||||
organizationId: string,
|
||||
includeAccessToSecrets?: boolean
|
||||
includeAccessToSecrets?: boolean,
|
||||
): Promise<ServiceAccountSecretsDetailsView[]> {
|
||||
const params = new URLSearchParams();
|
||||
if (includeAccessToSecrets) {
|
||||
@@ -48,7 +48,7 @@ export class ServiceAccountService {
|
||||
"/organizations/" + organizationId + "/service-accounts?" + params.toString(),
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
const results = new ListResponse(r, ServiceAccountSecretsDetailsResponse);
|
||||
return await this.createServiceAccountSecretsDetailsViews(organizationId, results.data);
|
||||
@@ -56,7 +56,7 @@ export class ServiceAccountService {
|
||||
|
||||
async getByServiceAccountId(
|
||||
serviceAccountId: string,
|
||||
organizationId: string
|
||||
organizationId: string,
|
||||
): Promise<ServiceAccountView> {
|
||||
const orgKey = await this.getOrganizationKey(organizationId);
|
||||
const r = await this.apiService.send(
|
||||
@@ -64,7 +64,7 @@ export class ServiceAccountService {
|
||||
"/service-accounts/" + serviceAccountId,
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
return await this.createServiceAccountView(orgKey, new ServiceAccountResponse(r));
|
||||
@@ -73,7 +73,7 @@ export class ServiceAccountService {
|
||||
async update(
|
||||
serviceAccountId: string,
|
||||
organizationId: string,
|
||||
serviceAccountView: ServiceAccountView
|
||||
serviceAccountView: ServiceAccountView,
|
||||
) {
|
||||
const orgKey = await this.getOrganizationKey(organizationId);
|
||||
const request = await this.getServiceAccountRequest(orgKey, serviceAccountView);
|
||||
@@ -82,10 +82,10 @@ export class ServiceAccountService {
|
||||
"/service-accounts/" + serviceAccountId,
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
this._serviceAccount.next(
|
||||
await this.createServiceAccountView(orgKey, new ServiceAccountResponse(r))
|
||||
await this.createServiceAccountView(orgKey, new ServiceAccountResponse(r)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -97,10 +97,10 @@ export class ServiceAccountService {
|
||||
"/organizations/" + organizationId + "/service-accounts",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
this._serviceAccount.next(
|
||||
await this.createServiceAccountView(orgKey, new ServiceAccountResponse(r))
|
||||
await this.createServiceAccountView(orgKey, new ServiceAccountResponse(r)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ export class ServiceAccountService {
|
||||
|
||||
private async getServiceAccountRequest(
|
||||
organizationKey: SymmetricCryptoKey,
|
||||
serviceAccountView: ServiceAccountView
|
||||
serviceAccountView: ServiceAccountView,
|
||||
) {
|
||||
const request = new ServiceAccountRequest();
|
||||
request.name = await this.encryptService.encrypt(serviceAccountView.name, organizationKey);
|
||||
@@ -134,7 +134,7 @@ export class ServiceAccountService {
|
||||
|
||||
private async createServiceAccountView(
|
||||
organizationKey: SymmetricCryptoKey,
|
||||
serviceAccountResponse: ServiceAccountResponse
|
||||
serviceAccountResponse: ServiceAccountResponse,
|
||||
): Promise<ServiceAccountView> {
|
||||
const serviceAccountView = new ServiceAccountView();
|
||||
serviceAccountView.id = serviceAccountResponse.id;
|
||||
@@ -144,7 +144,7 @@ export class ServiceAccountService {
|
||||
serviceAccountView.name = serviceAccountResponse.name
|
||||
? await this.encryptService.decryptToUtf8(
|
||||
new EncString(serviceAccountResponse.name),
|
||||
organizationKey
|
||||
organizationKey,
|
||||
)
|
||||
: null;
|
||||
return serviceAccountView;
|
||||
@@ -152,7 +152,7 @@ export class ServiceAccountService {
|
||||
|
||||
private async createServiceAccountSecretsDetailsView(
|
||||
organizationKey: SymmetricCryptoKey,
|
||||
response: ServiceAccountSecretsDetailsResponse
|
||||
response: ServiceAccountSecretsDetailsResponse,
|
||||
): Promise<ServiceAccountSecretsDetailsView> {
|
||||
const view = new ServiceAccountSecretsDetailsView();
|
||||
view.id = response.id;
|
||||
@@ -168,13 +168,13 @@ export class ServiceAccountService {
|
||||
|
||||
private async createServiceAccountSecretsDetailsViews(
|
||||
organizationId: string,
|
||||
serviceAccountResponses: ServiceAccountSecretsDetailsResponse[]
|
||||
serviceAccountResponses: ServiceAccountSecretsDetailsResponse[],
|
||||
): Promise<ServiceAccountSecretsDetailsView[]> {
|
||||
const orgKey = await this.getOrganizationKey(organizationId);
|
||||
return await Promise.all(
|
||||
serviceAccountResponses.map(async (s: ServiceAccountSecretsDetailsResponse) => {
|
||||
return await this.createServiceAccountSecretsDetailsView(orgKey, s);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<td bitCell>
|
||||
<span> {{ serviceAccount.accessToSecrets }} </span>
|
||||
</td>
|
||||
<td bitCell>{{ serviceAccount.revisionDate | date : "medium" }}</td>
|
||||
<td bitCell>{{ serviceAccount.revisionDate | date: "medium" }}</td>
|
||||
<td bitCell>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -46,7 +46,7 @@ export class ServiceAccountsListComponent implements OnDestroy {
|
||||
|
||||
constructor(
|
||||
private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
) {
|
||||
this.selection.changed
|
||||
.pipe(takeUntil(this.destroy$))
|
||||
@@ -82,13 +82,13 @@ export class ServiceAccountsListComponent implements OnDestroy {
|
||||
bulkDeleteServiceAccounts() {
|
||||
if (this.selection.selected.length >= 1) {
|
||||
this.deleteServiceAccountsEvent.emit(
|
||||
this.serviceAccounts.filter((sa) => this.selection.isSelected(sa.id))
|
||||
this.serviceAccounts.filter((sa) => this.selection.isSelected(sa.id)),
|
||||
);
|
||||
} else {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("nothingSelected")
|
||||
this.i18nService.t("nothingSelected"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export class ServiceAccountsComponent implements OnInit {
|
||||
private dialogService: DialogService,
|
||||
private accessPolicyService: AccessPolicyService,
|
||||
private serviceAccountService: ServiceAccountService,
|
||||
private organizationService: OrganizationService
|
||||
private organizationService: OrganizationService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -52,7 +52,7 @@ export class ServiceAccountsComponent implements OnInit {
|
||||
this.organizationEnabled = this.organizationService.get(params.organizationId)?.enabled;
|
||||
|
||||
return await this.getServiceAccounts();
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ export class ServiceAccountsComponent implements OnInit {
|
||||
data: {
|
||||
serviceAccounts: event,
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ export class SecretsManagerImportErrorDialogComponent {
|
||||
constructor(
|
||||
public dialogRef: DialogRef,
|
||||
private i18nService: I18nService,
|
||||
@Inject(DIALOG_DATA) public data: SecretsManagerImportErrorDialogOperation
|
||||
@Inject(DIALOG_DATA) public data: SecretsManagerImportErrorDialogOperation,
|
||||
) {
|
||||
this.errorLines = data.error.lines;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<form [formGroup]="formGroup" [bitSubmit]="submit">
|
||||
<div class="tw-my-4 tw-max-w-xl">
|
||||
<app-callout type="info" title="{{ 'exportingOrganizationSecretDataTitle' | i18n }}">
|
||||
{{ "exportingOrganizationSecretDataDescription" | i18n : orgName }}
|
||||
{{ "exportingOrganizationSecretDataDescription" | i18n: orgName }}
|
||||
</app-callout>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -43,14 +43,14 @@ export class SecretsManagerExportComponent implements OnInit, OnDestroy {
|
||||
private fileDownloadService: FileDownloadService,
|
||||
private logService: LogService,
|
||||
private dialogService: DialogService,
|
||||
private secretsManagerApiService: SecretsManagerPortingApiService
|
||||
private secretsManagerApiService: SecretsManagerPortingApiService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
this.route.params
|
||||
.pipe(
|
||||
switchMap(async (params) => await this.organizationService.get(params.organizationId)),
|
||||
takeUntil(this.destroy$)
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe((organization) => {
|
||||
this.orgName = organization.name;
|
||||
|
||||
@@ -38,7 +38,7 @@ export class SecretsManagerImportComponent implements OnInit, OnDestroy {
|
||||
protected fileDownloadService: FileDownloadService,
|
||||
private logService: LogService,
|
||||
private secretsManagerPortingApiService: SecretsManagerPortingApiService,
|
||||
private dialogService: DialogService
|
||||
private dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@@ -56,14 +56,14 @@ export class SecretsManagerImportComponent implements OnInit, OnDestroy {
|
||||
const fileElement = document.getElementById("file") as HTMLInputElement;
|
||||
const importContents = await this.getImportContents(
|
||||
fileElement,
|
||||
this.formGroup.get("pastedContents").value.trim()
|
||||
this.formGroup.get("pastedContents").value.trim(),
|
||||
);
|
||||
|
||||
if (importContents == null) {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("selectFile")
|
||||
this.i18nService.t("selectFile"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -78,14 +78,14 @@ export class SecretsManagerImportComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
error.message
|
||||
error.message,
|
||||
);
|
||||
return;
|
||||
} else if (error != null) {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("errorReadingImportFile")
|
||||
this.i18nService.t("errorReadingImportFile"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ export class SecretsManagerImportComponent implements OnInit, OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("errorReadingImportFile")
|
||||
this.i18nService.t("errorReadingImportFile"),
|
||||
);
|
||||
this.logService.error(error);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ export class SecretsManagerImportComponent implements OnInit, OnDestroy {
|
||||
|
||||
protected async getImportContents(
|
||||
fileElement: HTMLInputElement,
|
||||
pastedContents: string
|
||||
pastedContents: string,
|
||||
): Promise<string> {
|
||||
const files = fileElement.files;
|
||||
|
||||
@@ -168,7 +168,7 @@ export class SecretsManagerImportComponent implements OnInit, OnDestroy {
|
||||
data: {
|
||||
error: error,
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export class SecretsManagerPortingApiService {
|
||||
private apiService: ApiService,
|
||||
private encryptService: EncryptService,
|
||||
private cryptoService: CryptoService,
|
||||
private i18nService: I18nService
|
||||
private i18nService: I18nService,
|
||||
) {}
|
||||
|
||||
async export(organizationId: string): Promise<string> {
|
||||
@@ -35,13 +35,13 @@ export class SecretsManagerPortingApiService {
|
||||
"/sm/" + organizationId + "/export",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
return JSON.stringify(
|
||||
await this.decryptExport(organizationId, new SecretsManagerExportResponse(response)),
|
||||
null,
|
||||
" "
|
||||
" ",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ export class SecretsManagerPortingApiService {
|
||||
"/sm/" + organizationId + "/import",
|
||||
requestBody,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
} catch (error) {
|
||||
const errorResponse = new ErrorResponse(error, 400);
|
||||
@@ -67,7 +67,7 @@ export class SecretsManagerPortingApiService {
|
||||
|
||||
private async encryptImport(
|
||||
organizationId: string,
|
||||
importData: any
|
||||
importData: any,
|
||||
): Promise<SecretsManagerImportRequest> {
|
||||
const encryptedImport = new SecretsManagerImportRequest();
|
||||
|
||||
@@ -82,7 +82,7 @@ export class SecretsManagerPortingApiService {
|
||||
project.id = p.id;
|
||||
project.name = await this.encryptService.encrypt(p.name, orgKey);
|
||||
return project;
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
encryptedImport.secrets = await Promise.all(
|
||||
@@ -99,7 +99,7 @@ export class SecretsManagerPortingApiService {
|
||||
secret.projectIds = s.projectIds;
|
||||
|
||||
return secret;
|
||||
})
|
||||
}),
|
||||
);
|
||||
} catch (error) {
|
||||
return null;
|
||||
@@ -110,7 +110,7 @@ export class SecretsManagerPortingApiService {
|
||||
|
||||
private async decryptExport(
|
||||
organizationId: string,
|
||||
exportData: SecretsManagerExportResponse
|
||||
exportData: SecretsManagerExportResponse,
|
||||
): Promise<SecretsManagerExport> {
|
||||
const orgKey = await this.cryptoService.getOrgKey(organizationId);
|
||||
const decryptedExport = new SecretsManagerExport();
|
||||
@@ -123,7 +123,7 @@ export class SecretsManagerPortingApiService {
|
||||
project.id = p.id;
|
||||
project.name = await this.encryptService.decryptToUtf8(new EncString(p.name), orgKey);
|
||||
return project;
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
decryptedExport.secrets = await Promise.all(
|
||||
@@ -140,7 +140,7 @@ export class SecretsManagerPortingApiService {
|
||||
secret.projectIds = s.projectIds;
|
||||
|
||||
return secret;
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
return decryptedExport;
|
||||
@@ -148,7 +148,7 @@ export class SecretsManagerPortingApiService {
|
||||
|
||||
private handleServerError(
|
||||
errorResponse: ErrorResponse,
|
||||
importResult: any
|
||||
importResult: any,
|
||||
): SecretsManagerImportError {
|
||||
if (errorResponse.validationErrors == null) {
|
||||
return new SecretsManagerImportError(errorResponse.message);
|
||||
|
||||
@@ -106,14 +106,14 @@ export class AccessPolicySelectorComponent implements ControlValueAccessor, OnIn
|
||||
m.icon = m.icon ?? ApItemEnumUtil.itemIcon(m.type);
|
||||
return m;
|
||||
}),
|
||||
selected
|
||||
selected,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
constructor(
|
||||
private readonly formBuilder: FormBuilder,
|
||||
private readonly i18nService: I18nService
|
||||
private readonly i18nService: I18nService,
|
||||
) {}
|
||||
|
||||
/** Required for NG_VALUE_ACCESSOR */
|
||||
|
||||
@@ -66,7 +66,7 @@ describe("AccessPolicySelectorService", () => {
|
||||
createApItemValueType({
|
||||
permission: ApPermissionEnum.CanRead,
|
||||
currentUser: true,
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
const result = await sut.showAccessRemovalWarning(org.id, selectedPolicyValues);
|
||||
@@ -220,7 +220,7 @@ const orgFactory = (props: Partial<Organization> = {}) =>
|
||||
enabled: true,
|
||||
type: OrganizationUserType.Admin,
|
||||
},
|
||||
props
|
||||
props,
|
||||
);
|
||||
|
||||
function createApItemValueType(options: Partial<ApItemValueType> = {}) {
|
||||
|
||||
@@ -14,7 +14,7 @@ export class AccessPolicySelectorService {
|
||||
|
||||
async showAccessRemovalWarning(
|
||||
organizationId: string,
|
||||
selectedPoliciesValues: ApItemValueType[]
|
||||
selectedPoliciesValues: ApItemValueType[],
|
||||
): Promise<boolean> {
|
||||
const organization = this.organizationService.get(organizationId);
|
||||
if (organization.isOwner || organization.isAdmin) {
|
||||
@@ -25,14 +25,14 @@ export class AccessPolicySelectorService {
|
||||
(s) =>
|
||||
s.type === ApItemEnum.User &&
|
||||
s.currentUser &&
|
||||
s.permission === ApPermissionEnum.CanReadWrite
|
||||
s.permission === ApPermissionEnum.CanReadWrite,
|
||||
);
|
||||
|
||||
const selectedGroupReadWritePolicies = selectedPoliciesValues.filter(
|
||||
(s) =>
|
||||
s.type === ApItemEnum.Group &&
|
||||
s.permission == ApPermissionEnum.CanReadWrite &&
|
||||
s.currentUserInGroup
|
||||
s.currentUserInGroup,
|
||||
);
|
||||
|
||||
if (selectedGroupReadWritePolicies == null || selectedGroupReadWritePolicies.length == 0) {
|
||||
|
||||
@@ -17,7 +17,7 @@ export type ApItemValueType = {
|
||||
|
||||
export function convertToProjectPeopleAccessPoliciesView(
|
||||
projectId: string,
|
||||
selectedPolicyValues: ApItemValueType[]
|
||||
selectedPolicyValues: ApItemValueType[],
|
||||
): ProjectPeopleAccessPoliciesView {
|
||||
const view = new ProjectPeopleAccessPoliciesView();
|
||||
view.userAccessPolicies = selectedPolicyValues
|
||||
|
||||
@@ -7,30 +7,29 @@ import { PotentialGranteeView } from "../../../../models/view/potential-grantee.
|
||||
import { ApItemEnum, ApItemEnumUtil } from "./enums/ap-item.enum";
|
||||
import { ApPermissionEnum, ApPermissionEnumUtil } from "./enums/ap-permission.enum";
|
||||
|
||||
export type ApItemViewType =
|
||||
| SelectItemView & {
|
||||
accessPolicyId?: string;
|
||||
permission?: ApPermissionEnum;
|
||||
} & (
|
||||
| {
|
||||
type: ApItemEnum.User;
|
||||
userId?: string;
|
||||
currentUser?: boolean;
|
||||
}
|
||||
| {
|
||||
type: ApItemEnum.Group;
|
||||
currentUserInGroup?: boolean;
|
||||
}
|
||||
| {
|
||||
type: ApItemEnum.ServiceAccount;
|
||||
}
|
||||
| {
|
||||
type: ApItemEnum.Project;
|
||||
}
|
||||
);
|
||||
export type ApItemViewType = SelectItemView & {
|
||||
accessPolicyId?: string;
|
||||
permission?: ApPermissionEnum;
|
||||
} & (
|
||||
| {
|
||||
type: ApItemEnum.User;
|
||||
userId?: string;
|
||||
currentUser?: boolean;
|
||||
}
|
||||
| {
|
||||
type: ApItemEnum.Group;
|
||||
currentUserInGroup?: boolean;
|
||||
}
|
||||
| {
|
||||
type: ApItemEnum.ServiceAccount;
|
||||
}
|
||||
| {
|
||||
type: ApItemEnum.Project;
|
||||
}
|
||||
);
|
||||
|
||||
export function convertToAccessPolicyItemViews(
|
||||
value: ProjectPeopleAccessPoliciesView
|
||||
value: ProjectPeopleAccessPoliciesView,
|
||||
): ApItemViewType[] {
|
||||
const accessPolicies: ApItemViewType[] = [];
|
||||
|
||||
@@ -65,7 +64,7 @@ export function convertToAccessPolicyItemViews(
|
||||
}
|
||||
|
||||
export function convertPotentialGranteesToApItemViewType(
|
||||
grantees: PotentialGranteeView[]
|
||||
grantees: PotentialGranteeView[],
|
||||
): ApItemViewType[] {
|
||||
return grantees.map((granteeView) => {
|
||||
let icon: string;
|
||||
|
||||
@@ -71,7 +71,7 @@ export class AccessPolicyService {
|
||||
private cryptoService: CryptoService,
|
||||
private organizationService: OrganizationService,
|
||||
protected apiService: ApiService,
|
||||
protected encryptService: EncryptService
|
||||
protected encryptService: EncryptService,
|
||||
) {}
|
||||
|
||||
refreshProjectAccessPolicyChanges() {
|
||||
@@ -84,14 +84,14 @@ export class AccessPolicyService {
|
||||
|
||||
async getGrantedPolicies(
|
||||
serviceAccountId: string,
|
||||
organizationId: string
|
||||
organizationId: string,
|
||||
): Promise<ServiceAccountProjectAccessPolicyView[]> {
|
||||
const r = await this.apiService.send(
|
||||
"GET",
|
||||
"/service-accounts/" + serviceAccountId + "/granted-policies",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
const results = new ListResponse(r, ServiceAccountProjectAccessPolicyResponse);
|
||||
@@ -101,7 +101,7 @@ export class AccessPolicyService {
|
||||
async createGrantedPolicies(
|
||||
organizationId: string,
|
||||
serviceAccountId: string,
|
||||
policies: ServiceAccountProjectAccessPolicyView[]
|
||||
policies: ServiceAccountProjectAccessPolicyView[],
|
||||
): Promise<ServiceAccountProjectAccessPolicyView[]> {
|
||||
const request = this.getGrantedPoliciesCreateRequest(policies);
|
||||
const r = await this.apiService.send(
|
||||
@@ -109,12 +109,12 @@ export class AccessPolicyService {
|
||||
"/service-accounts/" + serviceAccountId + "/granted-policies",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
const results = new ListResponse(r, ServiceAccountProjectAccessPolicyResponse);
|
||||
const views = await this.createServiceAccountProjectAccessPolicyViews(
|
||||
results.data,
|
||||
organizationId
|
||||
organizationId,
|
||||
);
|
||||
this._serviceAccountGrantedPolicyChanges$.next(views);
|
||||
return views;
|
||||
@@ -122,14 +122,14 @@ export class AccessPolicyService {
|
||||
|
||||
async getProjectAccessPolicies(
|
||||
organizationId: string,
|
||||
projectId: string
|
||||
projectId: string,
|
||||
): Promise<ProjectAccessPoliciesView> {
|
||||
const r = await this.apiService.send(
|
||||
"GET",
|
||||
"/projects/" + projectId + "/access-policies",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
const results = new ProjectAccessPoliciesResponse(r);
|
||||
@@ -137,14 +137,14 @@ export class AccessPolicyService {
|
||||
}
|
||||
|
||||
async getProjectPeopleAccessPolicies(
|
||||
projectId: string
|
||||
projectId: string,
|
||||
): Promise<ProjectPeopleAccessPoliciesView> {
|
||||
const r = await this.apiService.send(
|
||||
"GET",
|
||||
"/projects/" + projectId + "/access-policies/people",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
const results = new ProjectPeopleAccessPoliciesResponse(r);
|
||||
@@ -153,7 +153,7 @@ export class AccessPolicyService {
|
||||
|
||||
async putProjectPeopleAccessPolicies(
|
||||
projectId: string,
|
||||
peoplePoliciesView: ProjectPeopleAccessPoliciesView
|
||||
peoplePoliciesView: ProjectPeopleAccessPoliciesView,
|
||||
) {
|
||||
const request = this.getPeopleAccessPoliciesRequest(peoplePoliciesView);
|
||||
const r = await this.apiService.send(
|
||||
@@ -161,21 +161,21 @@ export class AccessPolicyService {
|
||||
"/projects/" + projectId + "/access-policies/people",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
const results = new ProjectPeopleAccessPoliciesResponse(r);
|
||||
return this.createProjectPeopleAccessPoliciesView(results);
|
||||
}
|
||||
|
||||
async getServiceAccountAccessPolicies(
|
||||
serviceAccountId: string
|
||||
serviceAccountId: string,
|
||||
): Promise<ServiceAccountAccessPoliciesView> {
|
||||
const r = await this.apiService.send(
|
||||
"GET",
|
||||
"/service-accounts/" + serviceAccountId + "/access-policies",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
const results = new ServiceAccountAccessPoliciesResponse(r);
|
||||
@@ -185,7 +185,7 @@ export class AccessPolicyService {
|
||||
async createProjectAccessPolicies(
|
||||
organizationId: string,
|
||||
projectId: string,
|
||||
projectAccessPoliciesView: ProjectAccessPoliciesView
|
||||
projectAccessPoliciesView: ProjectAccessPoliciesView,
|
||||
): Promise<ProjectAccessPoliciesView> {
|
||||
const request = this.getAccessPoliciesCreateRequest(projectAccessPoliciesView);
|
||||
const r = await this.apiService.send(
|
||||
@@ -193,7 +193,7 @@ export class AccessPolicyService {
|
||||
"/projects/" + projectId + "/access-policies",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
const results = new ProjectAccessPoliciesResponse(r);
|
||||
const view = await this.createProjectAccessPoliciesView(organizationId, results);
|
||||
@@ -203,17 +203,17 @@ export class AccessPolicyService {
|
||||
|
||||
async createServiceAccountAccessPolicies(
|
||||
serviceAccountId: string,
|
||||
serviceAccountAccessPoliciesView: ServiceAccountAccessPoliciesView
|
||||
serviceAccountAccessPoliciesView: ServiceAccountAccessPoliciesView,
|
||||
): Promise<ServiceAccountAccessPoliciesView> {
|
||||
const request = this.getServiceAccountAccessPoliciesCreateRequest(
|
||||
serviceAccountAccessPoliciesView
|
||||
serviceAccountAccessPoliciesView,
|
||||
);
|
||||
const r = await this.apiService.send(
|
||||
"POST",
|
||||
"/service-accounts/" + serviceAccountId + "/access-policies",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
const results = new ServiceAccountAccessPoliciesResponse(r);
|
||||
const view = await this.createServiceAccountAccessPoliciesView(results);
|
||||
@@ -237,14 +237,14 @@ export class AccessPolicyService {
|
||||
"/access-policies/" + baseAccessPolicyView.id,
|
||||
payload,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
async needToShowAccessRemovalWarning(
|
||||
organizationId: string,
|
||||
policy: AccessSelectorRowView,
|
||||
currentPolicies: AccessSelectorRowView[]
|
||||
currentPolicies: AccessSelectorRowView[],
|
||||
): Promise<boolean> {
|
||||
const organization = this.organizationService.get(organizationId);
|
||||
if (organization.isOwner || organization.isAdmin) {
|
||||
@@ -273,7 +273,7 @@ export class AccessPolicyService {
|
||||
|
||||
private async createProjectAccessPoliciesView(
|
||||
organizationId: string,
|
||||
projectAccessPoliciesResponse: ProjectAccessPoliciesResponse
|
||||
projectAccessPoliciesResponse: ProjectAccessPoliciesResponse,
|
||||
): Promise<ProjectAccessPoliciesView> {
|
||||
const orgKey = await this.getOrganizationKey(organizationId);
|
||||
const view = new ProjectAccessPoliciesView();
|
||||
@@ -287,13 +287,13 @@ export class AccessPolicyService {
|
||||
view.serviceAccountAccessPolicies = await Promise.all(
|
||||
projectAccessPoliciesResponse.serviceAccountAccessPolicies.map(async (ap) => {
|
||||
return await this.createServiceAccountProjectAccessPolicyView(orgKey, ap);
|
||||
})
|
||||
}),
|
||||
);
|
||||
return view;
|
||||
}
|
||||
|
||||
private createProjectPeopleAccessPoliciesView(
|
||||
peopleAccessPoliciesResponse: ProjectPeopleAccessPoliciesResponse
|
||||
peopleAccessPoliciesResponse: ProjectPeopleAccessPoliciesResponse,
|
||||
): ProjectPeopleAccessPoliciesView {
|
||||
const view = new ProjectPeopleAccessPoliciesView();
|
||||
|
||||
@@ -307,7 +307,7 @@ export class AccessPolicyService {
|
||||
}
|
||||
|
||||
private getAccessPoliciesCreateRequest(
|
||||
projectAccessPoliciesView: ProjectAccessPoliciesView
|
||||
projectAccessPoliciesView: ProjectAccessPoliciesView,
|
||||
): AccessPoliciesCreateRequest {
|
||||
const createRequest = new AccessPoliciesCreateRequest();
|
||||
|
||||
@@ -315,7 +315,7 @@ export class AccessPolicyService {
|
||||
createRequest.userAccessPolicyRequests = projectAccessPoliciesView.userAccessPolicies.map(
|
||||
(ap) => {
|
||||
return this.getAccessPolicyRequest(ap.organizationUserId, ap);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ export class AccessPolicyService {
|
||||
createRequest.groupAccessPolicyRequests = projectAccessPoliciesView.groupAccessPolicies.map(
|
||||
(ap) => {
|
||||
return this.getAccessPolicyRequest(ap.groupId, ap);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ export class AccessPolicyService {
|
||||
}
|
||||
|
||||
private getPeopleAccessPoliciesRequest(
|
||||
projectPeopleAccessPoliciesView: ProjectPeopleAccessPoliciesView
|
||||
projectPeopleAccessPoliciesView: ProjectPeopleAccessPoliciesView,
|
||||
): PeopleAccessPoliciesRequest {
|
||||
const request = new PeopleAccessPoliciesRequest();
|
||||
|
||||
@@ -345,7 +345,7 @@ export class AccessPolicyService {
|
||||
request.userAccessPolicyRequests = projectPeopleAccessPoliciesView.userAccessPolicies.map(
|
||||
(ap) => {
|
||||
return this.getAccessPolicyRequest(ap.organizationUserId, ap);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ export class AccessPolicyService {
|
||||
request.groupAccessPolicyRequests = projectPeopleAccessPoliciesView.groupAccessPolicies.map(
|
||||
(ap) => {
|
||||
return this.getAccessPolicyRequest(ap.groupId, ap);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ export class AccessPolicyService {
|
||||
}
|
||||
|
||||
private createUserProjectAccessPolicyView(
|
||||
response: UserProjectAccessPolicyResponse
|
||||
response: UserProjectAccessPolicyResponse,
|
||||
): UserProjectAccessPolicyView {
|
||||
return {
|
||||
...this.createBaseAccessPolicyView(response),
|
||||
@@ -374,7 +374,7 @@ export class AccessPolicyService {
|
||||
}
|
||||
|
||||
private createGroupProjectAccessPolicyView(
|
||||
response: GroupProjectAccessPolicyResponse
|
||||
response: GroupProjectAccessPolicyResponse,
|
||||
): GroupProjectAccessPolicyView {
|
||||
return {
|
||||
...this.createBaseAccessPolicyView(response),
|
||||
@@ -387,7 +387,7 @@ export class AccessPolicyService {
|
||||
|
||||
private async createServiceAccountProjectAccessPolicyView(
|
||||
organizationKey: SymmetricCryptoKey,
|
||||
response: ServiceAccountProjectAccessPolicyResponse
|
||||
response: ServiceAccountProjectAccessPolicyResponse,
|
||||
): Promise<ServiceAccountProjectAccessPolicyView> {
|
||||
return {
|
||||
...this.createBaseAccessPolicyView(response),
|
||||
@@ -396,18 +396,18 @@ export class AccessPolicyService {
|
||||
grantedProjectName: response.grantedProjectName
|
||||
? await this.encryptService.decryptToUtf8(
|
||||
new EncString(response.grantedProjectName),
|
||||
organizationKey
|
||||
organizationKey,
|
||||
)
|
||||
: null,
|
||||
serviceAccountName: await this.encryptService.decryptToUtf8(
|
||||
new EncString(response.serviceAccountName),
|
||||
organizationKey
|
||||
organizationKey,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
private getServiceAccountAccessPoliciesCreateRequest(
|
||||
serviceAccountAccessPoliciesView: ServiceAccountAccessPoliciesView
|
||||
serviceAccountAccessPoliciesView: ServiceAccountAccessPoliciesView,
|
||||
): AccessPoliciesCreateRequest {
|
||||
const createRequest = new AccessPoliciesCreateRequest();
|
||||
|
||||
@@ -429,7 +429,7 @@ export class AccessPolicyService {
|
||||
}
|
||||
|
||||
private async createServiceAccountAccessPoliciesView(
|
||||
serviceAccountAccessPoliciesResponse: ServiceAccountAccessPoliciesResponse
|
||||
serviceAccountAccessPoliciesResponse: ServiceAccountAccessPoliciesResponse,
|
||||
): Promise<ServiceAccountAccessPoliciesView> {
|
||||
const view = new ServiceAccountAccessPoliciesView();
|
||||
view.userAccessPolicies = serviceAccountAccessPoliciesResponse.userAccessPolicies.map((ap) => {
|
||||
@@ -438,13 +438,13 @@ export class AccessPolicyService {
|
||||
view.groupAccessPolicies = serviceAccountAccessPoliciesResponse.groupAccessPolicies.map(
|
||||
(ap) => {
|
||||
return this.createGroupServiceAccountAccessPolicyView(ap);
|
||||
}
|
||||
},
|
||||
);
|
||||
return view;
|
||||
}
|
||||
|
||||
private createUserServiceAccountAccessPolicyView(
|
||||
response: UserServiceAccountAccessPolicyResponse
|
||||
response: UserServiceAccountAccessPolicyResponse,
|
||||
): UserServiceAccountAccessPolicyView {
|
||||
return {
|
||||
...this.createBaseAccessPolicyView(response),
|
||||
@@ -456,7 +456,7 @@ export class AccessPolicyService {
|
||||
}
|
||||
|
||||
private createGroupServiceAccountAccessPolicyView(
|
||||
response: GroupServiceAccountAccessPolicyResponse
|
||||
response: GroupServiceAccountAccessPolicyResponse,
|
||||
): GroupServiceAccountAccessPolicyView {
|
||||
return {
|
||||
...this.createBaseAccessPolicyView(response),
|
||||
@@ -473,7 +473,7 @@ export class AccessPolicyService {
|
||||
"/organizations/" + organizationId + "/access-policies/people/potential-grantees",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
const results = new ListResponse(r, PotentialGranteeResponse);
|
||||
return await this.createPotentialGranteeViews(organizationId, results.data);
|
||||
@@ -485,7 +485,7 @@ export class AccessPolicyService {
|
||||
"/organizations/" + organizationId + "/access-policies/service-accounts/potential-grantees",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
const results = new ListResponse(r, PotentialGranteeResponse);
|
||||
return await this.createPotentialGranteeViews(organizationId, results.data);
|
||||
@@ -497,7 +497,7 @@ export class AccessPolicyService {
|
||||
"/organizations/" + organizationId + "/access-policies/projects/potential-grantees",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
const results = new ListResponse(r, PotentialGranteeResponse);
|
||||
return await this.createPotentialGranteeViews(organizationId, results.data);
|
||||
@@ -514,7 +514,7 @@ export class AccessPolicyService {
|
||||
| UserServiceAccountAccessPolicyView
|
||||
| GroupProjectAccessPolicyView
|
||||
| GroupServiceAccountAccessPolicyView
|
||||
| ServiceAccountProjectAccessPolicyView
|
||||
| ServiceAccountProjectAccessPolicyView,
|
||||
) {
|
||||
const request = new AccessPolicyRequest();
|
||||
request.granteeId = granteeId;
|
||||
@@ -529,7 +529,7 @@ export class AccessPolicyService {
|
||||
| UserServiceAccountAccessPolicyResponse
|
||||
| GroupProjectAccessPolicyResponse
|
||||
| GroupServiceAccountAccessPolicyResponse
|
||||
| ServiceAccountProjectAccessPolicyResponse
|
||||
| ServiceAccountProjectAccessPolicyResponse,
|
||||
) {
|
||||
return {
|
||||
id: response.id,
|
||||
@@ -542,7 +542,7 @@ export class AccessPolicyService {
|
||||
|
||||
private async createPotentialGranteeViews(
|
||||
organizationId: string,
|
||||
results: PotentialGranteeResponse[]
|
||||
results: PotentialGranteeResponse[],
|
||||
): Promise<PotentialGranteeView[]> {
|
||||
const orgKey = await this.getOrganizationKey(organizationId);
|
||||
return await Promise.all(
|
||||
@@ -560,12 +560,12 @@ export class AccessPolicyService {
|
||||
view.name = r.name;
|
||||
}
|
||||
return view;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
private getGrantedPoliciesCreateRequest(
|
||||
policies: ServiceAccountProjectAccessPolicyView[]
|
||||
policies: ServiceAccountProjectAccessPolicyView[],
|
||||
): GrantedPolicyRequest[] {
|
||||
return policies.map((ap) => {
|
||||
const request = new GrantedPolicyRequest();
|
||||
@@ -578,7 +578,7 @@ export class AccessPolicyService {
|
||||
|
||||
private async createServiceAccountProjectAccessPolicyViews(
|
||||
responses: ServiceAccountProjectAccessPolicyResponse[],
|
||||
organizationId: string
|
||||
organizationId: string,
|
||||
): Promise<ServiceAccountProjectAccessPolicyView[]> {
|
||||
const orgKey = await this.getOrganizationKey(organizationId);
|
||||
return await Promise.all(
|
||||
@@ -594,17 +594,17 @@ export class AccessPolicyService {
|
||||
view.serviceAccountName = response.serviceAccountName
|
||||
? await this.encryptService.decryptToUtf8(
|
||||
new EncString(response.serviceAccountName),
|
||||
orgKey
|
||||
orgKey,
|
||||
)
|
||||
: null;
|
||||
view.grantedProjectName = response.grantedProjectName
|
||||
? await this.encryptService.decryptToUtf8(
|
||||
new EncString(response.grantedProjectName),
|
||||
orgKey
|
||||
orgKey,
|
||||
)
|
||||
: null;
|
||||
return view;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,8 +108,8 @@ export class AccessSelectorComponent implements OnInit {
|
||||
labelName: labelName,
|
||||
listName: listName,
|
||||
};
|
||||
})
|
||||
)
|
||||
}),
|
||||
),
|
||||
),
|
||||
map((selectItems) => selectItems.sort((a, b) => a.listName.localeCompare(b.listName))),
|
||||
tap(() => {
|
||||
@@ -117,10 +117,13 @@ export class AccessSelectorComponent implements OnInit {
|
||||
this.formGroup.reset();
|
||||
this.formGroup.enable();
|
||||
}),
|
||||
share()
|
||||
share(),
|
||||
);
|
||||
|
||||
constructor(private accessPolicyService: AccessPolicyService, private route: ActivatedRoute) {}
|
||||
constructor(
|
||||
private accessPolicyService: AccessPolicyService,
|
||||
private route: ActivatedRoute,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.formGroup.disable();
|
||||
|
||||
@@ -22,7 +22,7 @@ export class AccessRemovalDialogComponent implements OnInit {
|
||||
public dialogRef: DialogRef,
|
||||
private router: Router,
|
||||
private accessPolicyService: AccessPolicyService,
|
||||
@Inject(DIALOG_DATA) public data: AccessRemovalDetails
|
||||
@Inject(DIALOG_DATA) public data: AccessRemovalDetails,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -36,7 +36,7 @@ export class AccessRemovalDialogComponent implements OnInit {
|
||||
) {
|
||||
this.dialogRef.close();
|
||||
throw new Error(
|
||||
"The access removal dialog was not called with the appropriate operation values."
|
||||
"The access removal dialog was not called with the appropriate operation values.",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ export class AccessRemovalDialogComponent implements OnInit {
|
||||
await this.accessPolicyService.deleteAccessPolicy(this.data.policy.accessPolicyId);
|
||||
} else if (this.data.operation == "update") {
|
||||
await this.accessPolicyService.updateAccessPolicy(
|
||||
AccessSelectorComponent.getBaseAccessPolicyView(this.data.policy)
|
||||
AccessSelectorComponent.getBaseAccessPolicyView(this.data.policy),
|
||||
);
|
||||
this.refreshPolicyChanges();
|
||||
}
|
||||
|
||||
@@ -15,15 +15,15 @@ export class ProjectAccessPoliciesResponse extends BaseResponse {
|
||||
super(response);
|
||||
const userAccessPolicies = this.getResponseProperty("UserAccessPolicies");
|
||||
this.userAccessPolicies = userAccessPolicies.map(
|
||||
(k: any) => new UserProjectAccessPolicyResponse(k)
|
||||
(k: any) => new UserProjectAccessPolicyResponse(k),
|
||||
);
|
||||
const groupAccessPolicies = this.getResponseProperty("GroupAccessPolicies");
|
||||
this.groupAccessPolicies = groupAccessPolicies.map(
|
||||
(k: any) => new GroupProjectAccessPolicyResponse(k)
|
||||
(k: any) => new GroupProjectAccessPolicyResponse(k),
|
||||
);
|
||||
const serviceAccountAccessPolicies = this.getResponseProperty("ServiceAccountAccessPolicies");
|
||||
this.serviceAccountAccessPolicies = serviceAccountAccessPolicies.map(
|
||||
(k: any) => new ServiceAccountProjectAccessPolicyResponse(k)
|
||||
(k: any) => new ServiceAccountProjectAccessPolicyResponse(k),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,11 +13,11 @@ export class ProjectPeopleAccessPoliciesResponse extends BaseResponse {
|
||||
super(response);
|
||||
const userAccessPolicies = this.getResponseProperty("UserAccessPolicies");
|
||||
this.userAccessPolicies = userAccessPolicies.map(
|
||||
(k: any) => new UserProjectAccessPolicyResponse(k)
|
||||
(k: any) => new UserProjectAccessPolicyResponse(k),
|
||||
);
|
||||
const groupAccessPolicies = this.getResponseProperty("GroupAccessPolicies");
|
||||
this.groupAccessPolicies = groupAccessPolicies.map(
|
||||
(k: any) => new GroupProjectAccessPolicyResponse(k)
|
||||
(k: any) => new GroupProjectAccessPolicyResponse(k),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,11 +13,11 @@ export class ServiceAccountAccessPoliciesResponse extends BaseResponse {
|
||||
super(response);
|
||||
const userAccessPolicies = this.getResponseProperty("UserAccessPolicies");
|
||||
this.userAccessPolicies = userAccessPolicies.map(
|
||||
(k: any) => new UserServiceAccountAccessPolicyResponse(k)
|
||||
(k: any) => new UserServiceAccountAccessPolicyResponse(k),
|
||||
);
|
||||
const groupAccessPolicies = this.getResponseProperty("GroupAccessPolicies");
|
||||
this.groupAccessPolicies = groupAccessPolicies.map(
|
||||
(k: any) => new GroupServiceAccountAccessPolicyResponse(k)
|
||||
(k: any) => new GroupServiceAccountAccessPolicyResponse(k),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export enum BulkConfirmationResult {
|
||||
export class BulkConfirmationDialogComponent implements OnInit {
|
||||
constructor(
|
||||
public dialogRef: DialogRef,
|
||||
@Inject(DIALOG_DATA) public data: BulkConfirmationDetails
|
||||
@Inject(DIALOG_DATA) public data: BulkConfirmationDetails,
|
||||
) {}
|
||||
|
||||
protected bulkConfirmationResult = BulkConfirmationResult;
|
||||
@@ -41,7 +41,7 @@ export class BulkConfirmationDialogComponent implements OnInit {
|
||||
) {
|
||||
this.dialogRef.close();
|
||||
throw new Error(
|
||||
"The bulk confirmation dialog was not called with the appropriate operation values."
|
||||
"The bulk confirmation dialog was not called with the appropriate operation values.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,10 @@ export class BulkOperationStatus {
|
||||
templateUrl: "./bulk-status-dialog.component.html",
|
||||
})
|
||||
export class BulkStatusDialogComponent implements OnInit {
|
||||
constructor(public dialogRef: DialogRef, @Inject(DIALOG_DATA) public data: BulkStatusDetails) {}
|
||||
constructor(
|
||||
public dialogRef: DialogRef,
|
||||
@Inject(DIALOG_DATA) public data: BulkStatusDetails,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
// TODO remove null checks once strictNullChecks in TypeScript is turned on.
|
||||
@@ -32,7 +35,7 @@ export class BulkStatusDialogComponent implements OnInit {
|
||||
) {
|
||||
this.dialogRef.close();
|
||||
throw new Error(
|
||||
"The bulk status dialog was not called with the appropriate operation values."
|
||||
"The bulk status dialog was not called with the appropriate operation values.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,14 +35,14 @@ export class HeaderComponent {
|
||||
private stateService: StateService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private vaultTimeoutSettingsService: VaultTimeoutSettingsService,
|
||||
private messagingService: MessagingService
|
||||
private messagingService: MessagingService,
|
||||
) {
|
||||
this.routeData$ = this.route.data.pipe(
|
||||
map((params) => {
|
||||
return {
|
||||
titleId: params.titleId,
|
||||
};
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
this.selfHosted = this.platformUtilsService.isSelfHost();
|
||||
@@ -53,7 +53,7 @@ export class HeaderComponent {
|
||||
]).pipe(
|
||||
map(([activeAccount, accounts]) => {
|
||||
return accounts[activeAccount]?.profile;
|
||||
})
|
||||
}),
|
||||
);
|
||||
this.canLock$ = this.vaultTimeoutSettingsService
|
||||
.availableVaultTimeoutActions$()
|
||||
|
||||
@@ -73,8 +73,8 @@ class MockDynamicAvatar {
|
||||
this.stateService.activeAccount$,
|
||||
]).pipe(
|
||||
map(
|
||||
([accounts, activeAccount]) => accounts[activeAccount as keyof typeof accounts].profile.name
|
||||
)
|
||||
([accounts, activeAccount]) => accounts[activeAccount as keyof typeof accounts].profile.name,
|
||||
),
|
||||
);
|
||||
constructor(private stateService: MockStateService) {}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ export default {
|
||||
component: HeaderComponent,
|
||||
decorators: [
|
||||
componentWrapperDecorator(
|
||||
(story) => `<div class="tw-min-h-screen tw-flex-1 tw-p-6 tw-text-main">${story}</div>`
|
||||
(story) => `<div class="tw-min-h-screen tw-flex-1 tw-p-6 tw-text-main">${story}</div>`,
|
||||
),
|
||||
moduleMetadata({
|
||||
imports: [
|
||||
|
||||
@@ -30,7 +30,7 @@ export class NewMenuComponent implements OnInit, OnDestroy {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private dialogService: DialogService,
|
||||
private organizationService: OrganizationService
|
||||
private organizationService: OrganizationService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
@@ -9,10 +9,13 @@ import { Icon, Icons } from "@bitwarden/components";
|
||||
templateUrl: "./org-suspended.component.html",
|
||||
})
|
||||
export class OrgSuspendedComponent {
|
||||
constructor(private organizationService: OrganizationService, private route: ActivatedRoute) {}
|
||||
constructor(
|
||||
private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
) {}
|
||||
|
||||
protected NoAccess: Icon = Icons.NoAccess;
|
||||
protected organizationName$ = this.route.params.pipe(
|
||||
map((params) => this.organizationService.get(params.organizationId)?.name)
|
||||
map((params) => this.organizationService.get(params.organizationId)?.name),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
}}</a>
|
||||
</div>
|
||||
</td>
|
||||
<td bitCell class="tw-whitespace-nowrap">{{ project.revisionDate | date : "medium" }}</td>
|
||||
<td bitCell class="tw-whitespace-nowrap">{{ project.revisionDate | date: "medium" }}</td>
|
||||
<td bitCell>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -37,12 +37,12 @@ export class ProjectsListComponent {
|
||||
selection = new SelectionModel<string>(true, []);
|
||||
protected dataSource = new TableDataSource<ProjectListView>();
|
||||
protected hasWriteAccessOnSelected$ = this.selection.changed.pipe(
|
||||
map((_) => this.selectedHasWriteAccess())
|
||||
map((_) => this.selectedHasWriteAccess()),
|
||||
);
|
||||
|
||||
constructor(
|
||||
private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
) {}
|
||||
|
||||
isAllSelected() {
|
||||
@@ -69,20 +69,20 @@ export class ProjectsListComponent {
|
||||
bulkDeleteProjects() {
|
||||
if (this.selection.selected.length >= 1) {
|
||||
this.deleteProjectEvent.emit(
|
||||
this.projects.filter((project) => this.selection.isSelected(project.id))
|
||||
this.projects.filter((project) => this.selection.isSelected(project.id)),
|
||||
);
|
||||
} else {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("nothingSelected")
|
||||
this.i18nService.t("nothingSelected"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private selectedHasWriteAccess() {
|
||||
const selectedProjects = this.projects.filter((project) =>
|
||||
this.selection.isSelected(project.id)
|
||||
this.selection.isSelected(project.id),
|
||||
);
|
||||
if (selectedProjects.some((project) => project.write)) {
|
||||
return true;
|
||||
|
||||
@@ -94,14 +94,14 @@
|
||||
class="tw-ml-1"
|
||||
[title]="project.name"
|
||||
>
|
||||
{{ project.name | ellipsis : 32 }}
|
||||
{{ project.name | ellipsis: 32 }}
|
||||
</span>
|
||||
<span *ngIf="secret.projects.length === 0" bitBadge badgeType="warning" class="tw-ml-1"
|
||||
><i class="bwi bwi-fw bwi-exclamation-triangle tw-mr-1" aria-hidden="true"></i
|
||||
>{{ "unassigned" | i18n }}</span
|
||||
>
|
||||
</td>
|
||||
<td bitCell class="tw-whitespace-nowrap">{{ secret.revisionDate | date : "medium" }}</td>
|
||||
<td bitCell class="tw-whitespace-nowrap">{{ secret.revisionDate | date: "medium" }}</td>
|
||||
<td bitCell>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -50,7 +50,7 @@ export class SecretsListComponent implements OnDestroy {
|
||||
|
||||
constructor(
|
||||
private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
) {
|
||||
this.selection.changed
|
||||
.pipe(takeUntil(this.destroy$))
|
||||
@@ -82,13 +82,13 @@ export class SecretsListComponent implements OnDestroy {
|
||||
bulkDeleteSecrets() {
|
||||
if (this.selection.selected.length >= 1) {
|
||||
this.deleteSecretsEvent.emit(
|
||||
this.secrets.filter((secret) => this.selection.isSelected(secret.id))
|
||||
this.secrets.filter((secret) => this.selection.isSelected(secret.id)),
|
||||
);
|
||||
} else {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("nothingSelected")
|
||||
this.i18nService.t("nothingSelected"),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ export class SecretsListComponent implements OnDestroy {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("errorOccurred"),
|
||||
this.i18nService.t("nothingSelected")
|
||||
this.i18nService.t("nothingSelected"),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -121,13 +121,13 @@ export class SecretsListComponent implements OnDestroy {
|
||||
static copySecretName(
|
||||
name: string,
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
i18nService: I18nService
|
||||
i18nService: I18nService,
|
||||
) {
|
||||
platformUtilsService.copyToClipboard(name);
|
||||
platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
i18nService.t("valueCopied", i18nService.t("name"))
|
||||
i18nService.t("valueCopied", i18nService.t("name")),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -138,14 +138,14 @@ export class SecretsListComponent implements OnDestroy {
|
||||
id: string,
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
i18nService: I18nService,
|
||||
secretService: SecretService
|
||||
secretService: SecretService,
|
||||
) {
|
||||
const value = secretService.getBySecretId(id).then((secret) => secret.value);
|
||||
SecretsListComponent.copyToClipboardAsync(value, platformUtilsService).then(() => {
|
||||
platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
i18nService.t("valueCopied", i18nService.t("value"))
|
||||
i18nService.t("valueCopied", i18nService.t("value")),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -153,13 +153,13 @@ export class SecretsListComponent implements OnDestroy {
|
||||
static copySecretUuid(
|
||||
id: string,
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
i18nService: I18nService
|
||||
i18nService: I18nService,
|
||||
) {
|
||||
platformUtilsService.copyToClipboard(id);
|
||||
platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
i18nService.t("valueCopied", i18nService.t("uuid"))
|
||||
i18nService.t("valueCopied", i18nService.t("uuid")),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ export class SecretsListComponent implements OnDestroy {
|
||||
*/
|
||||
private static copyToClipboardAsync(
|
||||
text: Promise<string>,
|
||||
platformUtilsService: PlatformUtilsService
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
) {
|
||||
if (platformUtilsService.isSafari()) {
|
||||
return navigator.clipboard.write([
|
||||
|
||||
@@ -20,7 +20,7 @@ export class SecretHardDeleteDialogComponent {
|
||||
private secretService: SecretService,
|
||||
private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
@Inject(DIALOG_DATA) public data: SecretHardDeleteOperation
|
||||
@Inject(DIALOG_DATA) public data: SecretHardDeleteOperation,
|
||||
) {}
|
||||
|
||||
get title() {
|
||||
|
||||
@@ -20,7 +20,7 @@ export class SecretRestoreDialogComponent {
|
||||
private secretService: SecretService,
|
||||
private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
@Inject(DIALOG_DATA) public data: SecretRestoreOperation
|
||||
@Inject(DIALOG_DATA) public data: SecretRestoreOperation,
|
||||
) {}
|
||||
|
||||
get title() {
|
||||
|
||||
@@ -33,7 +33,7 @@ export class TrashComponent implements OnInit {
|
||||
private secretService: SecretService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService,
|
||||
private dialogService: DialogService
|
||||
private dialogService: DialogService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -43,7 +43,7 @@ export class TrashComponent implements OnInit {
|
||||
switchMap(async ([_, params]) => {
|
||||
this.organizationId = params.organizationId;
|
||||
return await this.getSecrets();
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user