Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hardik Juneja
slapos.core
Commits
1558d49b
Commit
1558d49b
authored
Oct 24, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify Computer security calculation.
Do not depends on external documents to fetch informations.
parent
c169e70d
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
35 additions
and
124 deletions
+35
-124
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Computer.xml
.../bt5/slapos_erp5/PortalTypeRolesTemplateItem/Computer.xml
+6
-6
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ComputerType_getSecurityCategoryFromAllocationScope.xml
...e/ComputerType_getSecurityCategoryFromAllocationScope.xml
+14
-29
master/bt5/slapos_erp5/bt/revision
master/bt5/slapos_erp5/bt/revision
+1
-1
master/bt5/vifib_erp5/bt/revision
master/bt5/vifib_erp5/bt/revision
+1
-1
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Computer_getRelatedSaleSupplyLine.xml
...skins/vifib_hosting/Computer_getRelatedSaleSupplyLine.xml
+0
-71
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Computer_updateAllocationScope.xml
...al_skins/vifib_hosting/Computer_updateAllocationScope.xml
+11
-14
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Computer_viewAllocationScopeUpdateDialog/your_subject_list.xml
...ter_viewAllocationScopeUpdateDialog/your_subject_list.xml
+1
-1
master/bt5/vifib_web/bt/revision
master/bt5/vifib_web/bt/revision
+1
-1
No files found.
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Computer.xml
View file @
1558d49b
<type_roles>
<role
id=
'Auditor'
>
<property
id=
'title'
>
Allocation scope
</property>
<property
id=
'condition'
>
python: here.getAllocationScope('').startswith('open')
</property>
<property
id=
'base_category_script'
>
ComputerType_getSecurityCategoryFromAllocationScope
</property>
<multi_property
id=
'base_category'
>
aggregate
</multi_property>
</role>
<role
id=
'Assignee'
>
<property
id=
'title'
>
Computer Agent
</property>
<property
id=
'description'
>
Monovalued role
</property>
...
...
@@ -10,12 +16,6 @@
<multi_property
id=
'category'
>
group/company
</multi_property>
<multi_property
id=
'base_category'
>
group
</multi_property>
</role>
<role
id=
'Auditor'
>
<property
id=
'title'
>
Sale Trade Condition allocation
</property>
<property
id=
'condition'
>
python: here.getAllocationScope('').startswith('open')
</property>
<property
id=
'base_category_script'
>
ComputerType_getSecurityCategoryFromSaleTradeCondition
</property>
<multi_property
id=
'base_category'
>
aggregate
</multi_property>
</role>
<role
id=
'Assignor'
>
<property
id=
'title'
>
Self Computer
</property>
<property
id=
'condition'
>
python: context.getReference("") != ""
</property>
...
...
master/bt5/
vifib_erp5/SkinTemplateItem/portal_skins/vifib_core/ComputerType_getSecurityCategoryFromSaleTradeCondition
.xml
→
master/bt5/
slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ComputerType_getSecurityCategoryFromAllocationScope
.xml
View file @
1558d49b
...
...
@@ -64,38 +64,23 @@ if obj is None:\n
return []\n
\n
portal = obj.getPortalObject()\n
\n
sale_supply_line_list = portal.portal_catalog(\n
aggregate_relative_url=obj.getRelativeUrl(),\n
portal_type="Sale Supply Line",\n
validation_state="validated")\n
computer = obj\n
\n
category_list = []\n
public = 0\n
\n
for sale_supply_line in sale_supply_line_list:\n
sale_supply_line = sale_supply_line.getObject()\n
sale_trade_condition = sale_supply_line.getParentValue()\n
if sale_trade_condition.getPortalType() == \'Sale Trade Condition\':\n
\n
person_list = sale_supply_line.getDestinationSectionValueList(portal_type="Person")\n
scope = computer.getAllocationScope()\n
if scope == \'open/public\':\n
return {"Auditor": ["R-SHADOW-PERSON"]}\n
elif scope == \'open/private\':\n
person = computer.getSourceAdministrationValue(portal_type="Person")\n
if person is not None:\n
return {"Auditor": ["SHADOW-%s" % person.getReference()]}\n
elif scope == \'open/friend\':\n
person_list = computer.getDestinationSectionValueList(portal_type="Person")\n
if person_list:\n
for person in person_list:\n
category_list.extend([x.getReference() for x in person.portal_catalog(\n
portal_type="Open Sale Order",\n
validation_state="validated",\n
destination_decision_relative_url=person.getRelativeUrl())])\n
else:\n
# Global\n
public = 1\n
break\n
return {"Auditor": ["SHADOW-%s" % x.getReference() for x in person_list]}\n
\n
if public:\n
return {"Auditor": ["R-SHADOW"]}\n
elif category_list:\n
return {"Auditor": ["SHADOW-%s" % x for x in category_list]}\n
else:\n
return []\n
return category_list\n
</string>
</value>
</item>
<item>
...
...
@@ -112,7 +97,7 @@ else:\n
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ComputerType_getSecurityCategoryFrom
SaleTradeCondition
</string>
</value>
<value>
<string>
ComputerType_getSecurityCategoryFrom
AllocationScope
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_erp5/bt/revision
View file @
1558d49b
13
\ No newline at end of file
14
\ No newline at end of file
master/bt5/vifib_erp5/bt/revision
View file @
1558d49b
515
\ No newline at end of file
516
\ No newline at end of file
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Computer_getRelatedSaleSupplyLine.xml
deleted
100644 → 0
View file @
c169e70d
<?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>
_body
</string>
</key>
<value>
<string>
computer = context\n
return computer.portal_catalog.getResultValue(\n
portal_type="Sale Supply Line",\n
aggregate_relative_url=computer.getRelativeUrl(),\n
validation_state="validated")\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Computer_getRelatedSaleSupplyLine
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Computer_updateAllocationScope.xml
View file @
1558d49b
...
...
@@ -62,31 +62,28 @@ elif allocation_scope.startswith(\'open\'):\n
else:\n
capacity_scope = \'close\'\n
\n
computer.edit(
\n
allocation_scope=
allocation_scope,\n
capacity_scope=
capacity_scope,\n
)
\n
edit_kw = {
\n
\'allocation_scope\':
allocation_scope,\n
\'capacity_scope\':
capacity_scope,\n
}
\n
\n
sale_supply_line = computer.Computer_getRelatedSaleSupplyLine()\n
sale_trade_condition = sale_supply_line.getParentValue()\n
self_person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
self_email = self_person.getDefaultEmailCoordinateText()\n
if allocation_scope == \'open/public\':\n
# reset friends and update in place\n
sale_trade_condition.edit(\n
subject_list=[\'\'],\n
destination_section=None)\n
edit_kw[\'subject_list\'] = [\'\']\n
edit_kw[\'destination_section\'] = None\n
elif allocation_scope == \'open/personal\':\n
# reset friends to self and update in place\n
sale_trade_condition.edit(\n
subject_list=[self_email],\n
destination_section_value=self_person)\n
edit_kw[\'subject_list\'] = [self_email]\n
edit_kw[\'destination_section_value\'] = self_person\n
else:\n
if self_email not in subject_list:\n
# add self as friend\n
subject_list.append(self_email)\n
sale_trade_condition.edit(\n
subject_list=subject_list)\n
edit_kw[\'subject_list\'] = subject_list\n
\n
computer.edit(**edit_kw)\n
\n
message = context.Base_translateString("Allocation scope updated!")\n
return computer.Base_redirect(keep_items={\'portal_status_message\': message})\n
...
...
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Computer_viewAllocationScopeUpdateDialog/your_subject_list.xml
View file @
1558d49b
...
...
@@ -305,7 +305,7 @@
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: here.
Computer_getRelatedSaleSupplyLine().
getSubjectList()
</string>
</value>
<value>
<string>
python: here.getSubjectList()
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/vifib_web/bt/revision
View file @
1558d49b
476
\ No newline at end of file
477
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment