Skip to content
Snippets Groups Projects
Commit 054d5de1 authored by Gregor Gawol's avatar Gregor Gawol Committed by Sebastian Kehr
Browse files

refs #16787 [fid_bbi]

* set full_access to requested for certain user group
* set fid_bbi based input filter
* remove deleted flag
* if empty values set empty string
* set condition
parent ac05fcf6
No related merge requests found
......@@ -21,6 +21,8 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
*/
use fid_bbi\InputFilter\UserCreateFormInputFilter;
return [
'elements' => [
'firstname' => [
......@@ -46,6 +48,7 @@ return [
],
],
'input_filter' => [
'type' => UserCreateFormInputFilter::class,
'firstname' => [
'required' => false,
],
......
<?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>
* @author Gregor Gawol <gawol@ub.uni-leipzig.de>
* @author Alexander Purr <purr@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
*/
namespace fid_bbi\InputFilter;
use fid\InputFilter\UserCreateFormInputFilter as BaseInputFilter;
class UserCreateFormInputFilter extends BaseInputFilter
{
public function getValues()
{
$values = parent::getValues();
$permissions = $this->getPermissions($values) + $values['permissions'];
return compact('permissions') + $values;
}
protected function getPermissions($values): array
{
$permissions = [];
switch ($values['job_title']) {
case '0':
$permissions['full_access'] = 'requested';
}
return $permissions;
}
}
......@@ -18,8 +18,10 @@ if (is_array($profile)) {
$this->translate('fid::label_salutation_' . $profile['user']->getSalutation()) : '';
$profile['academic_title'] = !empty($profile['user']->getAcademicTitle()) ?
$profile['user']->getAcademicTitle() : '';
$profile['home_library'] = $profile['libs'][$profile['user']->getHomeLibrary()]->getLabel();
$profile['college'] = $profile['user']->getCollege();
$profile['home_library'] = !empty($profile['user']->getHomeLibrary()) ?
$profile['libs'][$profile['user']->getHomeLibrary()]->getLabel() : '';
$profile['college'] = !empty($profile['user']->getCollege()) ?
$profile['user']->getCollege() : '';
}
?>
......@@ -35,9 +37,9 @@ if (is_array($profile)) {
$profile,
array_merge(
[
$this->transEsc('fid::label_username') => 'email',
$this->transEsc('fid::label_home_library') => 'home_library'
$this->transEsc('fid::label_username') => 'email'
],
$profile['academic_title'] ? [$this->transEsc('fid::label_home_library') => 'home_library'] : [],
$profile['academic_title'] ? [$this->transEsc('fid::label_academic_title') => 'academic_title'] : [],
$profile['salutation'] ? [$this->transEsc('fid::label_salutation') => 'salutation'] : [],
$profile['firstname'] ? [$this->transEsc('fid::label_firstname') => 'firstname'] : [],
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment