Skip to content

Commit

Permalink
Add Buttons if operator is meeting-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
Elblinator committed Dec 16, 2024
1 parent e42218c commit 34373c1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ export class ViewMeeting extends BaseHasMeetingUsersViewModel<Meeting> {
public canBeEnteredBy(user: ViewUser): boolean {
return !this.locked_from_inside || user.group_ids(this.id).length > 0;
}

public canEditMeetingSettings(user: ViewUser): boolean {
return user.getMeetingUser(this.id)?.group_ids.includes(this.meeting.admin_group_id);
}
}
interface IMeetingRelations {
motions_default_workflow: ViewMotionWorkflow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
<span>{{ 'Public template' | translate }}</span>
</button>
}
@if (!isLockedFromInside) {
@if (canEditMeetingSettings()) {
<button mat-menu-item (click)="onDuplicate()">
<mat-icon>file_copy</mat-icon>
<span>{{ 'Duplicate' | translate }}</span>
Expand All @@ -167,10 +167,12 @@
<span>{{ 'Export' | translate }}</span>
</button>
}
<mat-divider></mat-divider>
<button class="red-warning-text" mat-menu-item (click)="onDeleteMeeting()">
<mat-icon>delete</mat-icon>
<span>{{ 'Delete' | translate }}</span>
</button>
@if (canEditMeetingSettings()) {
<mat-divider></mat-divider>
<button class="red-warning-text" mat-menu-item (click)="onDeleteMeeting()">
<mat-icon>delete</mat-icon>
<span>{{ 'Delete' | translate }}</span>
</button>
}
</ng-template>
</mat-menu>
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ export class CommitteeMeetingPreviewComponent {
return this.meeting?.locked_from_inside;
}

public canEditMeetingSettings(): boolean {
if (this.isLockedFromInside && !this.operator.isSuperAdmin) {
return this.meeting.canEditMeetingSettings(this.operator.user);
}
return true;
}

public constructor(
private translate: TranslateService,
private meetingRepo: MeetingControllerService,
Expand Down

0 comments on commit 34373c1

Please sign in to comment.