From b7a20a1777fce9b2bcc05b7ff40d738181403a49 Mon Sep 17 00:00:00 2001
From: l26yan <l26yan@uwaterloo.ca>
Date: Mon, 8 Nov 2021 16:23:01 -0500
Subject: [PATCH] ISTWCMS-5184 Create permissions for opportunity content type

---
 src/UwPermissions/UwPermissions.php              | 8 ++++++++
 src/UwRoles/user.role.uw_role_content_author.yml | 5 +++++
 src/UwRoles/user.role.uw_role_content_editor.yml | 5 +++++
 src/UwRoles/user.role.uw_role_site_manager.yml   | 5 +++++
 uw_cfg_common.install                            | 7 +++++++
 5 files changed, 30 insertions(+)

diff --git a/src/UwPermissions/UwPermissions.php b/src/UwPermissions/UwPermissions.php
index 40237b80..9272218b 100644
--- a/src/UwPermissions/UwPermissions.php
+++ b/src/UwPermissions/UwPermissions.php
@@ -177,6 +177,14 @@ class UwPermissions {
         ),
       ],
 
+      // Opportunity permissions.
+      'Opportunity' => [
+        'Use content type' =>
+        UwPermissions::buildRolePermissionsListContentType(
+          'uw_ct_opportunity'
+        ),
+      ],
+
       // Profile permissions.
       'Profile' => [
         'Use content type' =>
diff --git a/src/UwRoles/user.role.uw_role_content_author.yml b/src/UwRoles/user.role.uw_role_content_author.yml
index c1009b4b..a6746f22 100644
--- a/src/UwRoles/user.role.uw_role_content_author.yml
+++ b/src/UwRoles/user.role.uw_role_content_author.yml
@@ -48,6 +48,7 @@ permissions:
   - 'clone uw_ct_contact content'
   - 'clone uw_ct_event content'
   - 'clone uw_ct_news_item content'
+  - 'clone uw_ct_opportunity content'
   - 'clone uw_ct_profile content'
   - 'clone uw_ct_service content'
   - 'clone uw_ct_sidebar content'
@@ -57,6 +58,7 @@ permissions:
   - 'configure editable uw_ct_contact node layout overrides'
   - 'configure editable uw_ct_event node layout overrides'
   - 'configure editable uw_ct_news_item node layout overrides'
+  - 'configure editable uw_ct_opportunity node layout overrides'
   - 'configure editable uw_ct_profile node layout overrides'
   - 'configure editable uw_ct_service node layout overrides'
   - 'configure editable uw_ct_sidebar node layout overrides'
@@ -94,6 +96,7 @@ permissions:
   - 'enter uw_ct_contact revision log entry'
   - 'enter uw_ct_event revision log entry'
   - 'enter uw_ct_news_item revision log entry'
+  - 'enter uw_ct_opportunity revision log entry'
   - 'enter uw_ct_profile revision log entry'
   - 'enter uw_ct_service revision log entry'
   - 'enter uw_ct_web_page revision log entry'
@@ -114,6 +117,8 @@ permissions:
   - 'override uw_ct_news_item published option'
   - 'override uw_ct_news_item revision option'
   - 'override uw_ct_news_item sticky option'
+  - 'override uw_ct_opportunity published option'
+  - 'override uw_ct_opportunity revision option'
   - 'override uw_ct_profile published option'
   - 'override uw_ct_profile revision option'
   - 'override uw_ct_service published option'
diff --git a/src/UwRoles/user.role.uw_role_content_editor.yml b/src/UwRoles/user.role.uw_role_content_editor.yml
index 4226291f..a71f4d5f 100644
--- a/src/UwRoles/user.role.uw_role_content_editor.yml
+++ b/src/UwRoles/user.role.uw_role_content_editor.yml
@@ -49,6 +49,7 @@ permissions:
   - 'clone uw_ct_contact content'
   - 'clone uw_ct_event content'
   - 'clone uw_ct_news_item content'
+  - 'clone uw_ct_opportunity content'
   - 'clone uw_ct_profile content'
   - 'clone uw_ct_service content'
   - 'clone uw_ct_sidebar content'
@@ -58,6 +59,7 @@ permissions:
   - 'configure editable uw_ct_contact node layout overrides'
   - 'configure editable uw_ct_event node layout overrides'
   - 'configure editable uw_ct_news_item node layout overrides'
+  - 'configure editable uw_ct_opportunity node layout overrides'
   - 'configure editable uw_ct_profile node layout overrides'
   - 'configure editable uw_ct_service node layout overrides'
   - 'configure editable uw_ct_sidebar node layout overrides'
@@ -83,6 +85,7 @@ permissions:
   - 'enter uw_ct_contact revision log entry'
   - 'enter uw_ct_event revision log entry'
   - 'enter uw_ct_news_item revision log entry'
+  - 'enter uw_ct_opportunity revision log entry'
   - 'enter uw_ct_profile revision log entry'
   - 'enter uw_ct_service revision log entry'
   - 'enter uw_ct_web_page revision log entry'
@@ -103,6 +106,8 @@ permissions:
   - 'override uw_ct_news_item published option'
   - 'override uw_ct_news_item revision option'
   - 'override uw_ct_news_item sticky option'
+  - 'override uw_ct_opportunity published option'
+  - 'override uw_ct_opportunity revision option'
   - 'override uw_ct_profile published option'
   - 'override uw_ct_profile revision option'
   - 'override uw_ct_service published option'
diff --git a/src/UwRoles/user.role.uw_role_site_manager.yml b/src/UwRoles/user.role.uw_role_site_manager.yml
index b0e18b09..7b1ba97d 100644
--- a/src/UwRoles/user.role.uw_role_site_manager.yml
+++ b/src/UwRoles/user.role.uw_role_site_manager.yml
@@ -53,6 +53,7 @@ permissions:
   - 'clone uw_ct_contact content'
   - 'clone uw_ct_event content'
   - 'clone uw_ct_news_item content'
+  - 'clone uw_ct_opportunity content'
   - 'clone uw_ct_profile content'
   - 'clone uw_ct_service content'
   - 'clone uw_ct_sidebar content'
@@ -62,6 +63,7 @@ permissions:
   - 'configure editable uw_ct_contact node layout overrides'
   - 'configure editable uw_ct_event node layout overrides'
   - 'configure editable uw_ct_news_item node layout overrides'
+  - 'configure editable uw_ct_opportunity node layout overrides'
   - 'configure editable uw_ct_profile node layout overrides'
   - 'configure editable uw_ct_service node layout overrides'
   - 'configure editable uw_ct_sidebar node layout overrides'
@@ -101,6 +103,7 @@ permissions:
   - 'enter uw_ct_contact revision log entry'
   - 'enter uw_ct_event revision log entry'
   - 'enter uw_ct_news_item revision log entry'
+  - 'enter uw_ct_opportunity revision log entry'
   - 'enter uw_ct_profile revision log entry'
   - 'enter uw_ct_service revision log entry'
   - 'enter uw_ct_web_page revision log entry'
@@ -121,6 +124,8 @@ permissions:
   - 'override uw_ct_news_item published option'
   - 'override uw_ct_news_item revision option'
   - 'override uw_ct_news_item sticky option'
+  - 'override uw_ct_opportunity published option'
+  - 'override uw_ct_opportunity revision option'
   - 'override uw_ct_profile published option'
   - 'override uw_ct_profile revision option'
   - 'override uw_ct_service published option'
diff --git a/uw_cfg_common.install b/uw_cfg_common.install
index dc67811b..d91d7e79 100644
--- a/uw_cfg_common.install
+++ b/uw_cfg_common.install
@@ -154,6 +154,13 @@ function uw_cfg_common_install() {
         'Site manager',
       ],
     ],
+    'Opportunity' => [
+      'Use content type' => [
+        'Site manager',
+        'Content author',
+        'Content editor',
+      ],
+    ],
     'Profile' => [
       'Use content type' => [
         'Site manager',
-- 
GitLab