mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-30 13:34:28 +02:00
Allow admins to change the users configuration via the admin menu.
This commit is contained in:
parent
d935e625d3
commit
694beca825
2 changed files with 44 additions and 2 deletions
|
@ -37,13 +37,17 @@ use App\Entity\Base\NamedDBElement;
|
|||
use App\Entity\Base\StructuralDBElement;
|
||||
use App\Form\Permissions\PermissionsType;
|
||||
use App\Form\Permissions\PermissionType;
|
||||
use App\Form\Type\CurrencyEntityType;
|
||||
use App\Form\Type\StructuralEntityType;
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\LanguageType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ResetType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TimezoneType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
@ -113,6 +117,36 @@ class UserAdminForm extends AbstractType
|
|||
'disabled' => !$this->security->isGranted('edit_infos', $entity),
|
||||
])
|
||||
|
||||
//Config section
|
||||
->add('language', LanguageType::class, [
|
||||
'required' => false,
|
||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true],
|
||||
'placeholder' => $this->trans->trans('user_settings.language.placeholder'),
|
||||
'label' => $this->trans->trans('user.language_select'),
|
||||
'preferred_choices' => ['en', 'de'],
|
||||
'disabled' => !$this->security->isGranted('change_user_settings', $entity)
|
||||
])
|
||||
->add('timezone', TimezoneType::class, [
|
||||
'required' => false,
|
||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true],
|
||||
'placeholder' => $this->trans->trans('user_settings.timezone.placeholder'),
|
||||
'label' => $this->trans->trans('user.timezone.label'),
|
||||
'preferred_choices' => ['Europe/Berlin'],
|
||||
'disabled' => !$this->security->isGranted('change_user_settings', $entity)
|
||||
])
|
||||
->add('theme', ChoiceType::class, [
|
||||
'required' => false,
|
||||
'placeholder' => $this->trans->trans('user_settings.theme.placeholder'),
|
||||
'label' => $this->trans->trans('user.theme.label'),
|
||||
'disabled' => !$this->security->isGranted('change_user_settings', $entity)
|
||||
])
|
||||
->add('currency', CurrencyEntityType::class, [
|
||||
'required' => false,
|
||||
'label' => $this->trans->trans('user.currency.label'),
|
||||
'disabled' => !$this->security->isGranted('change_user_settings', $entity)
|
||||
])
|
||||
|
||||
//Permission section
|
||||
->add('permissions', PermissionsType::class, [
|
||||
'mapped' => false,
|
||||
'data' => $builder->getData(),
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
{% block comment %}{% endblock %}
|
||||
|
||||
{% block additional_pills %}
|
||||
<li class="nav-item"><a data-toggle="tab" class="nav-link link-anchor" href="#tab_permissions">{% trans %}user.edit.permissions{% endtrans %}</a></li>
|
||||
<li class="nav-item"><a data-toggle="tab" class="nav-link link-anchor" href="#configuration">{% trans %}user.edit.configuration{% endtrans %}</a></li>
|
||||
<li class="nav-item"><a data-toggle="tab" class="nav-link link-anchor" href="#permissions">{% trans %}user.edit.permissions{% endtrans %}</a></li>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
@ -20,7 +21,14 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block additional_panes %}
|
||||
<div class="tab-pane" id="tab_permissions">
|
||||
<div class="tab-pane" id="configuration">
|
||||
{{ form_row(form.language) }}
|
||||
{{ form_row(form.timezone) }}
|
||||
{{ form_row(form.theme) }}
|
||||
{{ form_row(form.currency) }}
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="permissions">
|
||||
{{ form_row(form.permissions) }}
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue