From b17a155effb464f3106d7f509c019fe1b7201da7 Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Mon, 15 Jul 2024 11:22:18 +0200 Subject: [PATCH 01/11] Add orga setting 'require_duplicate_from' --- .../app/domain/models/organizations/organization.ts | 2 ++ .../repositories/organization-repository.service.ts | 1 + .../organization-settings.component.html | 12 ++++++++++++ .../organization-settings.component.scss | 8 ++++++++ .../organization-settings.component.ts | 1 + client/src/meta | 2 +- 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/client/src/app/domain/models/organizations/organization.ts b/client/src/app/domain/models/organizations/organization.ts index 6570152d47..25151d8c97 100644 --- a/client/src/app/domain/models/organizations/organization.ts +++ b/client/src/app/domain/models/organizations/organization.ts @@ -21,6 +21,7 @@ export class OrganizationSetting { public limit_of_meetings!: number; public limit_of_users!: number; public default_language!: string; + public require_duplicate_from!: boolean; public users_email_sender!: string; // default: OpenSlides public users_email_subject!: string; // default: OpenSlides access data @@ -70,6 +71,7 @@ export class Organization extends BaseModel { `limit_of_meetings`, `limit_of_users`, `default_language`, + `require_duplicate_from`, `saml_enabled`, `saml_login_button_text`, `saml_attr_mapping`, diff --git a/client/src/app/gateways/repositories/organization-repository.service.ts b/client/src/app/gateways/repositories/organization-repository.service.ts index cdb030b710..4ff8d2d92d 100644 --- a/client/src/app/gateways/repositories/organization-repository.service.ts +++ b/client/src/app/gateways/repositories/organization-repository.service.ts @@ -37,6 +37,7 @@ export class OrganizationRepositoryService extends BaseRepository{{ 'General' | translate }} } + +
+ + {{ 'Activate require templates for creating a meeting' | translate }} + +
+ {{ + 'If this setting is active committee-admins can only create meetings from public meeting templates, to enable these admins to create a meeting you need to create a template meeting first' + | translate + }} +
+
diff --git a/client/src/app/site/pages/organization/pages/settings/modules/settings-detail/components/organization-settings/organization-settings.component.scss b/client/src/app/site/pages/organization/pages/settings/modules/settings-detail/components/organization-settings/organization-settings.component.scss index af30c48e62..1ded6707ec 100644 --- a/client/src/app/site/pages/organization/pages/settings/modules/settings-detail/components/organization-settings/organization-settings.component.scss +++ b/client/src/app/site/pages/organization/pages/settings/modules/settings-detail/components/organization-settings/organization-settings.component.scss @@ -18,3 +18,11 @@ mat-card mat-card-content h2 { margin-top: 0 !important; } + +.checkbox-hint { + padding-left: 16px; + padding-right: 16px; + padding-top: 0px; + padding-bottom: 0px; + font-size: 12px; +} diff --git a/client/src/app/site/pages/organization/pages/settings/modules/settings-detail/components/organization-settings/organization-settings.component.ts b/client/src/app/site/pages/organization/pages/settings/modules/settings-detail/components/organization-settings/organization-settings.component.ts index 61f77420be..355ec2c8d2 100644 --- a/client/src/app/site/pages/organization/pages/settings/modules/settings-detail/components/organization-settings/organization-settings.component.ts +++ b/client/src/app/site/pages/organization/pages/settings/modules/settings-detail/components/organization-settings/organization-settings.component.ts @@ -83,6 +83,7 @@ export class OrganizationSettingsComponent extends BaseComponent { enable_chat: [this._currentOrgaSettings.enable_chat], limit_of_meetings: [this._currentOrgaSettings.limit_of_meetings ?? 0], limit_of_users: [this._currentOrgaSettings.limit_of_users ?? 0], + require_duplicate_from: [this._currentOrgaSettings.require_duplicate_from ?? false], saml_enabled: [this._currentOrgaSettings.saml_enabled ?? false], saml_login_button_text: [this._currentOrgaSettings.saml_login_button_text], saml_attr_mapping: [ diff --git a/client/src/meta b/client/src/meta index 02a18f7498..edb9714c4c 160000 --- a/client/src/meta +++ b/client/src/meta @@ -1 +1 @@ -Subproject commit 02a18f7498799948c352cd5aaa9f109d60f5f87e +Subproject commit edb9714c4c4922be3f6cfc8ff89553f7371118ea From d625badafe1324b352a6f500ed43a12ff752bff5 Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Mon, 15 Jul 2024 11:57:00 +0200 Subject: [PATCH 02/11] Add check for duplicate_from to meeting-edit form --- .../meeting-edit/meeting-edit.component.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts b/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts index db6c706c0d..31c46fe6bc 100644 --- a/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts +++ b/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts @@ -64,6 +64,11 @@ export class MeetingEditComponent extends BaseComponent implements OnInit { public availableMeetingsObservable: Observable | null = null; public get isValid(): boolean { + if (this.isCommitteeManagerAndRequireDuplicateFrom) { + if (!this.theDuplicateFromId) { + return false; + } + } return this.meetingForm?.valid; } @@ -119,6 +124,7 @@ export class MeetingEditComponent extends BaseComponent implements OnInit { private committeeId!: Id; private cameFromList = false; + private requireDuplicateFrom = false; /** * The operating user received from the OperatorService @@ -167,9 +173,17 @@ export class MeetingEditComponent extends BaseComponent implements OnInit { this.onAfterCreateForm(); }) ); + this.subscriptions.push( + this.orgaSettings + .get(`require_duplicate_from`) + .subscribe((value: boolean) => (this.requireDuplicateFrom = value)) + ); this.availableMeetingsObservable = this.orga.organizationObservable.pipe( map(organization => { + if (this.isCommitteeManagerAndRequireDuplicateFrom) { + return [TEMPLATE_MEETINGS_LABEL, ...organization.template_meetings.sort(this.sortFn)]; + } return [ TEMPLATE_MEETINGS_LABEL, ...organization.template_meetings.sort(this.sortFn), @@ -424,4 +438,8 @@ export class MeetingEditComponent extends BaseComponent implements OnInit { this.daterangeControl?.patchValue({ start: patchValue, end: patchValue }); } } + + private get isCommitteeManagerAndRequireDuplicateFrom(): boolean { + return this.requireDuplicateFrom && !this.operator.isSuperAdmin && !this.operator.isOrgaManager; + } } From bd7f08708e686ad2565e6050d54be70795533811 Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Mon, 15 Jul 2024 13:09:03 +0200 Subject: [PATCH 03/11] Add isAccountManager to operator and use it --- .../components/meeting-edit/meeting-edit.component.ts | 2 +- client/src/app/site/services/operator.service.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts b/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts index 31c46fe6bc..e9a8db21e9 100644 --- a/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts +++ b/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts @@ -440,6 +440,6 @@ export class MeetingEditComponent extends BaseComponent implements OnInit { } private get isCommitteeManagerAndRequireDuplicateFrom(): boolean { - return this.requireDuplicateFrom && !this.operator.isSuperAdmin && !this.operator.isOrgaManager; + return this.requireDuplicateFrom && !this.operator.isAccountAdmin; } } diff --git a/client/src/app/site/services/operator.service.ts b/client/src/app/site/services/operator.service.ts index 6c45e810c7..efa956138c 100644 --- a/client/src/app/site/services/operator.service.ts +++ b/client/src/app/site/services/operator.service.ts @@ -85,6 +85,10 @@ export class OperatorService { return this.hasOrganizationPermissions(OML.can_manage_organization); } + public get isAccountAdmin(): boolean { + return this.hasOrganizationPermissions(OML.can_manage_users); + } + private get isCommitteeManager(): boolean { return !!(this.user.committee_management_ids || []).length; } From bb88e8792c49e117530b31bdd2ce6ab4a35cde23 Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Tue, 16 Jul 2024 10:22:35 +0200 Subject: [PATCH 04/11] Update permissions to save in req duplicate from case --- .../components/meeting-edit/meeting-edit.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts b/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts index e9a8db21e9..0a914439d8 100644 --- a/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts +++ b/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts @@ -440,6 +440,6 @@ export class MeetingEditComponent extends BaseComponent implements OnInit { } private get isCommitteeManagerAndRequireDuplicateFrom(): boolean { - return this.requireDuplicateFrom && !this.operator.isAccountAdmin; + return this.requireDuplicateFrom && !this.operator.isOrgaManager; } } From 54ae37433fe4c8693bde0a5e2c5760fefc7f5dbc Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Mon, 22 Jul 2024 14:02:13 +0200 Subject: [PATCH 05/11] Fix problem with edit and require_duplicate_from --- .../components/meeting-edit/meeting-edit.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts b/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts index 0a914439d8..78ba0614e7 100644 --- a/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts +++ b/client/src/app/site/pages/organization/pages/committees/pages/committee-detail/modules/committee-detail-meeting/components/meeting-edit/meeting-edit.component.ts @@ -65,7 +65,7 @@ export class MeetingEditComponent extends BaseComponent implements OnInit { public get isValid(): boolean { if (this.isCommitteeManagerAndRequireDuplicateFrom) { - if (!this.theDuplicateFromId) { + if (!this.theDuplicateFromId && this.isCreateView) { return false; } } From 05c890cc43b7787538f04aee7e0272d88f17544e Mon Sep 17 00:00:00 2001 From: Ludwig Reiter Date: Mon, 22 Jul 2024 14:32:39 +0200 Subject: [PATCH 06/11] Partial hide duplicate and set template If committee manager and require_duplicate_from set, the cm is not allowed to clone/duplicate and set template. --- .../committee-meeting-preview.component.html | 12 +++++++----- .../committee-meeting-preview.component.ts | 1 + .../committee-detail-view.component.html | 1 + .../committee-detail-view.component.ts | 12 +++++++++++- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/client/src/app/site/pages/organization/pages/committees/modules/committee-meeting-preview/committee-meeting-preview.component.html b/client/src/app/site/pages/organization/pages/committees/modules/committee-meeting-preview/committee-meeting-preview.component.html index f6e557954d..f09e50de89 100644 --- a/client/src/app/site/pages/organization/pages/committees/modules/committee-meeting-preview/committee-meeting-preview.component.html +++ b/client/src/app/site/pages/organization/pages/committees/modules/committee-meeting-preview/committee-meeting-preview.component.html @@ -126,7 +126,7 @@ {{ 'Edit' | translate }} } - @if (!meeting.isArchived) { + @if (!meeting.isArchived && !isCMAndRequireDuplicateFrom) { } - + @if (!isCMAndRequireDuplicateFrom) { + + } @if (meeting.isActive) {