From 7940d69d5a09a4186ff762dd4889f4f6bde091d2 Mon Sep 17 00:00:00 2001 From: setop Date: Wed, 6 Oct 2021 18:00:50 +0200 Subject: [PATCH] add "only platform admin can create groups" and "only groups can create events" restrictions --- config/config.exs | 4 ++- js/src/components/NavBar.vue | 5 ++++ js/src/graphql/config.ts | 4 +++ js/src/types/config.model.ts | 4 +++ js/src/views/Admin/GroupProfiles.vue | 15 ++++++++++ js/src/views/Event/MyEvents.vue | 11 +++++++- js/src/views/Group/MyGroups.vue | 13 ++++++++- js/tests/unit/specs/mocks/config.ts | 5 ++++ lib/graphql/resolvers/config.ex | 4 +++ lib/graphql/resolvers/event.ex | 42 +++++++++++++++------------- lib/graphql/resolvers/group.ex | 31 ++++++++++++-------- lib/graphql/schema/config.ex | 14 ++++++++++ lib/mobilizon/config.ex | 17 +++++++++++ 13 files changed, 135 insertions(+), 34 deletions(-) diff --git a/config/config.exs b/config/config.exs index 0264d95c9..bec1c440a 100644 --- a/config/config.exs +++ b/config/config.exs @@ -40,9 +40,11 @@ config :mobilizon, :instance, email_reply_to: "noreply@localhost" config :mobilizon, :groups, enabled: true - config :mobilizon, :events, creation: true +config :mobilizon, :restrictions, only_admin_can_create_groups: false +config :mobilizon, :restrictions, only_groups_can_create_events: false + # Configures the endpoint config :mobilizon, Mobilizon.Web.Endpoint, url: [ diff --git a/js/src/components/NavBar.vue b/js/src/components/NavBar.vue index 834de6654..a17d978ad 100644 --- a/js/src/components/NavBar.vue +++ b/js/src/components/NavBar.vue @@ -44,6 +44,7 @@ " >