Commit 95d11f41 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Fix up action to get RSS Feed on Ticket Relate Modules

  Include action for Incident Report Module
parent 360bbd9c
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jio_button</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_button</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rss_view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>30.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>RSS Feed</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Folder_viewOpenTicketFeedURL</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:rss_feed_image</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -62,7 +62,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>RSS Monitoring Support Request List</string> </value>
<value> <string>RSS Feed</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
......@@ -79,7 +79,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Folder_viewOpenTicketList?portal_skin=RSS</string> </value>
<value> <string>string:${object_url}/Folder_viewOpenTicketFeedURL</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -62,7 +62,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>RSS Monitoring Support Request List</string> </value>
<value> <string>RSS Feed</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
......@@ -79,7 +79,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Folder_viewOpenTicketList?portal_skin=RSS</string> </value>
<value> <string>string:${object_url}/Folder_viewOpenTicketFeedURL</string> </value>
</item>
</dictionary>
</pickle>
......
portal = context.getPortalObject()
person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person is None:
raise ValueError("User Not Found")
request_url = "%s/Folder_viewOpenTicketList" % context.absolute_url()
# XXX - Cannot search in catalog with parameter url_string
access_token = None
for token_item in portal.portal_catalog(
portal_type="Restricted Access Token",
default_agent_uid=person.getUid(),
validation_state='validated'
):
if token_item.getUrlString() == request_url:
access_token = token_item
reference = access_token.getReference()
break
if access_token is None:
access_token = portal.access_token_module.newContent(
portal_type="Restricted Access Token",
url_string=request_url,
url_method="GET",
)
access_token.setAgentValue(person)
reference = access_token.getReference()
access_token.validate()
return "%s?portal_skin=RSS&access_token=%s&access_token_secret=%s" % (
request_url,
access_token.getId(),
reference)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Folder_getTicketFeedUrl</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>your_feed_url</string>
</list>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Folder_viewOpenTicketFeedURL</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Folder_viewOpenTicketFeedURL</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>RSS Feed</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -1399,3 +1399,29 @@ class TestSupportRequestUpdateMonitoringState(SlapOSTestCaseMixin):
self.assertEqual("invalidated",
support_request.getSimulationState())
class TestSlapOSFolder_getTicketFeedUrl(TestCRMSkinsMixin):
def _test(self, module):
self.assertRaises(ValueError, module.Folder_getTicketFeedUrl)
person = self.makePerson(user=1)
self.tic()
self.login(person.getUserId())
url = module.Folder_getTicketFeedUrl()
self.assertIn('Folder_viewOpenTicketList', url)
self.assertIn(module.absolute_url(), url)
self.assertIn('access_token_secret', url)
self.assertIn('access_token=', url)
self.assertIn('portal_skin=RSS', url)
def test_Folder_getTicketFeedUrl_support_request_module(self):
self._test(self.portal.support_request_module)
def test_Folder_getTicketFeedUrl_regularisation_request_module(self):
self._test(self.portal.regularisation_request_module)
def test_Folder_getTicketFeedUrl_incident_response_module(self):
self._test(self.portal.incident_response_module)
Compute Node Module | slapos_ticket_activity_report
Compute Node | view_related_support_request
Incident Response Module | rss_view
Incident Response Module | view
Incident Response | view
Instance Tree Module | slapos_resilience_usage_report
......
slapos_web
erp5_rss_style
\ No newline at end of file
erp5_rss_style
slapos_crm
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment