diff --git a/src/Controller/VocabFuncContextController.php b/src/Controller/VocabFuncContextController.php index 6ea7e5f..cde3520 100644 --- a/src/Controller/VocabFuncContextController.php +++ b/src/Controller/VocabFuncContextController.php @@ -15,6 +15,15 @@ class VocabFuncContextController extends AbstractController #[Route('/vocabs/functional_context', name: 'app_vocab_func_context')] public function index(EntityManagerInterface $em): Response { + $roles = $this->getUser()->getRoles(); + + if (! in_array('ROLE_REVISOR', $roles) + && ! in_array('ROLE_ADMIN', $roles) + ) { + $this->addFlash('warning', 'Only revisors and administrators can edit vocabularies'); + return $this->redirectToRoute('app_home'); + } + $terms = $em->getRepository(VocabFuncContext::class)->findBy([], ['term' => 'ASC']); return $this->render('vocab_func_context/index.html.twig', [ diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index 60bca47..7bed1c6 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -6,10 +6,21 @@
+

ArCOA Digital Archive

Archivi e Collezioni dell'Oriente Antico

Archives and Collections of the Ancient Near East

+ {% for message in app.flashes('warning') %} +
+
+

Warning

+ +
+
{{ message }}
+
+ {% endfor %} +
@@ -28,5 +39,13 @@
+ {% endblock %} diff --git a/templates/profile/index.html.twig b/templates/profile/index.html.twig index 291ebb1..89eccbc 100644 --- a/templates/profile/index.html.twig +++ b/templates/profile/index.html.twig @@ -32,13 +32,46 @@ Administrator {% elseif 'ROLE_REVISOR' in app.user.roles %} Revisor + {% elseif 'ROLE_EDITOR' in app.user.roles %} + Editor {% else %} Reader {% endif %} - - -

+
+
+

+ + + + Role permissions +

+
+
+ {% if 'ROLE_ADMIN' in app.user.roles %} +

+ Administrators can create and edit users of the ArCOA data entry system, + including changing passwords and user roles, and disabling accounts. +

+

+ They can perform all actions on all records and vocabularies + (create, view, edit, delete). +

+ {% elseif 'ROLE_REVISOR' in app.user.roles %} +

Revisors can perform all actions (create, view, edit, delete) on all records and vocabs.

+ {% elseif 'ROLE_EDITOR' in app.user.roles %} +

+ Editors can view vocabs, view and search all records, create new records with "draft" or "complete" status, + edit their own records and those created by other editors; they can only delete their own records, as long as the status + is "draft" or "complete". +

+ {% else %} +

+ Readers can view and search records that are either published, excluded or unindexed (draft and complete records cannot be viewed). +

+ {% endif %} +
+