Commit 8fefe667 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_panel: Only limit event creation to Accountant and Seller

   Only owner, Accountant or sales team can respond subscription requests and regularisation requests.

   This is out of the scope of Production Manager/Agent, so no reason to allow them to respond those tickets.
parent 642118ba
portal = context.getPortalObject()
checked_permission = 'Access contents information'
if customer_relation == 'destination_decision':
destination_decision = context.getDestinationDecisionValue(
checked_permission=checked_permission)
else:
raise ValueError('Unexpected customer relation: %s' % customer_relation)
if destination_decision is None:
return False
member = portal.portal_membership.getAuthenticatedMember()
getGroups = getattr(member, 'getGroups', None)
if getGroups is None:
return False
user_group_list = getGroups()
return (
((customer) and
(destination_decision.getPortalType() == 'Person') and
(destination_decision.getUserId() in user_group_list)
) or
((accountant) and ('F-ACCOUNTING*' in user_group_list)) or
((seller) and ('F-SALEMAN' in user_group_list)) or
((seller) and ('F-SALEAGT' in user_group_list)) or
((seller) and ('F-SALE*' in user_group_list))
)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>customer_relation=\'destination_decision\', customer=False, seller=False, accountant=False</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_hasSlapOSAccountingUserGroup</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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