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
Thomas Gambier
slapos.core
Commits
f37265d6
Commit
f37265d6
authored
Oct 24, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop ERP5Type_getSecurityCategoryFromSoftwareInstance.
Directly access document from local link.
parent
3afac93d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
35 deletions
+36
-35
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Slave%20Instance.xml
...pos_erp5/PortalTypeRolesTemplateItem/Slave%20Instance.xml
+1
-1
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/SlaveInstanceType_getSecurityCategoryFromSoftwareInstance.xml
...eInstanceType_getSecurityCategoryFromSoftwareInstance.xml
+33
-32
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
No files found.
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Slave%20Instance.xml
View file @
f37265d6
...
...
@@ -27,7 +27,7 @@
</role>
<role
id=
'Assignor'
>
<property
id=
'title'
>
Software Instance which provides this Slave Instance
</property>
<property
id=
'base_category_script'
>
ERP5
Type_getSecurityCategoryFromSoftwareInstance
</property>
<property
id=
'base_category_script'
>
SlaveInstance
Type_getSecurityCategoryFromSoftwareInstance
</property>
<multi_property
id=
'base_category'
>
aggregate
</multi_property>
</role>
</type_roles>
\ No newline at end of file
master/bt5/
vifib_erp5/SkinTemplateItem/portal_skins/vifib_core/ERP5
Type_getSecurityCategoryFromSoftwareInstance.xml
→
master/bt5/
slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/SlaveInstance
Type_getSecurityCategoryFromSoftwareInstance.xml
View file @
f37265d6
...
...
@@ -50,46 +50,47 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
# XXX For now, this script requires proxy manager\n
<value>
<string>
"""\n
This script returns a list of dictionaries which represent\n
the security groups which a person is member of. It extracts\n
the categories from the current content. It is useful in the\n
following cases:\n
\n
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n
- calculate a security group based on a given\n
category of the current object (ex. group). This\n
is used for example in ERP5 DMS to calculate\n
document security.\n
\n
if obj is None:\n
return []\n
\n
movement_portal_type = "Sale Packing List Line"\n
portal = obj.getPortalObject()\n
\n
state_list = portal.getPortalCurrentInventoryStateList() + \\\n
portal.getPortalReservedInventoryStateList() + \\\n
portal.getPortalTransitInventoryStateList()\n
- assign local roles to a document based on\n
the person which the object related to through\n
a given base category (ex. destination). This\n
is used for example in ERP5 Project to calculate\n
Task / Task Report security.\n
\n
movement = portal.portal_catalog.getResultValue(\n
portal_type=movement_portal_type,\n
aggregate_uid=obj.getUid(),\n
simulation_state=state_list,\n
)\n
The parameters are\n
\n
if movement is None:\n
return []\n
base_category_list -- list of category values we need to retrieve\n
user_name -- string obtained from getSecurityManager().getUser().getId()\n
object -- object which we want to assign roles to\n
portal_type -- portal type of object\n
\n
computer_partition = movement.getAggregateValue(portal_type="Computer Partition")
\n
software_release = movement.getAggregateValue(portal_type="Software Release")
\n
NOTE: for now, this script requires proxy manager
\n
"""
\n
\n
query = ComplexQuery(\n
Query(aggregate_relative_url=computer_partition.getRelativeUrl()),\n
Query(aggregate_relative_url=software_release.getRelativeUrl()),\n
operator="AND",\n
)\n
category_list = []\n
\n
catalog_result = portal.portal_catalog(portal_type=movement_portal_type,\n
simulation_state=state_list,\n
aggregate_relative_url=query)\n
if obj is None:\n
return []\n
\n
for item in catalog_result:\n
software_instance = item.getAggregateValue(portal_type="Software Instance")\n
partition = obj.getAggregateValue(portal_type="Computer Partition")\n
if partition is not None:\n
software_instance = partition.getPortalObject().portal_catalog.getResultValue(\n
portal_type="Software Instance", validation_state="validated", default_aggregate_uid=partition.getUid())\n
if software_instance is not None:\n
return [{"aggregate": [software_instance.getRelativeUrl()]}]\n
for base_category in base_category_list:\n
category_list.append({base_category: [software_instance.getRelativeUrl()]})\n
\n
return category_list\n
</string>
</value>
</item>
<item>
...
...
@@ -106,7 +107,7 @@ for item in catalog_result:\n
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5
Type_getSecurityCategoryFromSoftwareInstance
</string>
</value>
<value>
<string>
SlaveInstance
Type_getSecurityCategoryFromSoftwareInstance
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_erp5/bt/revision
View file @
f37265d6
9
\ No newline at end of file
10
\ No newline at end of file
master/bt5/vifib_erp5/bt/revision
View file @
f37265d6
511
\ No newline at end of file
512
\ 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