feat: Disable member list via configuration (#990)

This commit is contained in:
kidhab 2023-06-10 10:32:16 +02:00 committed by GitHub
parent 075f3cfa1a
commit c50ba6eda5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 14 additions and 2 deletions

View file

@ -1,4 +1,6 @@
class Foodcoop::UsersController < ApplicationController class Foodcoop::UsersController < ApplicationController
before_action -> { require_config_disabled :disable_members_overview }
def index def index
@users = User.undeleted.sort_by_param(params['sort']) @users = User.undeleted.sort_by_param(params['sort'])

View file

@ -4,5 +4,6 @@
= config_input form, :distribution_strategy, as: :select, collection: distribution_strategy_options, = config_input form, :distribution_strategy, as: :select, collection: distribution_strategy_options,
include_blank: false, input_html: {class: 'input-xxlarge'}, label_method: ->(s){ t("config.keys.distribution_strategy_options.#{s}") } include_blank: false, input_html: {class: 'input-xxlarge'}, label_method: ->(s){ t("config.keys.distribution_strategy_options.#{s}") }
= config_input form, :disable_invite, as: :boolean = config_input form, :disable_invite, as: :boolean
= config_input form, :disable_members_overview, as: :boolean
= config_input form, :help_url, as: :url, input_html: {class: 'input-xlarge'} = config_input form, :help_url, as: :url, input_html: {class: 'input-xlarge'}
= config_input form, :webstats_tracking_code, as: :text, input_html: {class: 'input-xxlarge', rows: 3} = config_input form, :webstats_tracking_code, as: :text, input_html: {class: 'input-xxlarge', rows: 3}

View file

@ -2,7 +2,8 @@
%h3= t '.title' %h3= t '.title'
%ul.nav.nav-list %ul.nav.nav-list
%li.nav-header= t '.foodcoop' %li.nav-header= t '.foodcoop'
%li= link_to t('.members'), foodcoop_users_path - unless FoodsoftConfig[:disable_members_overview]
%li= link_to t('.members'), foodcoop_users_path
%li= link_to t('.tasks'), user_tasks_path %li= link_to t('.tasks'), user_tasks_path
- has_ordergroup = !@current_user.ordergroup.nil? - has_ordergroup = !@current_user.ordergroup.nil?

View file

@ -93,6 +93,9 @@ default: &defaults
#use_wiki: true #use_wiki: true
#use_messages: true #use_messages: true
# When enabled only administrators can access the member list.
#disable_members_overview: true
# Base font size for generated PDF documents # Base font size for generated PDF documents
#pdf_font_size: 12 #pdf_font_size: 12
# Page size for generated PDF documents # Page size for generated PDF documents

View file

@ -655,6 +655,7 @@ de:
default_role_pickups: Abholtage default_role_pickups: Abholtage
default_role_suppliers: Lieferanten default_role_suppliers: Lieferanten
disable_invite: Einladungen deaktivieren disable_invite: Einladungen deaktivieren
disable_members_overview: Mitgliederliste deaktivieren
email_from: Absenderadresse email_from: Absenderadresse
email_replyto: Antwortadresse email_replyto: Antwortadresse
email_sender: Senderadresse email_sender: Senderadresse

View file

@ -656,6 +656,7 @@ en:
default_role_pickups: Pickup days default_role_pickups: Pickup days
default_role_suppliers: Suppliers default_role_suppliers: Suppliers
disable_invite: Disable invites disable_invite: Disable invites
disable_members_overview: Disable members list
email_from: From address email_from: From address
email_replyto: Reply-to address email_replyto: Reply-to address
email_sender: Sender address email_sender: Sender address

View file

@ -580,6 +580,7 @@ es:
custom_css: CSS adicional custom_css: CSS adicional
default_locale: Idioma por defecto default_locale: Idioma por defecto
disable_invite: Desactivar invitaciones disable_invite: Desactivar invitaciones
disable_members_overview: Desactivar la lista de miembros
email_from: Dirección de email de origen email_from: Dirección de email de origen
email_replyto: Dirección reply-to email_replyto: Dirección reply-to
email_sender: Dirección del remitente email_sender: Dirección del remitente

View file

@ -418,6 +418,7 @@ fr:
zip_code: Code postal zip_code: Code postal
currency_unit: Monnaie currency_unit: Monnaie
name: Nom name: Nom
disable_members_overview: Désactiver la liste des membres
distribution_strategy: Stratégie de distribution distribution_strategy: Stratégie de distribution
distribution_strategy_options: distribution_strategy_options:
first_order_first_serve: Distribuez d'abord à ceux qui ont commandé en premier first_order_first_serve: Distribuez d'abord à ceux qui ont commandé en premier

View file

@ -626,6 +626,7 @@ nl:
default_role_pickups: Ophaaldagen default_role_pickups: Ophaaldagen
default_role_suppliers: Leveranciers default_role_suppliers: Leveranciers
disable_invite: Uitnodigingen deactiveren disable_invite: Uitnodigingen deactiveren
disable_members_overview: Ledenlijst deactiveren
email_from: From adres email_from: From adres
email_replyto: Reply-to adres email_replyto: Reply-to adres
email_sender: Sender adres email_sender: Sender adres

View file

@ -12,7 +12,7 @@ SimpleNavigation::Configuration.run do |navigation|
primary.item :dashboard_nav_item, I18n.t('navigation.dashboard'), root_path(anchor: '') primary.item :dashboard_nav_item, I18n.t('navigation.dashboard'), root_path(anchor: '')
primary.item :foodcoop, I18n.t('navigation.foodcoop'), '#' do |subnav| primary.item :foodcoop, I18n.t('navigation.foodcoop'), '#' do |subnav|
subnav.item :members, I18n.t('navigation.members'), foodcoop_users_path subnav.item :members, I18n.t('navigation.members'), foodcoop_users_path, unless: Proc.new { FoodsoftConfig[:disable_members_overview] }
subnav.item :workgroups, I18n.t('navigation.workgroups'), foodcoop_workgroups_path subnav.item :workgroups, I18n.t('navigation.workgroups'), foodcoop_workgroups_path
subnav.item :ordergroups, I18n.t('navigation.ordergroups'), foodcoop_ordergroups_path subnav.item :ordergroups, I18n.t('navigation.ordergroups'), foodcoop_ordergroups_path
subnav.item :tasks, I18n.t('navigation.tasks'), tasks_path subnav.item :tasks, I18n.t('navigation.tasks'), tasks_path