mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-05 23:15:50 +01:00
Added permissions to label system.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user