Added permission system, to control who can edit Twig labels.

This commit is contained in:
Jan Böhmer 2020-05-07 22:29:45 +02:00
parent f1a6bc31a1
commit 1a35adab17
6 changed files with 41 additions and 8 deletions

View file

@ -87,7 +87,12 @@ class LabelController extends AbstractController
$label_options = new LabelOptions();
}
$form = $this->createForm(LabelDialogType::class);
//We have to disable the options, if twig mode is selected and user is not allowed to use it.
$disable_options = $label_options->getLinesMode() === 'twig' && !$this->isGranted("@labels.use_twig");
$form = $this->createForm(LabelDialogType::class, null, [
'disable_options' => $disable_options,
]);
//Try to parse given target_type and target_id
$target_type = $request->query->get('target_type', null);