Skip to content

Commit

Permalink
Merge branch 'main' into update-permissions-in-for-participant-views
Browse files Browse the repository at this point in the history
  • Loading branch information
rrenkert committed Apr 18, 2024
2 parents 1eefdc3 + 2a5a62c commit 37ce757
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,13 @@ <h2>{{ 'Participants' | translate }}</h2>
<!-- Menu -->
<div *osScrollingTableCell="'menu'; row as user; config: { width: 40 }" class="cell-slot fill">
<button
*osPerms="permission.userCanUpdate"
mat-icon-button
[disabled]="isMultiSelect"
[matMenuTriggerFor]="singleItemMenu"
(click)="$event.stopPropagation()"
[matMenuTriggerData]="{ user: user }"
*ngIf="canSeeSingleItemMenu(user) || (viewport.isMobileSubject | async)"
>
<mat-icon>more_vert</mat-icon>
</button>
Expand All @@ -177,12 +179,12 @@ <h2>{{ 'Participants' | translate }}</h2>
<span>{{ 'Present' | translate }}</span>
</mat-checkbox>

<button *osPerms="permission.userCanManage" mat-menu-item (click)="openEditInfo(user)">
<button *osPerms="permission.userCanUpdate" mat-menu-item (click)="openEditInfo(user)">
<mat-icon>edit</mat-icon>
<span>{{ 'Edit details' | translate }}</span>
</button>

<button *osPerms="permission.userCanManage" mat-menu-item (click)="switchParticipants(user)">
<button *osPerms="permission.userCanUpdate" mat-menu-item (click)="switchParticipants(user)">
<mat-icon>swap_horiz</mat-icon>
<span>{{ 'Swap mandates' | translate }}</span>
</button>
Expand All @@ -196,7 +198,7 @@ <h2>{{ 'Participants' | translate }}</h2>
<span>{{ 'Change password' | translate }}</span>
</button>

<button *osPerms="permission.userCanManage" mat-menu-item (click)="sendInvitationEmail(user)">
<button *osPerms="permission.userCanUpdate" mat-menu-item (click)="sendInvitationEmail(user)">
<mat-icon>mail</mat-icon>
<span>{{ 'Send invitation email' | translate }}</span>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,10 @@ export class ParticipantListComponent extends BaseMeetingListViewComponent<ViewU
await this.repo.removeUsersFromMeeting([user]);
}

public canSeeSingleItemMenu(user: ViewUser): boolean {
return this.operator.hasPerms(Permission.userCanUpdate) || this.canChangePassword(user);
}

/**
* Bulk deletes users. Needs multiSelect mode to fill selectedRows
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { Injectable } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Permission } from 'src/app/domain/definitions/permission';
import { GENDER_FITLERABLE, GENDERS } from 'src/app/domain/models/users/user';
import { OsFilter, OsHideFilterSetting } from 'src/app/site/base/base-filter.service';
import { BaseMeetingFilterListService } from 'src/app/site/pages/meetings/base/base-meeting-filter-list.service';
import { MeetingActiveFiltersService } from 'src/app/site/pages/meetings/services/meeting-active-filters.service';
import { MeetingSettingsService } from 'src/app/site/pages/meetings/services/meeting-settings.service';
import { DelegationType } from 'src/app/site/pages/meetings/view-models/delegation-type';
import { ViewUser } from 'src/app/site/pages/meetings/view-models/view-user';
import { OperatorService } from 'src/app/site/services/operator.service';

import { GroupControllerService } from '../../../../modules/groups/services/group-controller.service';
import { StructureLevelControllerService } from '../../../structure-levels/services/structure-level-controller.service';
Expand Down Expand Up @@ -41,7 +43,8 @@ export class ParticipantListFilterService extends BaseMeetingFilterListService<V
groupRepo: GroupControllerService,
structureRepo: StructureLevelControllerService,
private translate: TranslateService,
private meetingSettings: MeetingSettingsService
private meetingSettings: MeetingSettingsService,
private operator: OperatorService
) {
super(store);
this.updateFilterForRepo({
Expand Down Expand Up @@ -168,14 +171,26 @@ export class ParticipantListFilterService extends BaseMeetingFilterListService<V
},
{
property: `is_active`,
shouldHideFn() {
return !this.canSeeSensitiveData;
shouldHideFn: (): boolean => {
return !this.operator.hasPerms(Permission.userCanSeeSensitiveData);
}
},
{
property: `hasSamlId`,
shouldHideFn() {
return !this.canSeeSensitiveData;
shouldHideFn: (): boolean => {
return !this.operator.hasPerms(Permission.userCanSeeSensitiveData);
}
},
{
property: `isLastEmailSent`,
shouldHideFn: (): boolean => {
return !this.operator.hasPerms(Permission.userCanSeeSensitiveData);
}
},
{
property: `isLastLogin`,
shouldHideFn: (): boolean => {
return !this.operator.hasPerms(Permission.userCanUpdate);
}
}
];
Expand Down
2 changes: 2 additions & 0 deletions client/src/app/worker/http/http-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ export abstract class HttpStream {

if (data instanceof ErrorDescription || isCommunicationError(data) || isCommunicationErrorWrapper(data)) {
this.handleError(data);
} else if (isCommunicationError(this.parse(data)) || isCommunicationErrorWrapper(this.parse(data))) {
this.handleError(this.parse(data));
} else {
data = this.parse(data);
this.failedCounter = 0;
Expand Down

0 comments on commit 37ce757

Please sign in to comment.