Show a notice above the permission editor, that permissions can depend on each other

Related to issue #435
This commit is contained in:
Jan Böhmer 2023-11-25 00:42:17 +01:00
parent 84c111ac7c
commit 4b88de9316
3 changed files with 14 additions and 0 deletions

View file

@ -45,6 +45,9 @@ class PermissionsType extends AbstractType
$resolver->setDefaults([
'show_legend' => true,
'show_presets' => false,
'show_dependency_notice' => static function (Options $options) {
return !$options['disabled'];
},
'constraints' => static function (Options $options) {
if (!$options['disabled']) {
return [new NoLockout()];
@ -60,6 +63,7 @@ class PermissionsType extends AbstractType
{
$view->vars['show_legend'] = $options['show_legend'];
$view->vars['show_presets'] = $options['show_presets'];
$view->vars['show_dependency_notice'] = $options['show_dependency_notice'];
}
public function buildForm(FormBuilderInterface $builder, array $options): void

View file

@ -89,6 +89,10 @@
{% endif %}
</div>
{% if show_dependency_notice %}
<small class="text-muted mb-1 d-inline-block">{% trans %}permission.legend.dependency_note{% endtrans %}</small>
{% endif %}
<ul class="nav nav-tabs">
{% for group in form %}
<li class="nav-item">

View file

@ -12047,5 +12047,11 @@ Please note, that you can not impersonate a disabled user. If you try you will g
<target>Permissions required by other permissions were missing. This was corrected. Please check if the permissions are as you intended.</target>
</segment>
</unit>
<unit id="gjo2ZK7" name="permission.legend.dependency_note">
<segment>
<source>permission.legend.dependency_note</source>
<target>Please note that some permission operations depend on each other. If you encounter a warning that missing permissions were corrected and a permission was set to allow again, you have to set the dependent operation to forbid too. The dependents can normally found right of an operation.</target>
</segment>
</unit>
</file>
</xliff>