From 80275338c4622f8dff58904c48810715cde8676f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heiko=20Bernl=C3=B6hr?= Date: Wed, 15 Feb 2023 10:30:36 +0100 Subject: Hide public communty. If allow_anonymous is not set in ecs_config.yml then the public community will be hidden. --- app/controllers/admin/communities_controller.rb | 6 +++++- app/controllers/admin/participants_controller.rb | 10 ++++++++++ app/views/admin/participants/_form.html.erb | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/communities_controller.rb b/app/controllers/admin/communities_controller.rb index 8012eec..86692d4 100644 --- a/app/controllers/admin/communities_controller.rb +++ b/app/controllers/admin/communities_controller.rb @@ -28,7 +28,11 @@ class Admin::CommunitiesController < ApplicationController end def list - @communities=Community.all.distinct + if ECS_CONFIG["participants"]["allow_anonymous"] + @communities=Community.all.distinct + else + @communities=Community.all.where.not(name: "public").distinct + end end def show diff --git a/app/controllers/admin/participants_controller.rb b/app/controllers/admin/participants_controller.rb index 4825073..beabd28 100644 --- a/app/controllers/admin/participants_controller.rb +++ b/app/controllers/admin/participants_controller.rb @@ -72,6 +72,11 @@ class Admin::ParticipantsController < ApplicationController def new @participant = Participant.new @organizations = Organization.all.order(:id) + if ECS_CONFIG["participants"]["allow_anonymous"] + @communities=Community.all.distinct + else + @communities=Community.all.where.not(name: "public").distinct + end @participant.identities.build end @@ -90,6 +95,11 @@ class Admin::ParticipantsController < ApplicationController def edit @participant = Participant.find(params[:id]) @organizations = Organization.all.order(:id) + if ECS_CONFIG["participants"]["allow_anonymous"] + @communities=Community.all.distinct + else + @communities=Community.all.where.not(name: "public").distinct + end end def reset diff --git a/app/views/admin/participants/_form.html.erb b/app/views/admin/participants/_form.html.erb index dd85b60..2aaf202 100644 --- a/app/views/admin/participants/_form.html.erb +++ b/app/views/admin/participants/_form.html.erb @@ -110,7 +110,7 @@ License along with ECS. If not, see . join - <% Community.all.each do |community| %> + <% @communities.each do |community| %> -- cgit v1.2.3