[ReelCalculator] Added permission and added it to tools menu.

This commit is contained in:
Jan Böhmer 2020-06-03 22:19:59 +02:00
parent 21f0727509
commit 36dfae52f2
6 changed files with 37 additions and 10 deletions

View file

@ -273,15 +273,15 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
labels: labels:
label: "perm.tools.labels" label: "perm.tools.labels"
bit: 2 bit: 2
calculator: #calculator:
label: "perm.tools.calculator" # label: "perm.tools.calculator"
bit: 4 # bit: 4
footprints: #footprints:
label: "perm.tools.footprints" # label: "perm.tools.footprints"
bit: 6 # bit: 6
ic_logos: #ic_logos:
label: "perm.tools.ic_logos" # label: "perm.tools.ic_logos"
bit: 8 # bit: 8
statistics: statistics:
label: "perm.tools.statistics" label: "perm.tools.statistics"
bit: 10 bit: 10
@ -294,6 +294,9 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
label_scanner: label_scanner:
label: "perm.tools.label_scanner" label: "perm.tools.label_scanner"
bit: 16 bit: 16
reel_calculator:
label: "perm.tools.reel_calculator"
bit: 18
groups: groups:
label: "perm.groups" label: "perm.groups"

View file

@ -21,6 +21,8 @@ class ToolsController extends AbstractController
*/ */
public function reelCalculator() : Response public function reelCalculator() : Response
{ {
$this->denyAccessUnlessGranted('@tools.reel_calculator');
return $this->render("Tools/ReelCalculator/main.html.twig"); return $this->render("Tools/ReelCalculator/main.html.twig");
} }
} }

View file

@ -82,7 +82,7 @@ class GroupFixtures extends Fixture
'suppliers' => 5461, 'suppliers' => 5461,
'manufacturers' => 5461, 'manufacturers' => 5461,
'attachment_types' => 1365, 'attachment_types' => 1365,
'tools' => 87381, 'tools' => 349525,
'labels' => 87381, 'labels' => 87381,
'parts_category' => 5, 'parts_category' => 5,
'parts_minamount' => 5, 'parts_minamount' => 5,

View file

@ -132,6 +132,13 @@ class ToolsTreeBuilder
); );
} }
if ($this->security->isGranted('@tools.reel_calculator')) {
$nodes[] = new TreeViewNode(
$this->translator->trans('tree.tools.tools.reel_calculator'),
$this->urlGenerator->generate('tools_reel_calculator')
);
}
return $nodes; return $nodes;
} }

View file

@ -126,5 +126,8 @@ class ApplicationAvailabilityFunctionalTest extends WebTestCase
yield ['/label/dialog?target_id=1&target_type=part']; yield ['/label/dialog?target_id=1&target_type=part'];
yield ['/label/1/dialog']; yield ['/label/1/dialog'];
yield ['/label/1/dialog?target_id=1&target_type=part&generate=1']; yield ['/label/1/dialog?target_id=1&target_type=part&generate=1'];
//Tools
yield ['/tools/reel_calc'];
} }
} }

View file

@ -9303,5 +9303,17 @@ Element 3</target>
<target>This calculator gives you an estimation, how many parts are remaining on an SMD reel. Measure the noted the dimensions on the reel (or use some of the presets) and click "Update" to get an result.</target> <target>This calculator gives you an estimation, how many parts are remaining on an SMD reel. Measure the noted the dimensions on the reel (or use some of the presets) and click "Update" to get an result.</target>
</segment> </segment>
</unit> </unit>
<unit id="E1xAigo" name="perm.tools.reel_calculator">
<segment>
<source>perm.tools.reel_calculator</source>
<target>SMD Reel calculator</target>
</segment>
</unit>
<unit id="Q_6JPEr" name="tree.tools.tools.reel_calculator">
<segment>
<source>tree.tools.tools.reel_calculator</source>
<target>SMD Reel calculator</target>
</segment>
</unit>
</file> </file>
</xliff> </xliff>