fix: remove old feature references in console (#3567)

* feat: permit all features to every instance and organisation

* remove old references in console
This commit is contained in:
Livio Amstutz 2022-05-02 11:51:37 +02:00 committed by GitHub
parent 861cf07700
commit d78e020b0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 31 additions and 154 deletions

View File

@ -81,7 +81,7 @@ export class AccountsCardComponent implements OnInit {
public get isOnSystem(): boolean {
return (
['/system', '/views', '/failed-events', '/system/members', '/system/features'].includes(this.router.url) ||
['/system', '/views', '/failed-events', '/system/members'].includes(this.router.url) ||
new RegExp('/system/policy/*').test(this.router.url)
);
}

View File

@ -65,7 +65,7 @@ export class HeaderComponent implements OnDestroy {
public get isOnSystem(): boolean {
return (
['/system', '/views', '/failed-events', '/system/members', '/system/features'].includes(this.router.url) ||
['/system', '/views', '/failed-events', '/system/members'].includes(this.router.url) ||
new RegExp('/system/policy/*').test(this.router.url)
);
}

View File

@ -5,9 +5,4 @@
<div class="info-section-content">
<ng-content></ng-content>
</div>
<a class="action" *ngIf="featureLink" actions [routerLink]="featureLink">
<span>{{'ACTIONS.GOTOFEATURES' | translate}}</span>
<i class="las la-angle-right"></i>
</a>
</div>
</div>

View File

@ -29,23 +29,6 @@
padding: .25rem 0;
}
.action {
font-size: 14px;
display: flex;
align-items: center;
text-decoration: none;
margin-left: .5rem;
border-radius: 50vw;
align-self: center;
padding: .25rem .5rem;
background: if($is-dark-theme, #00000030, #ffffff40);
font-weight: 600;
i {
font-size: 1.2rem;
}
}
&.info {
background-color: map-get($background, infosection);
color: map-get($foreground, infosection);

View File

@ -14,5 +14,4 @@ export enum InfoSectionType {
export class InfoSectionComponent {
@Input() type: InfoSectionType = InfoSectionType.INFO;
@Input() featureLink: string | string[] = '';
}

View File

@ -11,7 +11,7 @@
<span>{{ 'USER.SETTINGS.TITLE' | translate }}</span>
</button>
<ng-container *ngFor="let setting of settingsList">
<ng-container *ngIf="setting.featureRequired; else btn">
<ng-container>
<button
(click)="value = setting.id"
class="sidenav-setting-list-element hide-on-mobile"

View File

@ -4,7 +4,6 @@ import { NG_VALUE_ACCESSOR } from '@angular/forms';
export interface SidenavSetting {
id: string;
i18nKey: string;
featureRequired: string[] | false;
}
@Component({

View File

@ -6,7 +6,6 @@ import { ActionKeysType } from 'src/app/modules/action-keys/action-keys.componen
import { InfoSectionType } from 'src/app/modules/info-section/info-section.component';
import { WarnDialogComponent } from 'src/app/modules/warn-dialog/warn-dialog.component';
import { Action, ActionState, Flow, FlowType, TriggerType } from 'src/app/proto/generated/zitadel/action_pb';
import { ActionsAllowed } from 'src/app/proto/generated/zitadel/features_pb';
import { SetTriggerActionsRequest } from 'src/app/proto/generated/zitadel/management_pb';
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
import { ManagementService } from 'src/app/services/mgmt.service';
@ -51,17 +50,6 @@ export class ActionsComponent {
};
breadcrumbService.setBreadcrumb([iambread, bread]);
this.mgmtService.getFeatures().then((featuresResp) => {
if (featuresResp && featuresResp.features) {
const features = featuresResp.features;
this.maxActions =
features && features.actionsAllowed === ActionsAllowed.ACTIONS_ALLOWED_MAX
? features.maxActions
: features.actionsAllowed === ActionsAllowed.ACTIONS_ALLOWED_MAX
? null
: 0;
}
});
this.loadFlow();
}

View File

@ -5,7 +5,6 @@ import { BehaviorSubject, from, Observable, of } from 'rxjs';
import { catchError, finalize, map } from 'rxjs/operators';
import { CreationType, MemberCreateDialogComponent } from 'src/app/modules/add-member-dialog/member-create-dialog.component';
import { PolicyComponentServiceType } from 'src/app/modules/policies/policy-component-types.enum';
import { Features } from 'src/app/proto/generated/zitadel/features_pb';
import { Member } from 'src/app/proto/generated/zitadel/member_pb';
import { User } from 'src/app/proto/generated/zitadel/user_pb';
import { AdminService } from 'src/app/services/admin.service';
@ -24,8 +23,6 @@ export class IamComponent {
public totalMemberResult: number = 0;
public membersSubject: BehaviorSubject<Member.AsObject[]> = new BehaviorSubject<Member.AsObject[]>([]);
public features!: Features.AsObject;
constructor(
public adminService: AdminService,
private dialog: MatDialog,
@ -34,8 +31,6 @@ export class IamComponent {
private router: Router,
) {
this.loadMembers();
this.loadFeatures();
this.adminService.getDefaultFeatures();
const breadcrumbs = [
new Breadcrumb({
@ -106,13 +101,4 @@ export class IamComponent {
public showDetail(): void {
this.router.navigate(['/system', 'members']);
}
public loadFeatures(): void {
this.loadingSubject.next(true);
this.adminService.getDefaultFeatures().then((resp) => {
if (resp.features) {
this.features = resp.features;
}
});
}
}

View File

@ -6,7 +6,6 @@ import { catchError, finalize, map } from 'rxjs/operators';
import { CreationType, MemberCreateDialogComponent } from 'src/app/modules/add-member-dialog/member-create-dialog.component';
import { ChangeType } from 'src/app/modules/changes/changes.component';
import { PolicyComponentServiceType } from 'src/app/modules/policies/policy-component-types.enum';
import { Features } from 'src/app/proto/generated/zitadel/features_pb';
import { Member } from 'src/app/proto/generated/zitadel/member_pb';
import { Org, OrgState } from 'src/app/proto/generated/zitadel/org_pb';
import { User } from 'src/app/proto/generated/zitadel/user_pb';
@ -31,7 +30,6 @@ export class OrgDetailComponent implements OnInit {
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
public totalMemberResult: number = 0;
public membersSubject: BehaviorSubject<Member.AsObject[]> = new BehaviorSubject<Member.AsObject[]>([]);
public features!: Features.AsObject;
constructor(
private dialog: MatDialog,
@ -68,7 +66,6 @@ export class OrgDetailComponent implements OnInit {
this.toast.showError(error);
});
this.loadMembers();
this.loadFeatures();
}
public openAddMember(): void {
@ -131,18 +128,4 @@ export class OrgDetailComponent implements OnInit {
this.membersSubject.next(members);
});
}
public loadFeatures(): void {
this.loadingSubject.next(true);
this.mgmtService
.getFeatures()
.then((resp) => {
if (resp.features) {
this.features = resp.features;
}
})
.catch((error) => {
console.error(error);
});
}
}

View File

@ -126,7 +126,7 @@ export class AppDetailComponent implements OnInit, OnDestroy {
public InfoSectionType: any = InfoSectionType;
public copied: string = '';
public settingsList: SidenavSetting[] = [{ id: 'configuration', i18nKey: 'APP.CONFIGURATION', featureRequired: false }];
public settingsList: SidenavSetting[] = [{ id: 'configuration', i18nKey: 'APP.CONFIGURATION' }];
public currentSetting: string | undefined = this.settingsList[0].id;
constructor(
@ -281,10 +281,10 @@ export class AppDetailComponent implements OnInit, OnDestroy {
this.getAuthMethodOptions('OIDC');
this.settingsList = [
{ id: 'configuration', i18nKey: 'APP.CONFIGURATION', featureRequired: false },
{ id: 'redirect-uris', i18nKey: 'APP.OIDC.REDIRECTSECTIONTITLE', featureRequired: false },
{ id: 'additional-origins', i18nKey: 'APP.ADDITIONALORIGINS', featureRequired: false },
{ id: 'urls', i18nKey: 'APP.URLS', featureRequired: false },
{ id: 'configuration', i18nKey: 'APP.CONFIGURATION' },
{ id: 'redirect-uris', i18nKey: 'APP.OIDC.REDIRECTSECTIONTITLE' },
{ id: 'additional-origins', i18nKey: 'APP.ADDITIONALORIGINS' },
{ id: 'urls', i18nKey: 'APP.URLS' },
];
this.initialAuthMethod = this.authMethodFromPartialConfig({ oidc: this.app.oidcConfig });
@ -302,12 +302,12 @@ export class AppDetailComponent implements OnInit, OnDestroy {
this.initialAuthMethod = this.authMethodFromPartialConfig({ api: this.app.apiConfig });
if (this.initialAuthMethod === 'BASIC') {
this.settingsList = [{ id: 'urls', i18nKey: 'APP.URLS', featureRequired: false }];
this.settingsList = [{ id: 'urls', i18nKey: 'APP.URLS' }];
this.currentSetting = 'urls';
} else {
this.settingsList = [
{ id: 'configuration', i18nKey: 'APP.CONFIGURATION', featureRequired: false },
{ id: 'urls', i18nKey: 'APP.URLS', featureRequired: false },
{ id: 'configuration', i18nKey: 'APP.CONFIGURATION' },
{ id: 'urls', i18nKey: 'APP.URLS' },
];
}
this.currentAuthMethod = this.initialAuthMethod;
@ -591,12 +591,12 @@ export class AppDetailComponent implements OnInit, OnDestroy {
this.currentAuthMethod = this.authMethodFromPartialConfig(config);
if (this.currentAuthMethod === 'BASIC') {
this.settingsList = [{ id: 'urls', i18nKey: 'APP.URLS', featureRequired: false }];
this.settingsList = [{ id: 'urls', i18nKey: 'APP.URLS' }];
this.currentSetting = 'urls';
} else {
this.settingsList = [
{ id: 'configuration', i18nKey: 'APP.CONFIGURATION', featureRequired: false },
{ id: 'urls', i18nKey: 'APP.URLS', featureRequired: false },
{ id: 'configuration', i18nKey: 'APP.CONFIGURATION' },
{ id: 'urls', i18nKey: 'APP.URLS' },
];
this.currentSetting = 'configuration';
}

View File

@ -38,13 +38,13 @@ export class AuthUserDetailComponent implements OnDestroy {
public refreshChanges$: EventEmitter<void> = new EventEmitter();
public settingsList: SidenavSetting[] = [
{ id: 'general', i18nKey: 'USER.SETTINGS.GENERAL', featureRequired: false },
{ id: 'idp', i18nKey: 'USER.SETTINGS.IDP', featureRequired: false },
{ id: 'passwordless', i18nKey: 'USER.SETTINGS.PASSWORDLESS', featureRequired: false },
{ id: 'mfa', i18nKey: 'USER.SETTINGS.MFA', featureRequired: false },
{ id: 'grants', i18nKey: 'USER.SETTINGS.USERGRANTS', featureRequired: false },
{ id: 'memberships', i18nKey: 'USER.SETTINGS.MEMBERSHIPS', featureRequired: false },
{ id: 'metadata', i18nKey: 'USER.SETTINGS.METADATA', featureRequired: ['metadata.user'] },
{ id: 'general', i18nKey: 'USER.SETTINGS.GENERAL'},
{ id: 'idp', i18nKey: 'USER.SETTINGS.IDP'},
{ id: 'passwordless', i18nKey: 'USER.SETTINGS.PASSWORDLESS'},
{ id: 'mfa', i18nKey: 'USER.SETTINGS.MFA'},
{ id: 'grants', i18nKey: 'USER.SETTINGS.USERGRANTS'},
{ id: 'memberships', i18nKey: 'USER.SETTINGS.MEMBERSHIPS'},
{ id: 'metadata', i18nKey: 'USER.SETTINGS.METADATA'},
];
public currentSetting: string | undefined = this.settingsList[0].id;

View File

@ -20,15 +20,15 @@ import { ToastService } from 'src/app/services/toast.service';
import { EditDialogComponent, EditDialogType } from '../auth-user-detail/edit-dialog/edit-dialog.component';
import { ResendEmailDialogComponent } from '../auth-user-detail/resend-email-dialog/resend-email-dialog.component';
const GENERAL: SidenavSetting = { id: 'general', i18nKey: 'USER.SETTINGS.GENERAL', featureRequired: false };
const GRANTS: SidenavSetting = { id: 'grants', i18nKey: 'USER.SETTINGS.USERGRANTS', featureRequired: false };
const METADATA: SidenavSetting = { id: 'metadata', i18nKey: 'USER.SETTINGS.METADATA', featureRequired: ['metadata.user'] };
const IDP: SidenavSetting = { id: 'idp', i18nKey: 'USER.SETTINGS.IDP', featureRequired: false };
const PASSWORDLESS: SidenavSetting = { id: 'passwordless', i18nKey: 'USER.SETTINGS.PASSWORDLESS', featureRequired: false };
const MFA: SidenavSetting = { id: 'mfa', i18nKey: 'USER.SETTINGS.MFA', featureRequired: false };
const PERSONALACCESSTOKEN: SidenavSetting = { id: 'pat', i18nKey: 'USER.SETTINGS.PAT', featureRequired: false };
const KEYS: SidenavSetting = { id: 'keys', i18nKey: 'USER.SETTINGS.KEYS', featureRequired: false };
const MEMBERSHIPS: SidenavSetting = { id: 'memberships', i18nKey: 'USER.SETTINGS.MEMBERSHIPS', featureRequired: false };
const GENERAL: SidenavSetting = { id: 'general', i18nKey: 'USER.SETTINGS.GENERAL' };
const GRANTS: SidenavSetting = { id: 'grants', i18nKey: 'USER.SETTINGS.USERGRANTS' };
const METADATA: SidenavSetting = { id: 'metadata', i18nKey: 'USER.SETTINGS.METADATA'};
const IDP: SidenavSetting = { id: 'idp', i18nKey: 'USER.SETTINGS.IDP' };
const PASSWORDLESS: SidenavSetting = { id: 'passwordless', i18nKey: 'USER.SETTINGS.PASSWORDLESS' };
const MFA: SidenavSetting = { id: 'mfa', i18nKey: 'USER.SETTINGS.MFA'};
const PERSONALACCESSTOKEN: SidenavSetting = { id: 'pat', i18nKey: 'USER.SETTINGS.PAT' };
const KEYS: SidenavSetting = { id: 'keys', i18nKey: 'USER.SETTINGS.KEYS' };
const MEMBERSHIPS: SidenavSetting = { id: 'memberships', i18nKey: 'USER.SETTINGS.MEMBERSHIPS' };
@Component({
selector: 'cnsl-user-detail',

View File

@ -37,8 +37,6 @@ import {
GetCustomVerifyPhoneMessageTextResponse,
GetDefaultDomainClaimedMessageTextRequest,
GetDefaultDomainClaimedMessageTextResponse,
GetDefaultFeaturesRequest,
GetDefaultFeaturesResponse,
GetDefaultInitMessageTextRequest,
GetDefaultInitMessageTextResponse,
GetDefaultLoginTextsRequest,
@ -59,8 +57,6 @@ import {
GetLockoutPolicyResponse,
GetLoginPolicyRequest,
GetLoginPolicyResponse,
GetOrgFeaturesRequest,
GetOrgFeaturesResponse,
GetOrgIAMPolicyRequest,
GetOrgIAMPolicyResponse,
GetPasswordAgePolicyRequest,
@ -118,14 +114,10 @@ import {
ResetCustomLoginTextsToDefaultResponse,
ResetCustomOrgIAMPolicyToDefaultRequest,
ResetCustomOrgIAMPolicyToDefaultResponse,
ResetOrgFeaturesRequest,
ResetOrgFeaturesResponse,
SetCustomLoginTextsRequest,
SetCustomLoginTextsResponse,
SetDefaultDomainClaimedMessageTextRequest,
SetDefaultDomainClaimedMessageTextResponse,
SetDefaultFeaturesRequest,
SetDefaultFeaturesResponse,
SetDefaultInitMessageTextRequest,
SetDefaultInitMessageTextResponse,
SetDefaultPasswordlessRegistrationMessageTextRequest,
@ -136,8 +128,6 @@ import {
SetDefaultVerifyEmailMessageTextResponse,
SetDefaultVerifyPhoneMessageTextRequest,
SetDefaultVerifyPhoneMessageTextResponse,
SetOrgFeaturesRequest,
SetOrgFeaturesResponse,
SetUpOrgRequest,
SetUpOrgResponse,
UpdateCustomOrgIAMPolicyRequest,
@ -381,33 +371,6 @@ export class AdminService {
return this.grpcService.admin.updatePrivacyPolicy(req, null).then((resp) => resp.toObject());
}
// Features
public getOrgFeatures(orgId: string): Promise<GetOrgFeaturesResponse.AsObject> {
const req = new GetOrgFeaturesRequest();
req.setOrgId(orgId);
return this.grpcService.admin.getOrgFeatures(req, null).then((resp) => resp.toObject());
}
public setOrgFeatures(req: SetOrgFeaturesRequest): Promise<SetOrgFeaturesResponse.AsObject> {
return this.grpcService.admin.setOrgFeatures(req, null).then((resp) => resp.toObject());
}
public resetOrgFeatures(orgId: string): Promise<ResetOrgFeaturesResponse.AsObject> {
const req = new ResetOrgFeaturesRequest();
req.setOrgId(orgId);
return this.grpcService.admin.resetOrgFeatures(req, null).then((resp) => resp.toObject());
}
public getDefaultFeatures(): Promise<GetDefaultFeaturesResponse.AsObject> {
const req = new GetDefaultFeaturesRequest();
return this.grpcService.admin.getDefaultFeatures(req, null).then((resp) => resp.toObject());
}
public setDefaultFeatures(req: SetDefaultFeaturesRequest): Promise<SetDefaultFeaturesResponse.AsObject> {
return this.grpcService.admin.setDefaultFeatures(req, null).then((resp) => resp.toObject());
}
/* Policies */
/* complexity */

View File

@ -40,8 +40,6 @@ import {
ListMyUserGrantsResponse,
ListMyUserSessionsRequest,
ListMyUserSessionsResponse,
ListMyZitadelFeaturesRequest,
ListMyZitadelFeaturesResponse,
ListMyZitadelPermissionsRequest,
ListMyZitadelPermissionsResponse,
RemoveMyAuthFactorOTPRequest,
@ -400,12 +398,6 @@ export class GrpcAuthService {
.then((resp) => resp.toObject());
}
public listMyZitadelFeatures(): Promise<ListMyZitadelFeaturesResponse.AsObject> {
return this.grpcService.auth
.listMyZitadelFeatures(new ListMyZitadelFeaturesRequest(), null)
.then((resp) => resp.toObject());
}
public getMyPhone(): Promise<GetMyPhoneResponse.AsObject> {
return this.grpcService.auth.getMyPhone(new GetMyPhoneRequest(), null).then((resp) => resp.toObject());
}

View File

@ -2,7 +2,6 @@ export interface KeyboardShortcut {
keyboardKeys: string[];
link: any[];
i18nKey: string;
features?: string[] | RegExp[];
permissions?: string[] | RegExp[];
}
@ -57,7 +56,6 @@ export const ACTIONS: KeyboardShortcut = {
i18nKey: 'KEYBOARDSHORTCUTS.SHORTCUTS.ACTIONS',
link: ['/actions'],
keyboardKeys: ['g', 'f'],
features: ['actions'],
permissions: ['org.action.read'],
};

View File

@ -131,8 +131,6 @@ import {
GetDefaultVerifyEmailMessageTextResponse,
GetDefaultVerifyPhoneMessageTextRequest,
GetDefaultVerifyPhoneMessageTextResponse,
GetFeaturesRequest,
GetFeaturesResponse,
GetFlowRequest,
GetFlowResponse,
GetGrantedProjectByIDRequest,
@ -1169,13 +1167,6 @@ export class ManagementService {
return this.grpcService.mgmt.listOrgMemberRoles(req, null).then((resp) => resp.toObject());
}
// Features
public getFeatures(): Promise<GetFeaturesResponse.AsObject> {
const req = new GetFeaturesRequest();
return this.grpcService.mgmt.getFeatures(req, null).then((resp) => resp.toObject());
}
// Policy
public getLabelPolicy(): Promise<GetLabelPolicyResponse.AsObject> {