summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Bernlöhr <Heiko.Bernloehr@FreeIT.de>2023-02-15 10:30:36 +0100
committerHeiko Bernlöhr <Heiko.Bernloehr@FreeIT.de>2023-02-15 10:30:36 +0100
commit80275338c4622f8dff58904c48810715cde8676f (patch)
treed636573c5e55c38757369ff66563dbe20b84753b
parentee73f2f54cd651eb4644c32aa74729e909ba8cf4 (diff)
downloadecs-80275338c4622f8dff58904c48810715cde8676f.tar.gz
ecs-80275338c4622f8dff58904c48810715cde8676f.zip
Hide public communty.HEADv2.1.0ecs6
If allow_anonymous is not set in ecs_config.yml then the public community will be hidden.
-rw-r--r--app/controllers/admin/communities_controller.rb6
-rw-r--r--app/controllers/admin/participants_controller.rb10
-rw-r--r--app/views/admin/participants/_form.html.erb2
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 <http://www.gnu.org/licenses/>.
<th>join</th>
</tr>
- <% Community.all.each do |community| %>
+ <% @communities.each do |community| %>
<tr valign="top" class="<%= cycle('list-line-odd', 'list-line-even') %>">
<!-- <tr align="left" valign="top"> -->
<TD>