From e1b742046757826e46e9f912ab353172e8c286cf Mon Sep 17 00:00:00 2001
From: Lily Yan <lily.yan@uwaterloo.ca>
Date: Wed, 15 Jul 2020 15:02:05 -0400
Subject: [PATCH] ISTWCMS-3923 Create default permissions for end-user roles
 authoring during install

---
 uw_cfg_common.install | 93 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)
 create mode 100644 uw_cfg_common.install

diff --git a/uw_cfg_common.install b/uw_cfg_common.install
new file mode 100644
index 00000000..c5b44612
--- /dev/null
+++ b/uw_cfg_common.install
@@ -0,0 +1,93 @@
+<?php
+
+/**
+ * @file
+ * Install, update and uninstall for Configuration of all common WCMS.
+ */
+
+use Drupal\uw_cfg_common\UwPermissions\UwPermissions;
+
+/**
+ * Implements hook_install().
+ */
+function uw_cfg_common_install() {
+  $permissions_to_process = [
+    'Blog' => [
+      'Use content type' => [
+        'Site manager',
+        'Content author',
+        'Content editor',
+      ],
+      'Create/edit tags' => [
+        'Site manager',
+        'Content author',
+        'Content editor',
+      ],
+      'Delete tags' => [
+        'Site manager',
+      ],
+    ],
+    'Event' => [
+      'Use content type' => [
+        'Site manager',
+        'Content author',
+        'Content editor',
+      ],
+      'Create/edit tags' => [
+        'Site manager',
+        'Content author',
+        'Content editor',
+      ],
+      'Delete tags' => [
+        'Site manager',
+      ],
+      'Create/edit types' => [
+        'Site manager',
+        'Content author',
+        'Content editor',
+      ],
+      'Delete types' => [
+        'Site manager',
+      ],
+    ],
+    'News' => [
+      'Use content type' => [
+        'Site manager',
+        'Content author',
+        'Content editor',
+      ],
+      'Create/edit tags' => [
+        'Site manager',
+        'Content author',
+        'Content editor',
+      ],
+      'Delete tags' => [
+        'Site manager',
+      ],
+    ],
+    'Site footer' => [
+      'Use content type' => [
+        'Site manager',
+        'Content author',
+        'Content editor',
+      ],
+    ],
+    /*'Special alert' => [
+      'Use content type' => [
+        'Site manager',
+        'Content author',
+        'Content editor',
+      ],
+    ],*/
+    'Web page' => [
+      'Use content type' => [
+        'Site manager',
+        'Content author',
+        'Content editor',
+      ],
+    ],
+  ];
+  UwPermissions::uw_grant_revoke_permissions($permissions_to_process, 'grant');
+
+}
+
-- 
GitLab