diff --git a/src/Twig/AssemblyTwigExtension.php b/src/Twig/AssemblyTwigExtension.php
new file mode 100644
index 00000000..3430f7d1
--- /dev/null
+++ b/src/Twig/AssemblyTwigExtension.php
@@ -0,0 +1,26 @@
+getAssembly() !== null) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/templates/form/collection_types_layout.html.twig b/templates/form/collection_types_layout.html.twig
index 0175aeaf..552fd542 100644
--- a/templates/form/collection_types_layout.html.twig
+++ b/templates/form/collection_types_layout.html.twig
@@ -44,9 +44,18 @@
{{ form_row(form.part) }}
{{ form_errors(form.part) }}
- ∨
- {{ form_widget(form.assembly) }}
- {{ form_errors(form.assembly) }}
+
+ {% if form.vars.value is not null and form.vars.value.project is not null %}
+ {% set hasAssembly = false %}
+ {% if is_granted("@assemblies.read") or has_assembly(form.vars.value.project.bomEntries.toArray) %}
+ ∨
+ {{ form_widget(form.assembly) }}
+ {{ form_errors(form.assembly) }}
+ {% endif %}
+ {% elseif is_granted("@assemblies.read") %}
+ {{ form_widget(form.assembly) }}
+ {{ form_errors(form.assembly) }}
+ {% endif %}
|
{{ form_widget(form.name) }}
|