mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-14 01:45:12 +00:00
feat(console): feature settings (#7713)
* feature settings * feature component, i18n * i18n, save settings * i18n * reset button, state if system inherited, i18n * iam.restrictions.read * refetch feature after reset * use toggles instead of checkboxes * i18n * rm logs * fix i18n * show unspecified as inherited --------- Co-authored-by: Elio Bischof <[email protected]>
This commit is contained in:
co-authored by
Elio Bischof
parent
dcfa2f7955
commit
2061d1acdc
@@ -0,0 +1,57 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { GrpcService } from './grpc.service';
|
||||
|
||||
import {
|
||||
GetInstanceFeaturesRequest,
|
||||
GetInstanceFeaturesResponse,
|
||||
ResetInstanceFeaturesRequest,
|
||||
SetInstanceFeaturesRequest,
|
||||
SetInstanceFeaturesResponse,
|
||||
} from '../proto/generated/zitadel/feature/v2beta/instance_pb';
|
||||
import {
|
||||
GetOrganizationFeaturesRequest,
|
||||
GetOrganizationFeaturesResponse,
|
||||
} from '../proto/generated/zitadel/feature/v2beta/organization_pb';
|
||||
import { GetUserFeaturesRequest, GetUserFeaturesResponse } from '../proto/generated/zitadel/feature/v2beta/user_pb';
|
||||
import { GetSystemFeaturesRequest, GetSystemFeaturesResponse } from '../proto/generated/zitadel/feature/v2beta/system_pb';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class FeatureService {
|
||||
constructor(private readonly grpcService: GrpcService) {}
|
||||
|
||||
public getInstanceFeatures(inheritance: boolean): Promise<GetInstanceFeaturesResponse> {
|
||||
const req = new GetInstanceFeaturesRequest();
|
||||
req.setInheritance(inheritance);
|
||||
return this.grpcService.feature.getInstanceFeatures(req, null).then((resp) => resp);
|
||||
}
|
||||
|
||||
public setInstanceFeatures(req: SetInstanceFeaturesRequest): Promise<SetInstanceFeaturesResponse> {
|
||||
return this.grpcService.feature.setInstanceFeatures(req, null);
|
||||
}
|
||||
|
||||
public resetInstanceFeatures(): Promise<SetInstanceFeaturesResponse> {
|
||||
const req = new ResetInstanceFeaturesRequest();
|
||||
return this.grpcService.feature.resetInstanceFeatures(req, null);
|
||||
}
|
||||
|
||||
public getOrganizationFeatures(orgId: string, inheritance: boolean): Promise<GetOrganizationFeaturesResponse> {
|
||||
const req = new GetOrganizationFeaturesRequest();
|
||||
req.setOrganizationId(orgId);
|
||||
req.setInheritance(inheritance);
|
||||
return this.grpcService.feature.getOrganizationFeatures(req, null).then((resp) => resp);
|
||||
}
|
||||
|
||||
public getSystemFeatures(): Promise<GetSystemFeaturesResponse> {
|
||||
const req = new GetSystemFeaturesRequest();
|
||||
return this.grpcService.feature.getSystemFeatures(req, null).then((resp) => resp);
|
||||
}
|
||||
|
||||
public getUserFeatures(userId: string, inheritance: boolean): Promise<GetUserFeaturesResponse> {
|
||||
const req = new GetUserFeaturesRequest();
|
||||
req.setInheritance(inheritance);
|
||||
req.setUserId(userId);
|
||||
return this.grpcService.feature.getUserFeatures(req, null).then((resp) => resp);
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import { ExhaustedGrpcInterceptor } from './interceptors/exhausted.grpc.intercep
|
||||
import { I18nInterceptor } from './interceptors/i18n.interceptor';
|
||||
import { OrgInterceptor } from './interceptors/org.interceptor';
|
||||
import { StorageService } from './storage.service';
|
||||
import { FeatureServiceClient } from '../proto/generated/zitadel/feature/v2beta/Feature_serviceServiceClientPb';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -25,6 +26,7 @@ export class GrpcService {
|
||||
public auth!: AuthServiceClient;
|
||||
public mgmt!: ManagementServiceClient;
|
||||
public admin!: AdminServiceClient;
|
||||
public feature!: FeatureServiceClient;
|
||||
|
||||
constructor(
|
||||
private envService: EnvironmentService,
|
||||
@@ -76,6 +78,12 @@ export class GrpcService {
|
||||
// @ts-ignore
|
||||
interceptors,
|
||||
);
|
||||
this.feature = new FeatureServiceClient(
|
||||
env.api,
|
||||
null,
|
||||
// @ts-ignore
|
||||
interceptors,
|
||||
);
|
||||
|
||||
const authConfig: AuthConfig = {
|
||||
scope: 'openid profile email',
|
||||
|
||||
Reference in New Issue
Block a user