mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-08 14:47:40 +00:00
fix(console): hide metadata on auth side if no user.read
role present (#4512)
* check for role * require user.read for showing metadata section in auth-user * remove aggregate id from role check Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
parent
556f381a5a
commit
0cb84523f9
@ -30,8 +30,8 @@
|
|||||||
(click)="value = setting.id"
|
(click)="value = setting.id"
|
||||||
*ngIf="
|
*ngIf="
|
||||||
!setting.requiredRoles ||
|
!setting.requiredRoles ||
|
||||||
(setting.requiredRoles.mgmt && (setting.requiredRoles.mgmt | hasRole: true | async)) ||
|
(setting.requiredRoles.mgmt && (setting.requiredRoles.mgmt | hasRole | async)) ||
|
||||||
(setting.requiredRoles.admin && (setting.requiredRoles.admin | hasRole: true | async))
|
(setting.requiredRoles.admin && (setting.requiredRoles.admin | hasRole | async))
|
||||||
"
|
"
|
||||||
class="sidenav-setting-list-element hide-on-mobile"
|
class="sidenav-setting-list-element hide-on-mobile"
|
||||||
[ngClass]="{ active: currentSetting === setting.id, show: currentSetting === undefined }"
|
[ngClass]="{ active: currentSetting === setting.id, show: currentSetting === undefined }"
|
||||||
|
@ -19,6 +19,7 @@ import { ManagementService } from 'src/app/services/mgmt.service';
|
|||||||
import { ToastService } from 'src/app/services/toast.service';
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
import { Buffer } from 'buffer';
|
import { Buffer } from 'buffer';
|
||||||
import { EditDialogComponent, EditDialogType } from './edit-dialog/edit-dialog.component';
|
import { EditDialogComponent, EditDialogType } from './edit-dialog/edit-dialog.component';
|
||||||
|
import { PolicyComponentServiceType } from 'src/app/modules/policies/policy-component-types.enum';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'cnsl-auth-user-detail',
|
selector: 'cnsl-auth-user-detail',
|
||||||
@ -51,7 +52,11 @@ export class AuthUserDetailComponent implements OnDestroy {
|
|||||||
{ id: 'mfa', i18nKey: 'USER.SETTINGS.MFA' },
|
{ id: 'mfa', i18nKey: 'USER.SETTINGS.MFA' },
|
||||||
{ id: 'grants', i18nKey: 'USER.SETTINGS.USERGRANTS' },
|
{ id: 'grants', i18nKey: 'USER.SETTINGS.USERGRANTS' },
|
||||||
{ id: 'memberships', i18nKey: 'USER.SETTINGS.MEMBERSHIPS' },
|
{ id: 'memberships', i18nKey: 'USER.SETTINGS.MEMBERSHIPS' },
|
||||||
{ id: 'metadata', i18nKey: 'USER.SETTINGS.METADATA' },
|
{
|
||||||
|
id: 'metadata',
|
||||||
|
i18nKey: 'USER.SETTINGS.METADATA',
|
||||||
|
requiredRoles: { [PolicyComponentServiceType.MGMT]: ['user.read'] },
|
||||||
|
},
|
||||||
];
|
];
|
||||||
public currentSetting: string | undefined = this.settingsList[0].id;
|
public currentSetting: string | undefined = this.settingsList[0].id;
|
||||||
|
|
||||||
@ -347,11 +352,13 @@ export class AuthUserDetailComponent implements OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public loadMetadata(): Promise<any> | void {
|
public loadMetadata(): void {
|
||||||
if (this.user) {
|
if (this.user) {
|
||||||
|
this.userService.isAllowed(['user.read']).subscribe((allowed) => {
|
||||||
|
if (allowed) {
|
||||||
this.loadingMetadata = true;
|
this.loadingMetadata = true;
|
||||||
return this.mgmt
|
this.mgmt
|
||||||
.listUserMetadata(this.user.id)
|
.listUserMetadata(this.user?.id ?? '')
|
||||||
.then((resp) => {
|
.then((resp) => {
|
||||||
this.loadingMetadata = false;
|
this.loadingMetadata = false;
|
||||||
this.metadata = resp.resultList.map((md) => {
|
this.metadata = resp.resultList.map((md) => {
|
||||||
@ -366,6 +373,8 @@ export class AuthUserDetailComponent implements OnDestroy {
|
|||||||
this.toast.showError(error);
|
this.toast.showError(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public editMetadata(): void {
|
public editMetadata(): void {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user