mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 09:53:35 +02:00
Added permissions to label system.
This commit is contained in:
parent
fde1d7be4f
commit
5a9be023b1
6 changed files with 62 additions and 27 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue