diff --git a/modules/opencase_entities/opencase_entities.permissions.yml b/modules/opencase_entities/opencase_entities.permissions.yml
index 8ee6547..a8d83ed 100644
--- a/modules/opencase_entities/opencase_entities.permissions.yml
+++ b/modules/opencase_entities/opencase_entities.permissions.yml
@@ -1,3 +1,7 @@
+permission_callbacks:
+ - Drupal\opencase_entities\OpenCaseEntityPermissions::permissions
+
+
administer opencase entity bundles:
title: 'Administer OpenCase Actor/Case/Activity Types'
description: 'Create, configure and delete types of actor (such as "Client" or "Legal Advisor"), types of case (such as "Housing" or "Asylum") and types of activity (such as "Case Note" or "Interview")'
@@ -7,57 +11,57 @@ administer actor entities:
description: 'Allow to access the administration form to configure Actor entities.'
restrict access: true
-add client entities:
- title: 'Create new Client entities'
-
-delete client entities:
- title: 'Delete Client entities'
-
-edit client entities:
- title: 'Edit Client entities'
-
-view published client entities:
- title: 'View published Client entities'
-
-view unpublished client entities:
- title: 'View unpublished Client entities'
-
-view all client revisions:
- title: 'View all Client revisions'
-
-revert all client revisions:
- title: 'Revert all Client revisions'
- description: 'Role requires permission view Client revisions and edit rights for client entities in question or administer client entities.'
-
-delete all client revisions:
- title: 'Delete all Client revisions'
- description: 'Role requires permission to view Client revisions and delete rights for client entities in question or administer client entities.'
-
-add volunteer entities:
- title: 'Create new Volunteer entities'
-
-delete volunteer entities:
- title: 'Delete Volunteer entities'
-
-edit volunteer entities:
- title: 'Edit Volunteer entities'
-
-view published volunteer entities:
- title: 'View published Volunteer entities'
-
-view unpublished volunteer entities:
- title: 'View unpublished Volunteer entities'
-
-view all volunteer revisions:
- title: 'View all Volunteer revisions'
-
-revert all volunteer revisions:
- title: 'Revert all Volunteer revisions'
- description: 'Role requires permission view Volunteer revisions and edit rights for volunteer entities in question or administer volunteer entities.'
-
-delete all volunteer revisions:
- title: 'Delete all Volunteer revisions'
- description: 'Role requires permission to view Volunteer revisions and delete rights for volunteer entities in question or administer volunteer entities.'
+#add client entities:
+# title: 'Create new Client entities'
+#
+#delete client entities:
+# title: 'Delete Client entities'
+#
+#edit client entities:
+# title: 'Edit Client entities'
+#
+#view published client entities:
+# title: 'View published Client entities'
+#
+#view unpublished client entities:
+# title: 'View unpublished Client entities'
+#
+#view all client revisions:
+# title: 'View all Client revisions'
+#
+#revert all client revisions:
+# title: 'Revert all Client revisions'
+# description: 'Role requires permission view Client revisions and edit rights for client entities in question or administer client entities.'
+#
+#delete all client revisions:
+# title: 'Delete all Client revisions'
+# description: 'Role requires permission to view Client revisions and delete rights for client entities in question or administer client entities.'
+#
+#add volunteer entities:
+# title: 'Create new Volunteer entities'
+#
+#delete volunteer entities:
+# title: 'Delete Volunteer entities'
+#
+#edit volunteer entities:
+# title: 'Edit Volunteer entities'
+#
+#view published volunteer entities:
+# title: 'View published Volunteer entities'
+#
+#view unpublished volunteer entities:
+# title: 'View unpublished Volunteer entities'
+#
+#view all volunteer revisions:
+# title: 'View all Volunteer revisions'
+#
+#revert all volunteer revisions:
+# title: 'Revert all Volunteer revisions'
+# description: 'Role requires permission view Volunteer revisions and edit rights for volunteer entities in question or administer volunteer entities.'
+#
+#delete all volunteer revisions:
+# title: 'Delete all Volunteer revisions'
+# description: 'Role requires permission to view Volunteer revisions and delete rights for volunteer entities in question or administer volunteer entities.'
add case entities:
title: 'Create new Case entities'
diff --git a/modules/opencase_entities/src/OpenCaseEntityPermissions.php b/modules/opencase_entities/src/OpenCaseEntityPermissions.php
new file mode 100644
index 0000000..2ad49e8
--- /dev/null
+++ b/modules/opencase_entities/src/OpenCaseEntityPermissions.php
@@ -0,0 +1,93 @@
+entityTypeManager = $entity_type_manager;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function create(ContainerInterface $container) {
+ return new static($container->get('entity_type.manager'));
+ }
+
+ /**
+ * Get permissions for MyModule.
+ *
+ * @return array
+ * Permissions array.
+ */
+ public function permissions() {
+ $permissions = [];
+
+ foreach ($this->entityTypeManager->getStorage('oc_actor_type')->loadMultiple() as $id => $type) {
+ $permissions += [
+ "add $id entities" => [
+ 'title' => $this->t('Create new %type entities', array('%type' => $type->label())),
+ ]
+ ];
+
+ $permissions += [
+ "edit $id entities" => [
+ 'title' => $this->t('Edit %type entities', array('%type' => $type->label())),
+ ]
+ ];
+
+ $permissions += [
+ "delete $id entities" => [
+ 'title' => $this->t('Delete %type entities', array('%type' => $type->label())),
+ ]
+ ];
+
+ $permissions += [
+ "view published $id entities" => [
+ 'title' => $this->t('View published %type entities', array('%type' => $type->label())),
+ ]
+ ];
+
+ $permissions += [
+ "view all $id revisions" => [
+ 'title' => $this->t('View %type revisions', array('%type' => $type->label())),
+ ]
+ ];
+
+ $permissions += [
+ "revert all $id revisions" => [
+ 'title' => $this->t('Revert %type revisions', array('%type' => $type->label())),
+ ]
+ ];
+
+ $permissions += [
+ "delete all $id revisions" => [
+ 'title' => $this->t('Delete %type revisions', array('%type' => $type->label())),
+ ]
+ ];
+
+ }
+ return $permissions;
+ }
+}