Commit 3e947793 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Reimplement (and speed up) security to use ERP5User_getUserSecurityCategoryValueList

parent efb0f29f
Pipeline #38500 failed with stage
in 0 seconds
"""
Core security script - defines the way to get security groups of the current user.
WARNING: providing such script in erp5_dms could be dangerous
if this conflicts with an existing production site which uses
deprecated ERP5Type_asSecurityGroupIdList
"""
return (
# Person security
('ERP5Type_getSecurityCategoryFromAssignment', ['function']),
('ERP5Type_getSecurityCategoryFromAssignmentParent', ['function']),
# XXX TODO check that only validated project are used
('ERP5Type_getSecurityCategoryFromAssignment', ['destination_project']),
('ERP5Type_getSecurityCategoryFromAssignment', ['destination_project', 'function']),
# Compute Node security
('ERP5Type_getComputeNodeSecurityCategory', ['role']),
# Instance security
('ERP5Type_getSoftwareInstanceSecurityCategory', ['role']),
('ERP5Type_getSoftwareInstanceSecurityCategory', ['destination_project']),
('ERP5Type_getSoftwareInstanceSecurityCategory', ['destination_project', 'role']),
('ERP5Type_getSoftwareInstanceSecurityCategory', ['aggregate']),
)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>getSoftwareInstanceSecurityCategory</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>SlapOSSecurity</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Type_getSoftwareInstanceSecurityCategory</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_function</string> </key> <key> <string>_function</string> </key>
<value> <string>getComputeNodeSecurityCategory</string> </value> <value> <string>getSlapOSUserSecurityCategoryValue</string> </value>
</item> </item>
<item> <item>
<key> <string>_module</string> </key> <key> <string>_module</string> </key>
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ERP5Type_getComputeNodeSecurityCategory</string> </value> <value> <string>ERP5User_getSlapOSUserSecurityCategoryValue</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
if context.getPortalType() == 'Person':
return context.ERP5User_getSecurityCategoryValueFromAssignment(
rule_dict={
('function',): ((), ('function',)),
('destination_project',): ((), ),
('destination_project', 'function'): ((), ),
},
)
return context.ERP5User_getSlapOSUserSecurityCategoryValue()
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ERP5Type_getSecurityCategoryMapping</string> </value> <value> <string>ERP5User_getUserSecurityCategoryValueList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
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