From dfc4bfb94d17bb032c96ef9b57b7a9e46100d0e8 Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Thu, 4 Apr 2019 02:40:27 +0000
Subject: [PATCH] slapos_crm: Add upgrade_scope category for Computer and
 Hosting Subscriptions

---
 .../portal_categories/upgrade_scope.xml       | 135 ++++++++++++++++++
 .../base_category_list.xml                    |   2 +
 .../slapos_crm/bt/template_base_category_list |   3 +-
 master/bt5/slapos_crm/bt/template_path_list   |   1 +
 .../template_portal_type_base_category_list   |   2 +
 5 files changed, 142 insertions(+), 1 deletion(-)
 create mode 100644 master/bt5/slapos_crm/CategoryTemplateItem/portal_categories/upgrade_scope.xml

diff --git a/master/bt5/slapos_crm/CategoryTemplateItem/portal_categories/upgrade_scope.xml b/master/bt5/slapos_crm/CategoryTemplateItem/portal_categories/upgrade_scope.xml
new file mode 100644
index 000000000..21b110c04
--- /dev/null
+++ b/master/bt5/slapos_crm/CategoryTemplateItem/portal_categories/upgrade_scope.xml
@@ -0,0 +1,135 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="Base Category" module="erp5.portal_type"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_Add_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Add_portal_folders_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Copy_or_Move_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Delete_objects_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Modify_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignee</string>
+                <string>Assignor</string>
+                <string>Manager</string>
+                <string>Owner</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_count</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_mt_index</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_tree</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>acquisition_base_category</string> </key>
+            <value>
+              <tuple>
+                <string>parent</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>acquisition_portal_type</string> </key>
+            <value> <string>python:[\'Computer\']</string> </value>
+        </item>
+        <item>
+            <key> <string>category_type</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>upgrade_scope</string> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Base Category</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string>Upgrade Scope</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="Length" module="BTrees.Length"/>
+    </pickle>
+    <pickle> <int>0</int> </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <global name="OOBTree" module="BTrees.OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+  <record id="4" aka="AAAAAAAAAAQ=">
+    <pickle>
+      <global name="OOBTree" module="BTrees.OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/master/bt5/slapos_crm/PortalTypeBaseCategoryTemplateItem/base_category_list.xml b/master/bt5/slapos_crm/PortalTypeBaseCategoryTemplateItem/base_category_list.xml
index 8ee9eea53..c8eca0c86 100644
--- a/master/bt5/slapos_crm/PortalTypeBaseCategoryTemplateItem/base_category_list.xml
+++ b/master/bt5/slapos_crm/PortalTypeBaseCategoryTemplateItem/base_category_list.xml
@@ -1,9 +1,11 @@
 <base_category_list>
  <portal_type id="Computer">
   <item>monitor_scope</item>
+  <item>upgrade_scope</item>
  </portal_type>
  <portal_type id="Hosting Subscription">
   <item>monitor_scope</item>
+  <item>upgrade_scope</item>
  </portal_type>
  <portal_type id="Regularisation Request">
   <item>specialise</item>
diff --git a/master/bt5/slapos_crm/bt/template_base_category_list b/master/bt5/slapos_crm/bt/template_base_category_list
index 217c62967..2fc9817ba 100644
--- a/master/bt5/slapos_crm/bt/template_base_category_list
+++ b/master/bt5/slapos_crm/bt/template_base_category_list
@@ -1 +1,2 @@
-monitor_scope
\ No newline at end of file
+monitor_scope
+upgrade_scope
\ No newline at end of file
diff --git a/master/bt5/slapos_crm/bt/template_path_list b/master/bt5/slapos_crm/bt/template_path_list
index 41a76667f..4451709a4 100644
--- a/master/bt5/slapos_crm/bt/template_path_list
+++ b/master/bt5/slapos_crm/bt/template_path_list
@@ -2,6 +2,7 @@ event_module/slapos_crm_web_message_template
 person_module/allocation_tester
 portal_alarms/slapos_crm_*
 portal_categories/monitor_scope/**
+portal_categories/upgrade_scope/**
 regularisation_request_module/slapos_crm_regularisation_request_template
 sale_trade_condition_module/slapos_ticket_trade_condition
 sale_trade_condition_module/slapos_ticket_trade_condition/**
diff --git a/master/bt5/slapos_crm/bt/template_portal_type_base_category_list b/master/bt5/slapos_crm/bt/template_portal_type_base_category_list
index b072aefac..c0079b997 100644
--- a/master/bt5/slapos_crm/bt/template_portal_type_base_category_list
+++ b/master/bt5/slapos_crm/bt/template_portal_type_base_category_list
@@ -1,5 +1,7 @@
 Computer | monitor_scope
+Computer | upgrade_scope
 Hosting Subscription | monitor_scope
+Hosting Subscription | upgrade_scope
 Regularisation Request Module | business_application
 Regularisation Request | specialise
 Support Request | aggregate
\ No newline at end of file
-- 
2.30.9