Added permissions to label system.

This commit is contained in:
Jan Böhmer 2020-05-04 23:21:58 +02:00
parent fde1d7be4f
commit 5a9be023b1
6 changed files with 62 additions and 27 deletions

View file

@ -61,25 +61,19 @@ class LabelController extends AbstractController
$this->rangeParser = $rangeParser;
}
/**
* @Route("/{profile}/{part}/view")
*/
public function view(LabelProfile $profile, Part $part)
{
$label = $this->labelGenerator->generateLabel($profile->getOptions(), $part);
$response = new LabelResponse($label);
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_INLINE, 'label.pdf');
return $response;
}
/**
* @Route("/dialog", name="label_dialog")
* @Route("/{profile}/dialog", name="label_dialog_profile")
*/
public function generator(Request $request, ?LabelProfile $profile = null)
{
$this->denyAccessUnlessGranted('@labels.create_labels');
//If we inherit a LabelProfile, the user need to have access to it...
if ($profile !== null) {
$this->denyAccessUnlessGranted('read', $profile);
}
if ($profile) {
$label_options = $profile->getOptions();
} else {