From de81d37f07b20602b45a6fd6e3de560f9e3a6dc5 Mon Sep 17 00:00:00 2001 From: Elblinator Date: Fri, 20 Sep 2024 10:24:02 +0200 Subject: [PATCH] Change permission handling --- .../definitions/permission-relations.ts | 15 ++++------- .../domain/definitions/permission.config.ts | 4 +-- .../src/app/domain/definitions/permission.ts | 4 +-- .../app/domain/models/agenda/agenda-item.ts | 1 - .../list-of-speakers/list-of-speakers.ts | 5 +++- .../list-of-speakers-repository.service.ts | 8 ++++++ .../moderation-note.component.html | 4 +-- .../moderation-note.component.scss | 4 +++ .../moderation-note.component.ts | 25 +++++++++---------- .../pages/agenda/agenda.subscription.ts | 9 ++----- .../topic-detail/topic-detail.component.html | 2 +- .../pages/autopilot/autopilot.subscription.ts | 4 +-- 12 files changed, 44 insertions(+), 41 deletions(-) diff --git a/client/src/app/domain/definitions/permission-relations.ts b/client/src/app/domain/definitions/permission-relations.ts index 6e2d69dc15..29e6cf5355 100644 --- a/client/src/app/domain/definitions/permission-relations.ts +++ b/client/src/app/domain/definitions/permission-relations.ts @@ -4,10 +4,8 @@ import { PermissionsMap } from './permission.config'; export const permissionChildren: PermissionsMap = { 'agenda_item.can_manage': [Permission.agendaItemCanSeeInternal, Permission.agendaItemCanSee], - 'agenda_item.can_manage_moderator_notes': [Permission.agendaItemCanSeeModeratorNotes, Permission.agendaItemCanSee], 'agenda_item.can_see': [], 'agenda_item.can_see_internal': [Permission.agendaItemCanSee], - 'agenda_item.can_see_moderator_notes': [Permission.agendaItemCanSee], 'assignment.can_manage': [Permission.assignmentCanNominateOther, Permission.assignmentCanSee], 'assignment.can_nominate_other': [Permission.assignmentCanSee], 'assignment.can_nominate_self': [Permission.assignmentCanSee], @@ -16,6 +14,8 @@ export const permissionChildren: PermissionsMap = { 'list_of_speakers.can_be_speaker': [], 'list_of_speakers.can_manage': [Permission.listOfSpeakersCanSee], 'list_of_speakers.can_see': [], + 'list_of_speakers.can_see_moderator_notes': [], + 'list_of_speakers.can_manage_moderator_notes': [Permission.listOfSpeakersCanSeeModeratorNotes], 'mediafile.can_manage': [Permission.mediafileCanSee], 'mediafile.can_see': [], 'meeting.can_manage_logos_and_fonts': [], @@ -59,15 +59,8 @@ export const permissionChildren: PermissionsMap = { export const permissionParents: PermissionsMap = { 'agenda_item.can_manage': [], - 'agenda_item.can_manage_moderator_notes': [], - 'agenda_item.can_see': [ - Permission.agendaItemCanSeeInternal, - Permission.agendaItemCanManage, - Permission.agendaItemCanSeeModeratorNotes, - Permission.agendaItemCanManageModeratorNotes - ], + 'agenda_item.can_see': [Permission.agendaItemCanSeeInternal, Permission.agendaItemCanManage], 'agenda_item.can_see_internal': [Permission.agendaItemCanManage], - 'agenda_item.can_see_moderator_notes': [Permission.agendaItemCanManageModeratorNotes], 'assignment.can_manage': [], 'assignment.can_nominate_other': [Permission.assignmentCanManage], 'assignment.can_nominate_self': [], @@ -80,6 +73,8 @@ export const permissionParents: PermissionsMap = { 'list_of_speakers.can_be_speaker': [], 'list_of_speakers.can_manage': [], 'list_of_speakers.can_see': [Permission.listOfSpeakersCanManage], + 'list_of_speakers.can_see_moderator_notes': [Permission.listOfSpeakersCanManageModeratorNotes], + 'list_of_speakers.can_manage_moderator_notes': [], 'mediafile.can_manage': [], 'mediafile.can_see': [Permission.mediafileCanManage], 'meeting.can_manage_logos_and_fonts': [], diff --git a/client/src/app/domain/definitions/permission.config.ts b/client/src/app/domain/definitions/permission.config.ts index d4e77a95b0..bea38258b2 100644 --- a/client/src/app/domain/definitions/permission.config.ts +++ b/client/src/app/domain/definitions/permission.config.ts @@ -88,12 +88,12 @@ Optional combination of requests to speak with presence status is possible. ( > { display_name: _(`Can see moderation notes`), help_text: _(`Can see all moderation notes in each list of speakers.`), - value: Permission.agendaItemCanSeeModeratorNotes + value: Permission.listOfSpeakersCanSeeModeratorNotes }, { display_name: _(`Can manage moderation notes`), help_text: _(`Can edit all moderation notes.`), - value: Permission.agendaItemCanManageModeratorNotes + value: Permission.listOfSpeakersCanManageModeratorNotes } ] }, diff --git a/client/src/app/domain/definitions/permission.ts b/client/src/app/domain/definitions/permission.ts index 9b7979e098..34e4155aa9 100644 --- a/client/src/app/domain/definitions/permission.ts +++ b/client/src/app/domain/definitions/permission.ts @@ -5,10 +5,8 @@ */ export enum Permission { agendaItemCanManage = `agenda_item.can_manage`, - agendaItemCanManageModeratorNotes = `agenda_item.can_manage_moderator_notes`, agendaItemCanSee = `agenda_item.can_see`, agendaItemCanSeeInternal = `agenda_item.can_see_internal`, - agendaItemCanSeeModeratorNotes = `agenda_item.can_see_moderator_notes`, assignmentCanManage = `assignment.can_manage`, assignmentCanNominateOther = `assignment.can_nominate_other`, assignmentCanNominateSelf = `assignment.can_nominate_self`, @@ -17,6 +15,8 @@ export enum Permission { listOfSpeakersCanBeSpeaker = `list_of_speakers.can_be_speaker`, listOfSpeakersCanManage = `list_of_speakers.can_manage`, listOfSpeakersCanSee = `list_of_speakers.can_see`, + listOfSpeakersCanSeeModeratorNotes = `list_of_speakers.can_see_moderator_notes`, + listOfSpeakersCanManageModeratorNotes = `list_of_speakers.can_manage_moderator_notes`, mediafileCanManage = `mediafile.can_manage`, mediafileCanSee = `mediafile.can_see`, meetingCanManageLogosAndFonts = `meeting.can_manage_logos_and_fonts`, diff --git a/client/src/app/domain/models/agenda/agenda-item.ts b/client/src/app/domain/models/agenda/agenda-item.ts index f617f96157..6caeaf72cc 100644 --- a/client/src/app/domain/models/agenda/agenda-item.ts +++ b/client/src/app/domain/models/agenda/agenda-item.ts @@ -63,7 +63,6 @@ export class AgendaItem extends BaseModel { `closed`, `type`, `duration`, - `moderator_notes`, `is_internal`, `is_hidden`, `level`, diff --git a/client/src/app/domain/models/list-of-speakers/list-of-speakers.ts b/client/src/app/domain/models/list-of-speakers/list-of-speakers.ts index 5cfe57f130..37f9bb63d7 100644 --- a/client/src/app/domain/models/list-of-speakers/list-of-speakers.ts +++ b/client/src/app/domain/models/list-of-speakers/list-of-speakers.ts @@ -13,6 +13,8 @@ export class ListOfSpeakers extends BaseModel { public closed!: boolean; + public moderator_notes: string; + public content_object_id!: Fqid; // */list_of_speakers_id; public speaker_ids!: Id[]; // (speaker/list_of_speakers_id)[]; @@ -30,7 +32,8 @@ export class ListOfSpeakers extends BaseModel { `speaker_ids`, `structure_level_list_of_speakers_ids`, `projection_ids`, - `meeting_id` + `meeting_id`, + `moderator_notes` ]; } export interface ListOfSpeakers extends HasMeetingId, HasProjectionIds, HasSequentialNumber {} diff --git a/client/src/app/gateways/repositories/list-of-speakers/list-of-speakers-repository.service.ts b/client/src/app/gateways/repositories/list-of-speakers/list-of-speakers-repository.service.ts index 124ec10c58..fd1ad06484 100644 --- a/client/src/app/gateways/repositories/list-of-speakers/list-of-speakers-repository.service.ts +++ b/client/src/app/gateways/repositories/list-of-speakers/list-of-speakers-repository.service.ts @@ -94,4 +94,12 @@ export class ListOfSpeakersRepositoryService extends BaseMeetingRelatedRepositor const payload = listOfSpeakers.finishedSpeakers.map(speaker => ({ id: speaker.id })); return await this.sendBulkActionToBackend(SpeakerAction.DELETE, payload); } + + public async update(update: Partial, viewModel: ViewListOfSpeakers): Promise { + const payload: any = { + id: viewModel.id, + moderator_notes: update.moderator_notes + }; + await this.createAction(ListOfSpeakersAction.UPDATE, payload).resolve(); + } } diff --git a/client/src/app/site/pages/meetings/modules/list-of-speakers-content/components/moderation-note/moderation-note.component.html b/client/src/app/site/pages/meetings/modules/list-of-speakers-content/components/moderation-note/moderation-note.component.html index c58932b8ac..95cc5743d9 100644 --- a/client/src/app/site/pages/meetings/modules/list-of-speakers-content/components/moderation-note/moderation-note.component.html +++ b/client/src/app/site/pages/meetings/modules/list-of-speakers-content/components/moderation-note/moderation-note.component.html @@ -1,5 +1,5 @@ -@if (agendaItem && canSeeModerationNote && (canManageModerationNote || (moderatorNotes | async))) { +@if (listOfSpeakers && canSeeModerationNote && (canManageModerationNote || (moderatorNotes | async))) { @@ -37,7 +37,7 @@ } @if (!isEditing) { -