fix: user grants (#1645)

* fix: user grants

* fix: add missing event type

Co-authored-by: fabi <fabienne.gerschwiler@gmail.com>
This commit is contained in:
Max Peintner 2021-04-22 12:03:24 +02:00 committed by GitHub
parent f0b333c5cb
commit b742166af5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -136,7 +136,7 @@
</ng-container>
<ng-container
*ngIf="(context === UserGrantContext.GRANTED_PROJECT || context === UserGrantContext.USER || context === UserGrantContext.NONE) && loadedId && loadedId === grant.id && grantToEdit == grant.id">
*ngIf="(context === UserGrantContext.GRANTED_PROJECT || context === UserGrantContext.USER || context === UserGrantContext.NONE) && loadedId && loadedId === grant.projectId && grantToEdit == grant.id">
<cnsl-form-field class="form-field" appearance="outline">
<mat-select [(ngModel)]="grant.roleKeysList" multiple
[disabled]="disableWrite || !((['user.grant.write$'] | hasRole | async) || ((context === UserGrantContext.OWNED_PROJECT ? ['user.grant.write:' + grant?.projectId] : context === UserGrantContext.GRANTED_PROJECT ? ['user.grant.write:' + grant?.id] : []) | hasRole | async))"
@ -165,8 +165,9 @@
<i class="las la-exclamation"></i>
<span>{{'GRANTS.EMPTY' | translate}}</span>
</div>
<cnsl-paginator class="paginator" #paginator [timestamp]="dataSource?.viewTimestamp" [length]="dataSource.totalResult" [pageSize]="INITIAL_PAGE_SIZE"
[length]="dataSource.totalResult" [pageSizeOptions]="[2, 3, 25, 50, 100, 250]" (page)="changePage($event)">
<cnsl-paginator class="paginator" #paginator [timestamp]="dataSource?.viewTimestamp"
[length]="dataSource.totalResult" [pageSize]="INITIAL_PAGE_SIZE" [length]="dataSource.totalResult"
[pageSizeOptions]="[2, 3, 25, 50, 100, 250]" (page)="changePage($event)">
</cnsl-paginator>
</div>
</app-refresh-table>

View File

@ -184,7 +184,7 @@ export class UserGrantsComponent implements OnInit, AfterViewInit {
private getGrantRoleOptions(id: string, projectId: string): void {
this.mgmtService.getGrantedProjectByID(projectId, id).then(resp => {
if (resp.grantedProject) {
this.loadedId = id;
this.loadedId = projectId;
this.grantRoleOptions = resp.grantedProject?.grantedRoleKeysList;
}
}).catch(error => {

View File

@ -160,6 +160,7 @@ func (wm *UserGrantPreConditionReadModel) Query() *eventstore.SearchQueryBuilder
project.ProjectAddedType,
project.ProjectRemovedType,
project.GrantAddedType,
project.GrantChangedType,
project.GrantRemovedType,
project.RoleAddedType,
project.RoleRemovedType)