mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Added permission system, to control who can edit Twig labels.
This commit is contained in:
parent
f1a6bc31a1
commit
1a35adab17
6 changed files with 41 additions and 8 deletions
|
@ -165,11 +165,22 @@ abstract class BaseAdminController extends AbstractController
|
|||
$table = null;
|
||||
}
|
||||
|
||||
$form = $this->createForm($this->form_class, $entity, [
|
||||
$form_options = [
|
||||
'attachment_class' => $this->attachment_class,
|
||||
'parameter_class' => $this->parameter_class,
|
||||
'disabled' => null !== $timeTravel_timestamp ? true : null,
|
||||
]);
|
||||
];
|
||||
|
||||
//Disable editing of options, if user is not allowed to use twig...
|
||||
if (
|
||||
$entity instanceof LabelProfile
|
||||
&& $entity->getOptions()->getLinesMode() === 'twig'
|
||||
&& !$this->isGranted('@labels.use_twig')
|
||||
) {
|
||||
$form_options['disable_options'] = true;
|
||||
}
|
||||
|
||||
$form = $this->createForm($this->form_class, $entity, $form_options);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue