mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 20:37:23 +00:00
fix(console): user grant read check (#681)
* fix: user grant read check * fix guard * rm console.logs
This commit is contained in:
parent
0dd49f7430
commit
0d44b69c0e
@ -75,7 +75,7 @@ const routes: Routes = [
|
||||
.then(m => m.UserGrantCreateModule),
|
||||
canActivate: [RoleGuard],
|
||||
data: {
|
||||
roles: ['project.grant.user.grant.write'],
|
||||
roles: ['user.grant.write'],
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -12,11 +12,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ng-template appHasRole
|
||||
[appHasRole]="['project.grant.user.grant.read', 'project.grant.user.grant.read:'+grantId]">
|
||||
<ng-template appHasRole [appHasRole]="['user.grant.read', 'user.grant.read:'+grantId]">
|
||||
<app-card *ngIf="project?.projectId" title="{{ 'GRANTS.PROJECT.TITLE' | translate }}"
|
||||
description="{{'GRANTS.PROJECT.DESCRIPTION' | translate }}">
|
||||
<app-user-grants [context]="userGrantContext" [projectId]="projectId" [grantId]="grantId"
|
||||
<app-user-grants *ngIf="projectId && grantId" [context]="UserGrantContext.GRANTED_PROJECT"
|
||||
[projectId]="projectId" [grantId]="grantId"
|
||||
[displayedColumns]="['select','user', 'projectId', 'creationDate', 'changeDate', 'roleNamesList']"
|
||||
[allowCreate]="['user.grant.write','user.grant.write:'+grantId] | hasRole | async"
|
||||
[allowDelete]="['user.grant.delete','user.grant.delete:'+grantId] | hasRole | async">
|
||||
|
@ -63,7 +63,7 @@ export class GrantedProjectDetailComponent implements OnInit, OnDestroy {
|
||||
|
||||
public isZitadel: boolean = false;
|
||||
|
||||
public userGrantContext: UserGrantContext = UserGrantContext.GRANTED_PROJECT;
|
||||
UserGrantContext: any = UserGrantContext;
|
||||
public userGrantSearchKey: UserGrantSearchKey = UserGrantSearchKey.USERGRANTSEARCHKEY_PROJECT_ID;
|
||||
|
||||
// members
|
||||
|
@ -88,7 +88,7 @@
|
||||
<ng-template appHasRole [appHasRole]="['user.grant.read']">
|
||||
<app-card *ngIf="project?.projectId" title="{{ 'GRANTS.PROJECT.TITLE' | translate }}"
|
||||
description="{{'GRANTS.PROJECT.DESCRIPTION' | translate }}">
|
||||
<app-user-grants [context]="userGrantContext" [projectId]="projectId"
|
||||
<app-user-grants [context]="UserGrantContext.OWNED_PROJECT" [projectId]="projectId"
|
||||
[allowCreate]="(['user.grant.write', 'user.grant.write:'+projectId] | hasRole) | async"
|
||||
[allowDelete]="(['user.grant.delete','user.grant.delete:'+projectId] | hasRole) | async">
|
||||
</app-user-grants>
|
||||
|
@ -65,7 +65,7 @@ export class OwnedProjectDetailComponent implements OnInit, OnDestroy {
|
||||
public isZitadel: boolean = false;
|
||||
|
||||
public userGrantSearchKey: UserGrantSearchKey = UserGrantSearchKey.USERGRANTSEARCHKEY_PROJECT_ID;
|
||||
public userGrantContext: UserGrantContext = UserGrantContext.OWNED_PROJECT;
|
||||
public UserGrantContext: any = UserGrantContext;
|
||||
|
||||
// members
|
||||
public totalMemberResult: number = 0;
|
||||
|
@ -141,7 +141,7 @@ export class GrpcAuthService {
|
||||
public hasRoles(userRoles: string[], requestedRoles: string[] | RegExp[]): boolean {
|
||||
return requestedRoles.findIndex((regexp: any) => {
|
||||
return userRoles.findIndex(role => {
|
||||
return (new RegExp(regexp)).test(role);
|
||||
return new RegExp(regexp).test(role);
|
||||
}) > -1;
|
||||
}) > -1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user