From bcf230a41d6272f419662a660972439d0149d0e9 Mon Sep 17 00:00:00 2001 From: Alexander Purr <purr@ub.uni-leipzig.de> Date: Fri, 11 Sep 2020 13:00:55 +0200 Subject: [PATCH] refs #18223 [fid_bbi] add new user groups * user group translations * add list of user permissions * add new job titles to forms * set default permissions based on job title --- fid_bbi/config/vufind/fid.ini | 7 +++ module/fid_bbi/config/admin-edit-form.php | 46 +++++++++++++++++++ module/fid_bbi/config/module.config.php | 1 + module/fid_bbi/config/user-create-form.php | 11 +++++ .../InputFilter/UserCreateFormInputFilter.php | 10 ++++ themes/fid_bbi/languages/fid/de.ini | 7 ++- themes/fid_bbi/languages/fid/en.ini | 7 ++- 7 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 module/fid_bbi/config/admin-edit-form.php diff --git a/fid_bbi/config/vufind/fid.ini b/fid_bbi/config/vufind/fid.ini index ef88fea41df..4e926511daa 100644 --- a/fid_bbi/config/vufind/fid.ini +++ b/fid_bbi/config/vufind/fid.ini @@ -3,3 +3,10 @@ relative_path = ../../../fid/config/vufind/fid.ini [Client] baseUrl = https://fid-api.finc.info/staging/bbi + +[Admin] +; List of all available user permissions +permission_options[] = 'basic_access' +permission_options[] = 'limited_access' +permission_options[] = 'extended_access' +permission_options[] = 'full_access' \ No newline at end of file diff --git a/module/fid_bbi/config/admin-edit-form.php b/module/fid_bbi/config/admin-edit-form.php new file mode 100644 index 00000000000..bd0dedad165 --- /dev/null +++ b/module/fid_bbi/config/admin-edit-form.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright (C) 2020 Leipzig University Library + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * @author Sebastian Kehr <kehr@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2 + */ + +use fid\Hydrator\UserHydrator; +use fid\InputFilter\RootAwareBaseInputFilter; +use Zend\Form\Element\Collection; +use Zend\Form\Element\Hidden; +use Zend\Form\Element\Radio; +use Zend\Form\Element\Select; +use Zend\Form\Element\Submit; +use Zend\Form\Element\Text; +use Zend\Form\Fieldset; +use Zend\Form\InputFilterProviderFieldset; + +return [ + 'elements' => [ + 'job_title' => [ + 'spec' => [ + 'options' => [ + 'value_options' => [ + 'job_title_2', + 'job_title_3', + ], + ], + ], + ], + ], +]; diff --git a/module/fid_bbi/config/module.config.php b/module/fid_bbi/config/module.config.php index 0084e0984eb..691199cf202 100644 --- a/module/fid_bbi/config/module.config.php +++ b/module/fid_bbi/config/module.config.php @@ -33,6 +33,7 @@ $config = [ 'user-init-form' => require 'user-init-form.php', 'user-create-form' => require 'user-create-form.php', 'user-update-form' => require 'user-update-form.php', + 'admin-edit-form' => require 'admin-edit-form.php', ], 'controllers' => [ 'factories' => [ diff --git a/module/fid_bbi/config/user-create-form.php b/module/fid_bbi/config/user-create-form.php index e5aaf1e6c52..0c4d2f4da5a 100644 --- a/module/fid_bbi/config/user-create-form.php +++ b/module/fid_bbi/config/user-create-form.php @@ -46,6 +46,17 @@ return [ ], ], ], + 'job_title' => [ + 'spec' => [ + 'options' => [ + 'label' => 'label_job_title', + 'value_options' => [ + 'job_title_2', + 'job_title_3' + ], + ], + ], + ], ], 'input_filter' => [ 'type' => UserCreateFormInputFilter::class, diff --git a/module/fid_bbi/src/fid_bbi/InputFilter/UserCreateFormInputFilter.php b/module/fid_bbi/src/fid_bbi/InputFilter/UserCreateFormInputFilter.php index f2df5bb00ca..1b702fc14f3 100644 --- a/module/fid_bbi/src/fid_bbi/InputFilter/UserCreateFormInputFilter.php +++ b/module/fid_bbi/src/fid_bbi/InputFilter/UserCreateFormInputFilter.php @@ -39,7 +39,17 @@ class UserCreateFormInputFilter extends BaseInputFilter $permissions = []; switch ($values['job_title']) { case '0': + $permissions['extended_access'] = 'requested'; $permissions['full_access'] = 'requested'; + break; + case '2': + case '3': + $permissions['extended_access'] = 'requested'; + $permissions['full_access'] = 'denied'; + break; + case '1': + $permissions['extended_access'] = 'denied'; + $permissions['full_access'] = 'denied'; } return $permissions; diff --git a/themes/fid_bbi/languages/fid/de.ini b/themes/fid_bbi/languages/fid/de.ini index ae7d9483ce0..e108ec87735 100644 --- a/themes/fid_bbi/languages/fid/de.ini +++ b/themes/fid_bbi/languages/fid/de.ini @@ -1,2 +1,7 @@ label_access_level_full_access = "Hochschullehrer*innen, wissenschaftliche Mitarbeiter*innen, Mitglieder von Fachgesellschaften, Doktorand*innen, Stipendiat*innen oder externe Wissenschaftler*innen (z. B. Lehrbeauftragte)" -auth_error_account_blocked = "Ihr Konto wurde aus Sicherheitsgründen gesperrt. Bitte kontaktieren Sie uns unter fid@hab.de, um eine Entsperrung vorzunehmen." \ No newline at end of file +auth_error_account_blocked = "Ihr Konto wurde aus Sicherheitsgründen gesperrt. Bitte kontaktieren Sie uns unter fid@hab.de, um eine Entsperrung vorzunehmen." + +job_title_0 = "HochschullehrerInnen, wissenschaftliche MitarbeiterInnen, Mitglied einer Fachgesellschaft, DoktorandInnen, StipendiatInnen oder externe WissenschaftlerInnen (z. B. Lehrbeauftragte)" +job_title_1 = "Studierende und weitere Interessierte" +job_title_2 = "Berufspraktiker, wissenschaftliche Mitarbeiter*Innen an Bibliotheken, Archiven und Sammlungsinstitutionen (Fachreferenten, Referendare)" +job_title_3 = "Nutzende der Herzog August Bibliothek" \ No newline at end of file diff --git a/themes/fid_bbi/languages/fid/en.ini b/themes/fid_bbi/languages/fid/en.ini index 6641f32be1a..255bcc36801 100644 --- a/themes/fid_bbi/languages/fid/en.ini +++ b/themes/fid_bbi/languages/fid/en.ini @@ -1 +1,6 @@ -auth_error_account_blocked = "Your account has been disabled due to security reasons. Please contact us at fid@hab.de for more details." \ No newline at end of file +auth_error_account_blocked = "Your account has been disabled due to security reasons. Please contact us at fid@hab.de for more details." + +job_title_0 = "Professor, Research Associate/Assistant, Member of an Academic Association, PhD Student (also Scholarships), (Visiting) Lecturer" +job_title_1 = "Students, other interested people" +job_title_2 = "Professional practitioners, research personnel employed in libraries, archives and other collecting institutions (subject librarians, trainee subject librarians)" +job_title_3 = "Users of the Herzog August Bibliothek" \ No newline at end of file -- GitLab