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
Xavier Thompson
slapos.core
Commits
e452daa2
Commit
e452daa2
authored
Apr 11, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_administration: migrate to new business template format
parent
8db76f83
Changes
53
Show whitespace changes
Inline
Side-by-side
Showing
53 changed files
with
609 additions
and
727 deletions
+609
-727
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ActiveProcess_deleteSelf.py
...l_skins/slapos_administration/ActiveProcess_deleteSelf.py
+8
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ActiveProcess_deleteSelf.xml
..._skins/slapos_administration/ActiveProcess_deleteSelf.xml
+0
-12
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_checkUnindexedSecurityUid.py
.../slapos_administration/Alarm_checkUnindexedSecurityUid.py
+18
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_checkUnindexedSecurityUid.xml
...slapos_administration/Alarm_checkUnindexedSecurityUid.xml
+0
-26
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_cleanupBusinessTemplate.py
...ns/slapos_administration/Alarm_cleanupBusinessTemplate.py
+7
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_cleanupBusinessTemplate.xml
...s/slapos_administration/Alarm_cleanupBusinessTemplate.xml
+0
-11
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_initiateActiveProcessCleanup.py
...apos_administration/Alarm_initiateActiveProcessCleanup.py
+15
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_initiateActiveProcessCleanup.xml
...pos_administration/Alarm_initiateActiveProcessCleanup.xml
+0
-19
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_searchDuplicatedSoftwareInstance.py
..._administration/Alarm_searchDuplicatedSoftwareInstance.py
+8
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_searchDuplicatedSoftwareInstance.xml
...administration/Alarm_searchDuplicatedSoftwareInstance.xml
+0
-12
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ERP5Site_getSecurityUidListForRecreateTable.py
...nistration/ERP5Site_getSecurityUidListForRecreateTable.py
+7
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ERP5Site_getSecurityUidListForRecreateTable.xml
...istration/ERP5Site_getSecurityUidListForRecreateTable.xml
+0
-11
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/HostingSubscription_checkDuplicatedInstance.py
...nistration/HostingSubscription_checkDuplicatedInstance.py
+40
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/HostingSubscription_checkDuplicatedInstance.xml
...istration/HostingSubscription_checkDuplicatedInstance.xml
+0
-48
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/SoftwareInstance_destroyAsSelf.py
...s/slapos_administration/SoftwareInstance_destroyAsSelf.py
+25
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/SoftwareInstance_destroyAsSelf.xml
.../slapos_administration/SoftwareInstance_destroyAsSelf.xml
+0
-29
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/TemplateTool_deleteObsoleteTemplateList.py
...administration/TemplateTool_deleteObsoleteTemplateList.py
+61
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/TemplateTool_deleteObsoleteTemplateList.xml
...dministration/TemplateTool_deleteObsoleteTemplateList.xml
+0
-69
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/TemplateTool_unindexDeletedObjectList.py
...s_administration/TemplateTool_unindexDeletedObjectList.py
+27
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/TemplateTool_unindexDeletedObjectList.xml
..._administration/TemplateTool_unindexDeletedObjectList.xml
+0
-31
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/z_refresh_roles_and_users.sql
...skins/slapos_administration/z_refresh_roles_and_users.sql
+6
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/z_refresh_roles_and_users.xml
...skins/slapos_administration/z_refresh_roles_and_users.xml
+0
-13
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/z_search_unindexed_security_uid.sql
...slapos_administration/z_search_unindexed_security_uid.sql
+17
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/z_search_unindexed_security_uid.xml
...slapos_administration/z_search_unindexed_security_uid.xml
+0
-20
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ComputerType_getSecurityCategoryFromAllocationScope.py
...re/ComputerType_getSecurityCategoryFromAllocationScope.py
+31
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ComputerType_getSecurityCategoryFromAllocationScope.xml
...e/ComputerType_getSecurityCategoryFromAllocationScope.xml
+0
-35
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Site_viewWorklist.xml
...teItem/portal_skins/slapos_core/ERP5Site_viewWorklist.xml
+1
-1
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_acquireSecurityFromOwner.py
...al_skins/slapos_core/ERP5Type_acquireSecurityFromOwner.py
+16
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_acquireSecurityFromOwner.xml
...l_skins/slapos_core/ERP5Type_acquireSecurityFromOwner.xml
+0
-20
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryFromAggregateRelatedSoftwareInstanceHostingSubscription.py
...romAggregateRelatedSoftwareInstanceHostingSubscription.py
+22
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryFromAggregateRelatedSoftwareInstanceHostingSubscription.xml
...omAggregateRelatedSoftwareInstanceHostingSubscription.xml
+0
-26
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryFromContentParent.py
...pos_core/ERP5Type_getSecurityCategoryFromContentParent.py
+36
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryFromContentParent.xml
...os_core/ERP5Type_getSecurityCategoryFromContentParent.xml
+0
-40
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryMapping.py
..._skins/slapos_core/ERP5Type_getSecurityCategoryMapping.py
+21
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryMapping.xml
...skins/slapos_core/ERP5Type_getSecurityCategoryMapping.xml
+0
-25
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/InstanceType_getSecurityCategoryFromUser.py
...s/slapos_core/InstanceType_getSecurityCategoryFromUser.py
+41
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/InstanceType_getSecurityCategoryFromUser.xml
.../slapos_core/InstanceType_getSecurityCategoryFromUser.xml
+0
-45
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PartitionType_getSecurityCategoryFromUser.py
.../slapos_core/PartitionType_getSecurityCategoryFromUser.py
+46
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PartitionType_getSecurityCategoryFromUser.xml
...slapos_core/PartitionType_getSecurityCategoryFromUser.xml
+0
-50
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PaymentTransactionType_getSecurityCategoryFromUser.py
...ore/PaymentTransactionType_getSecurityCategoryFromUser.py
+38
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PaymentTransactionType_getSecurityCategoryFromUser.xml
...re/PaymentTransactionType_getSecurityCategoryFromUser.xml
+0
-42
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PayzenEventType_getSecurityCategoryFromUser.py
...lapos_core/PayzenEventType_getSecurityCategoryFromUser.py
+38
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PayzenEventType_getSecurityCategoryFromUser.xml
...apos_core/PayzenEventType_getSecurityCategoryFromUser.xml
+0
-42
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PersonType_getSecurityCategoryFromSelfShadow.py
...apos_core/PersonType_getSecurityCategoryFromSelfShadow.py
+28
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PersonType_getSecurityCategoryFromSelfShadow.xml
...pos_core/PersonType_getSecurityCategoryFromSelfShadow.xml
+0
-32
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/SlaveInstanceType_getSecurityCategoryFromSoftwareInstance.py
...veInstanceType_getSecurityCategoryFromSoftwareInstance.py
+41
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/SlaveInstanceType_getSecurityCategoryFromSoftwareInstance.xml
...eInstanceType_getSecurityCategoryFromSoftwareInstance.xml
+0
-45
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/scripts/Base_recursiveReindexObject.py
...teraction_workflow/scripts/Base_recursiveReindexObject.py
+1
-0
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/scripts/Base_recursiveReindexObject.xml
...eraction_workflow/scripts/Base_recursiveReindexObject.xml
+0
-5
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/scripts/Base_updateAllLocalRoles.py
..._interaction_workflow/scripts/Base_updateAllLocalRoles.py
+5
-0
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/scripts/Base_updateAllLocalRoles.xml
...interaction_workflow/scripts/Base_updateAllLocalRoles.xml
+0
-9
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/scripts/SoftwareInstance_updateComputerPartitionLocalRoles.py
...pts/SoftwareInstance_updateComputerPartitionLocalRoles.py
+5
-0
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/scripts/SoftwareInstance_updateComputerPartitionLocalRoles.xml
...ts/SoftwareInstance_updateComputerPartitionLocalRoles.xml
+0
-9
No files found.
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ActiveProcess_deleteSelf.py
0 → 100644
View file @
e452daa2
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
if
context
.
getPortalType
()
!=
'Active Process'
:
raise
TypeError
(
'Call me on Active Process'
)
context
.
getParentValue
().
deleteContent
(
context
.
getId
())
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ActiveProcess_deleteSelf.xml
View file @
e452daa2
...
...
@@ -48,18 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
if context.getPortalType() != \'Active Process\':\n
raise TypeError(\'Call me on Active Process\')\n
\n
context.getParentValue().deleteContent(context.getId())\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_checkUnindexedSecurityUid.py
0 → 100644
View file @
e452daa2
from
Products.CMFActivity.ActiveResult
import
ActiveResult
portal
=
context
.
getPortalObject
()
active_process
=
context
.
newActiveProcess
().
getRelativeUrl
()
missing_security_uid_list
=
portal
.
z_search_unindexed_security_uid
()
if
len
(
missing_security_uid_list
)
>
0
:
if
fixit
:
summary
=
"Security UIDs were inconsistent (fixing it)"
portal
.
z_refresh_roles_and_users
()
else
:
summary
=
"Security UIDs are inconsistent"
active_process
.
postResult
(
ActiveResult
(
summary
=
summary
,
severity
=
100
,
detail
=
"Missing Security Uid List: %s "
%
missing_security_uid_list
))
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_checkUnindexedSecurityUid.xml
View file @
e452daa2
...
...
@@ -48,32 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from Products.CMFActivity.ActiveResult import ActiveResult\n
\n
portal = context.getPortalObject()\n
active_process = context.newActiveProcess().getRelativeUrl()\n
\n
missing_security_uid_list = portal.z_search_unindexed_security_uid()\n
\n
if len(missing_security_uid_list) >
0:\n
if fixit:\n
summary = "Security UIDs were inconsistent (fixing it)"\n
portal.z_refresh_roles_and_users()\n
else:\n
summary="Security UIDs are inconsistent"\n
\n
active_process.postResult(ActiveResult(\n
summary=summary,\n
severity=100,\n
detail="Missing Security Uid List: %s " % missing_security_uid_list))\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, **kw
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_cleanupBusinessTemplate.py
0 → 100644
View file @
e452daa2
active_process
=
context
.
newActiveProcess
().
getRelativeUrl
()
context
.
portal_templates
.
TemplateTool_deleteObsoleteTemplateList
(
fixit
=
fixit
,
tag
=
tag
,
active_process
=
active_process
)
context
.
portal_templates
.
TemplateTool_unindexDeletedObjectList
(
fixit
=
fixit
,
tag
=
tag
,
active_process
=
active_process
)
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_cleanupBusinessTemplate.xml
View file @
e452daa2
...
...
@@ -48,17 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
active_process = context.newActiveProcess().getRelativeUrl()\n
\n
context.portal_templates.TemplateTool_deleteObsoleteTemplateList(\n
fixit=fixit, tag=tag, active_process=active_process)\n
\n
context.portal_templates.TemplateTool_unindexDeletedObjectList(\n
fixit=fixit, tag=tag, active_process=active_process)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag,fixit, **kw
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_initiateActiveProcessCleanup.py
0 → 100644
View file @
e452daa2
from
Products.ERP5Type.DateUtils
import
addToDate
from
Products.ZSQLCatalog.SQLCatalog
import
Query
from
DateTime
import
DateTime
context
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Active Process'
,
creation_date
=
Query
(
creation_date
=
addToDate
(
DateTime
(),
to_add
=
{
'day'
:
-
21
}),
range
=
"max"
),
method_id
=
'ActiveProcess_deleteSelf'
,
activate_kw
=
{
'tag'
:
tag
}
)
# register activity on alarm object waiting for own tag in order to have only one alarm
# running in same time
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_initiateActiveProcessCleanup.xml
View file @
e452daa2
...
...
@@ -48,25 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from Products.ERP5Type.DateUtils import addToDate\n
from Products.ZSQLCatalog.SQLCatalog import Query\n
from DateTime import DateTime\n
\n
context.portal_catalog.searchAndActivate(\n
portal_type=\'Active Process\',\n
creation_date=Query(creation_date=addToDate(DateTime(), to_add={\'day\': -21}), range="max"),\n
method_id=\'ActiveProcess_deleteSelf\',\n
activate_kw={\'tag\': tag}\n
)\n
\n
\n
# register activity on alarm object waiting for own tag in order to have only one alarm\n
# running in same time\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_searchDuplicatedSoftwareInstance.py
0 → 100644
View file @
e452daa2
active_process
=
context
.
newActiveProcess
().
getRelativeUrl
()
context
.
getPortalObject
().
portal_catalog
.
searchAndActivate
(
method_id
=
'HostingSubscription_checkDuplicatedInstance'
,
method_kw
=
dict
(
fixit
=
fixit
,
active_process
=
active_process
),
activate_kw
=
dict
(
tag
=
tag
,
priority
=
5
),
portal_type
=
"Hosting Subscription"
,
validation_state
=
"validated"
)
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_searchDuplicatedSoftwareInstance.xml
View file @
e452daa2
...
...
@@ -48,18 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
active_process = context.newActiveProcess().getRelativeUrl()\n
\n
context.getPortalObject().portal_catalog.searchAndActivate(\n
method_id=\'HostingSubscription_checkDuplicatedInstance\',\n
method_kw=dict(fixit=fixit, active_process=active_process),\n
activate_kw=dict(tag=tag, priority=5),\n
portal_type="Hosting Subscription", \n
validation_state="validated")\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, **kw
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ERP5Site_getSecurityUidListForRecreateTable.py
0 → 100644
View file @
e452daa2
security_uid_entry_list
=
[]
for
item
in
context
.
getPortalObject
().
portal_catalog
.
getSQLCatalog
().
getRoleAndSecurityUidList
():
if
isinstance
(
item
[
0
],
tuple
):
for
role
in
item
[
0
]:
security_uid_entry_list
.
append
((
item
[
1
],
role
))
return
security_uid_entry_list
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ERP5Site_getSecurityUidListForRecreateTable.xml
View file @
e452daa2
...
...
@@ -48,17 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
security_uid_entry_list = []\n
for item in context.getPortalObject().portal_catalog.getSQLCatalog().getRoleAndSecurityUidList():\n
if isinstance(item[0], tuple):\n
for role in item[0]:\n
security_uid_entry_list.append((item[1], role))\n
\n
return security_uid_entry_list\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/HostingSubscription_checkDuplicatedInstance.py
0 → 100644
View file @
e452daa2
from
Products.CMFActivity.ActiveResult
import
ActiveResult
portal
=
context
.
getPortalObject
()
software_instance_list
=
context
.
getSpecialiseRelatedValueList
(
portal_type
=
[
"Slave Instance"
,
"Software Instance"
])
if
len
(
software_instance_list
)
==
1
:
return
title_dict
=
{}
active_process
=
portal
.
restrictedTraverse
(
active_process
)
for
software_instance
in
software_instance_list
:
if
software_instance
.
getSlapState
()
==
"destroy_requested"
:
continue
title
=
software_instance
.
getTitle
()
if
title
in
title_dict
:
title_dict
[
title
].
append
(
software_instance
.
getObject
())
else
:
title_dict
[
title
]
=
[
software_instance
.
getObject
()]
for
title
in
title_dict
:
if
len
(
title_dict
[
title
])
>
1
:
if
fixit
:
for
software_instance
in
title_dict
[
title
]:
if
len
(
software_instance
.
getAggregate
([]))
==
0
:
active_process
.
postResult
(
ActiveResult
(
summary
=
"Fixing %s which duplication and is not allocated (%s)"
\
%
(
software_instance
.
getRelativeUrl
(),
context
.
getRelativeUrl
()),
severity
=
0
,
detail
=
""
))
software_instance
.
activate
().
SoftwareInstance_destroyAsSelf
()
else
:
active_process
.
postResult
(
ActiveResult
(
summary
=
"%s has duplication"
%
context
.
getRelativeUrl
(),
severity
=
100
,
detail
=
"%s has duplication on %s (%s)"
%
(
context
.
getRelativeUrl
(),
title
,
len
(
title_dict
[
title
]))))
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/HostingSubscription_checkDuplicatedInstance.xml
View file @
e452daa2
...
...
@@ -48,54 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from Products.CMFActivity.ActiveResult import ActiveResult\n
portal = context.getPortalObject()\n
\n
software_instance_list = context.getSpecialiseRelatedValueList(\n
portal_type=["Slave Instance", "Software Instance"])\n
\n
if len(software_instance_list) == 1:\n
return \n
\n
title_dict = {}\n
\n
active_process = portal.restrictedTraverse(active_process)\n
\n
for software_instance in software_instance_list:\n
if software_instance.getSlapState() == "destroy_requested":\n
continue\n
\n
title = software_instance.getTitle() \n
if title in title_dict:\n
title_dict[title].append(software_instance.getObject())\n
else:\n
title_dict[title] = [software_instance.getObject()]\n
\n
\n
for title in title_dict:\n
if len(title_dict[title]) >
1:\n
if fixit:\n
for software_instance in title_dict[title]:\n
if len(software_instance.getAggregate([])) == 0:\n
active_process.postResult(ActiveResult(\n
summary="Fixing %s which duplication and is not allocated (%s)" \\\n
% (software_instance.getRelativeUrl(), context.getRelativeUrl()),\n
severity=0,\n
detail=""))\n
software_instance.activate().SoftwareInstance_destroyAsSelf() \n
else:\n
active_process.postResult(ActiveResult(\n
summary="%s has duplication" % context.getRelativeUrl(),\n
severity=100,\n
detail="%s has duplication on %s (%s)" % (context.getRelativeUrl(), title, len(title_dict[title]))))\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
fixit, active_process
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/SoftwareInstance_destroyAsSelf.py
0 → 100644
View file @
e452daa2
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
if
context
.
getAggregate
()
is
not
None
:
raise
ValueError
(
'Do not destroy allocated instances automatically!'
)
# Change desired state
promise_kw
=
{
'instance_xml'
:
context
.
getTextContent
(),
'software_type'
:
context
.
getSourceReference
(),
'sla_xml'
:
context
.
getSlaXml
(),
'software_release'
:
context
.
getUrlString
(),
'shared'
:
context
.
getPortalType
()
==
"Slave Instance"
,
}
request_software_instance_url
=
context
.
getRelativeUrl
()
context
.
REQUEST
.
set
(
'request_instance'
,
context
)
context
.
requestDestroy
(
**
promise_kw
)
title
=
context
.
getTitle
()
context
.
setTitle
(
title
+
"_renamed_and_destroyed"
)
context
.
REQUEST
.
set
(
'request_instance'
,
None
)
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/SoftwareInstance_destroyAsSelf.xml
View file @
e452daa2
...
...
@@ -48,35 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
if context.getAggregate() is not None:\n
raise ValueError(\'Do not destroy allocated instances automatically!\')\n
\n
# Change desired state\n
promise_kw = {\n
\'instance_xml\': context.getTextContent(),\n
\'software_type\': context.getSourceReference(),\n
\'sla_xml\': context.getSlaXml(),\n
\'software_release\': context.getUrlString(),\n
\'shared\': context.getPortalType()=="Slave Instance",\n
}\n
\n
request_software_instance_url = context.getRelativeUrl()\n
context.REQUEST.set(\'request_instance\', context)\n
\n
context.requestDestroy(**promise_kw)\n
\n
title = context.getTitle()\n
context.setTitle(title + "_renamed_and_destroyed")\n
\n
context.REQUEST.set(\'request_instance\', None)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/TemplateTool_deleteObsoleteTemplateList.py
0 → 100644
View file @
e452daa2
"""
This is a custom version, because we don't want to definitly delete the objects
but only change state to 'deleted'.
This script can also include custom deletions, which comes from legacy
implementations and/or garbage left behind from upgrader.
"""
from
Products.CMFActivity.ActiveResult
import
ActiveResult
portal
=
context
.
getPortalObject
()
active_process
=
portal
.
restrictedTraverse
(
active_process
)
portal_templates
=
context
.
getPortalObject
().
portal_templates
delete_list
=
[]
bt_list
=
portal_templates
.
objectValues
()
for
bt
in
bt_list
:
bt_id
=
bt
.
getId
()
installation_state
=
bt
.
getInstallationState
()
if
installation_state
in
(
'replaced'
):
if
fixit
:
bt
.
getObject
().
delete
()
summary
=
"%s was deleted."
%
bt
.
getRelativeUrl
()
else
:
summary
=
"%s is going to be deleted."
%
bt
.
getRelativeUrl
()
active_process
.
postResult
(
ActiveResult
(
summary
=
summary
,
severity
=
2
,
detail
=
""
))
elif
installation_state
==
'not_installed'
:
title
=
bt
.
getTitle
()
modification_date
=
bt
.
getModificationDate
()
for
x
in
bt_list
:
if
(
x
.
getTitle
()
==
title
and
x
.
getInstallationState
()
in
(
'installed'
,
'not_installed'
)
and
x
.
getModificationDate
()
>
modification_date
):
if
fixit
:
bt
.
getObject
().
delete
()
summary
=
"%s was deleted."
%
bt
.
getRelativeUrl
()
else
:
summary
=
"%s is going to be deleted."
%
bt
.
getRelativeUrl
()
active_process
.
postResult
(
ActiveResult
(
summary
=
summary
,
severity
=
2
,
detail
=
""
))
break
elif
bt
.
getTitle
().
startswith
(
"vifib_"
)
and
bt
.
getVersion
()
==
"999"
:
delete_list
.
append
(
bt_id
)
if
len
(
delete_list
):
if
fixit
:
context
.
portal_templates
.
manage_delObjects
(
delete_list
)
summary
=
"The bt5 with the followed ids were deleted forever: %s"
%
delete_list
else
:
summary
=
"The bt5 with the followed ids are going to be deleted forever: %s"
%
delete_list
active_process
.
postResult
(
ActiveResult
(
summary
=
summary
,
severity
=
2
,
detail
=
""
))
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/TemplateTool_deleteObsoleteTemplateList.xml
View file @
e452daa2
...
...
@@ -48,75 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
"""\n
This is a custom version, because we don\'t want to definitly delete the objects\n
but only change state to \'deleted\'.\n
\n
This script can also include custom deletions, which comes from legacy \n
implementations and/or garbage left behind from upgrader.\n
"""\n
\n
from Products.CMFActivity.ActiveResult import ActiveResult\n
portal = context.getPortalObject()\n
active_process = portal.restrictedTraverse(active_process)\n
\n
\n
portal_templates = context.getPortalObject().portal_templates\n
delete_list = []\n
bt_list = portal_templates.objectValues()\n
for bt in bt_list:\n
bt_id = bt.getId()\n
installation_state = bt.getInstallationState()\n
if installation_state in (\'replaced\'):\n
if fixit:\n
bt.getObject().delete()\n
summary="%s was deleted." % bt.getRelativeUrl()\n
else:\n
summary="%s is going to be deleted." % bt.getRelativeUrl()\n
active_process.postResult(ActiveResult(\n
summary=summary,\n
severity=2,\n
detail=""))\n
\n
elif installation_state == \'not_installed\':\n
title = bt.getTitle()\n
modification_date = bt.getModificationDate()\n
for x in bt_list:\n
if (x.getTitle() == title and\n
x.getInstallationState() in (\'installed\', \'not_installed\') and\n
x.getModificationDate() >
modification_date):\n
if fixit:\n
bt.getObject().delete()\n
summary="%s was deleted." % bt.getRelativeUrl()\n
else:\n
summary="%s is going to be deleted." % bt.getRelativeUrl()\n
active_process.postResult(ActiveResult(\n
summary=summary,\n
severity=2,\n
detail=""))\n
break\n
\n
elif bt.getTitle().startswith("vifib_") and bt.getVersion() == "999": \n
delete_list.append(bt_id)\n
\n
if len(delete_list):\n
if fixit:\n
context.portal_templates.manage_delObjects(delete_list)\n
summary="The bt5 with the followed ids were deleted forever: %s" % delete_list\n
else:\n
summary="The bt5 with the followed ids are going to be deleted forever: %s" % delete_list\n
active_process.postResult(ActiveResult(\n
summary=summary,\n
severity=2,\n
detail=""))\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, active_process, **kw
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/TemplateTool_unindexDeletedObjectList.py
0 → 100644
View file @
e452daa2
"""
Unindexed deleted business template in order to the manager don't see it.
This is script is probably a workarround.
"""
from
Products.CMFActivity.ActiveResult
import
ActiveResult
portal
=
context
.
getPortalObject
()
active_process
=
portal
.
restrictedTraverse
(
active_process
)
unindexed_list
=
[]
for
i
in
context
.
portal_templates
.
portal_catalog
(
portal_type
=
"Business Template"
):
if
i
.
getInstallationState
()
==
"deleted"
:
unindexed_list
.
append
(
i
.
path
)
if
fixit
:
context
.
portal_catalog
.
activate
(
activity
=
"SQLQueue"
).
unindexObject
(
uid
=
i
.
uid
)
if
len
(
unindexed_list
):
if
fixit
:
summary
=
"The followed bt5 were unindexed: %s"
%
unindexed_list
else
:
summary
=
"The followed bt5 are going to be unindexed: %s"
%
unindexed_list
active_process
.
postResult
(
ActiveResult
(
summary
=
summary
,
severity
=
2
,
detail
=
""
))
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/TemplateTool_unindexDeletedObjectList.xml
View file @
e452daa2
...
...
@@ -48,37 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
Unindexed deleted business template in order to the manager don\'t see it.\n
\n
This is script is probably a workarround.\n
"""\n
\n
from Products.CMFActivity.ActiveResult import ActiveResult\n
portal = context.getPortalObject()\n
active_process = portal.restrictedTraverse(active_process)\n
\n
unindexed_list = []\n
for i in context.portal_templates.portal_catalog(portal_type="Business Template"):\n
if i.getInstallationState() == "deleted":\n
unindexed_list.append(i.path)\n
if fixit:\n
context.portal_catalog.activate(\n
activity="SQLQueue").unindexObject(uid=i.uid)\n
\n
if len(unindexed_list):\n
if fixit:\n
summary="The followed bt5 were unindexed: %s" % unindexed_list\n
else:\n
summary="The followed bt5 are going to be unindexed: %s" % unindexed_list\n
active_process.postResult(ActiveResult(\n
summary=summary,\n
severity=2,\n
detail=""))\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, active_process, **kw
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/z_refresh_roles_and_users.sql
0 → 100644
View file @
e452daa2
DELETE
FROM
roles_and_users
<
dtml
-
var
sql_delimiter
>
INSERT
INTO
roles_and_users
(
uid
,
allowedRolesAndUsers
)
VALUES
<
dtml
-
in
prefix
=
"role"
expr
=
"ERP5Site_getSecurityUidListForRecreateTable()"
>
(
<
dtml
-
sqlvar
sequence
-
key
type
=
"int"
>
,
<
dtml
-
sqlvar
expr
=
"role_item"
type
=
"string"
>
)
<
dtml
-
if
sequence
-
end
><
dtml
-
else
>
,
</
dtml
-
if
>
</
dtml
-
in
>
\ No newline at end of file
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/z_refresh_roles_and_users.xml
View file @
e452daa2
...
...
@@ -24,19 +24,6 @@
<key>
<string>
id
</string>
</key>
<value>
<string>
z_refresh_roles_and_users
</string>
</value>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
DELETE FROM roles_and_users\n
<dtml-var sql_delimiter>
\n
INSERT INTO roles_and_users (uid, allowedRolesAndUsers) VALUES\n
<dtml-in
prefix=
"role"
expr=
"ERP5Site_getSecurityUidListForRecreateTable()"
>
\n
(
<dtml-sqlvar
sequence-key
type=
"int"
>
,
<dtml-sqlvar
expr=
"role_item"
type=
"string"
>
)
<dtml-if
sequence-end
><dtml-else>
,
</dtml-if>
\n
</dtml-in>
]]>
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/z_search_unindexed_security_uid.sql
0 → 100644
View file @
e452daa2
select
distinct
catalog
.
security_uid
,
path
,
portal_type
,
uid
from
catalog
where
portal_type
!=
"Business Template"
and
path
not
like
"deleted"
and
not
exists
(
select
roles_and_users
.
uid
from
roles_and_users
where
catalog
.
security_uid
=
roles_and_users
.
uid
)
\ No newline at end of file
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/z_search_unindexed_security_uid.xml
View file @
e452daa2
...
...
@@ -97,26 +97,6 @@
<key>
<string>
id
</string>
</key>
<value>
<string>
z_search_unindexed_security_uid
</string>
</value>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string>
select \n
distinct catalog.security_uid, path, portal_type, uid \n
\n
from \n
catalog \n
\n
where \n
portal_type != "Business Template" \n
and path not like "deleted" \n
and not exists (\n
select \n
roles_and_users.uid \n
from \n
roles_and_users \n
where \n
catalog.security_uid = roles_and_users.uid\n
)
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ComputerType_getSecurityCategoryFromAllocationScope.py
0 → 100644
View file @
e452daa2
# XXX For now, this script requires proxy manager
# base_category_list : list of category values we need to retrieve
# user_name : string obtained from getSecurityManager().getUser().getUserName() [NuxUserGroup]
# or from getSecurityManager().getUser().getId() [PluggableAuthService with ERP5GroupManager]
# object : object which we want to assign roles to.
# portal_type : portal type of object
# must always return a list of dicts
if
obj
is
None
:
return
[]
portal
=
obj
.
getPortalObject
()
computer
=
obj
category_list
=
[]
scope
=
computer
.
getAllocationScope
()
if
scope
==
'open/public'
:
return
{
"Auditor"
:
[
"R-SHADOW-PERSON"
]}
elif
scope
==
'open/personal'
:
person
=
computer
.
getSourceAdministrationValue
(
portal_type
=
"Person"
)
if
person
is
not
None
:
return
{
"Auditor"
:
[
"SHADOW-%s"
%
person
.
getReference
()]}
elif
scope
==
'open/friend'
:
person_list
=
computer
.
getDestinationSectionValueList
(
portal_type
=
"Person"
)
if
person_list
:
return
{
"Auditor"
:
[
"SHADOW-%s"
%
x
.
getReference
()
for
x
in
person_list
]}
return
category_list
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ComputerType_getSecurityCategoryFromAllocationScope.xml
View file @
e452daa2
...
...
@@ -48,41 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
# XXX For now, this script requires proxy manager\n
\n
# base_category_list : list of category values we need to retrieve\n
# user_name : string obtained from getSecurityManager().getUser().getUserName() [NuxUserGroup]\n
# or from getSecurityManager().getUser().getId() [PluggableAuthService with ERP5GroupManager]\n
# object : object which we want to assign roles to.\n
# portal_type : portal type of object\n
\n
# must always return a list of dicts\n
\n
if obj is None:\n
return []\n
\n
portal = obj.getPortalObject()\n
computer = obj\n
\n
category_list = []\n
\n
scope = computer.getAllocationScope()\n
if scope == \'open/public\':\n
return {"Auditor": ["R-SHADOW-PERSON"]}\n
elif scope == \'open/personal\':\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
return {"Auditor": ["SHADOW-%s" % x.getReference() for x in person_list]}\n
\n
return category_list\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
base_category_list, user_name, obj, portal_type
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Site_viewWorklist.xml
View file @
e452daa2
...
...
@@ -2,7 +2,7 @@
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Form"
module=
"erp5.portal_type"
/>
<global
name=
"
ERP5
Form"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_acquireSecurityFromOwner.py
0 → 100644
View file @
e452daa2
"""
WARNING: this script requires proxy manager
This script tries to acquire category values from other objects
base_category_list - list of category values we need to retrieve
object - object which we want to assign roles to.
"""
result_list
=
[]
user_name
=
object
.
Base_getOwnerId
()
# XXX Hardcoded role
return
{
'Assignee'
:
[
user_name
],
}
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_acquireSecurityFromOwner.xml
View file @
e452daa2
...
...
@@ -48,26 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
WARNING: this script requires proxy manager\n
\n
This script tries to acquire category values from other objects\n
\n
base_category_list - list of category values we need to retrieve\n
object - object which we want to assign roles to.\n
"""\n
\n
result_list = []\n
user_name = object.Base_getOwnerId()\n
\n
# XXX Hardcoded role\n
return {\n
\'Assignee\': [user_name],\n
}\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
base_category_list, user_name, object, portal_type
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryFromAggregateRelatedSoftwareInstanceHostingSubscription.py
0 → 100644
View file @
e452daa2
"""This scripts set ups role of aggregate related Software Instance
This is simple implementation, instead of generic related category with portal type,
which would not be configurable in Role Definition anyway."""
category_list
=
[]
if
obj
is
None
:
return
[]
software_instance_list
=
obj
.
getPortalObject
().
portal_catalog
(
portal_type
=
'Software Instance'
,
default_aggregate_uid
=
obj
.
getUid
(),
limit
=
2
)
if
len
(
software_instance_list
)
==
1
:
hosting_subscription
=
software_instance_list
[
0
].
getSpecialise
(
portal_type
=
'Hosting Subscription'
)
for
base_category
in
base_category_list
:
category_list
.
append
({
base_category
:
hosting_subscription
})
return
category_list
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryFromAggregateRelatedSoftwareInstanceHostingSubscription.xml
View file @
e452daa2
...
...
@@ -48,32 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""This scripts set ups role of aggregate related Software Instance\n
\n
This is simple implementation, instead of generic related category with portal type,\n
which would not be configurable in Role Definition anyway."""\n
\n
category_list = []\n
\n
if obj is None:\n
return []\n
\n
software_instance_list = obj.getPortalObject().portal_catalog(\n
portal_type=\'Software Instance\',\n
default_aggregate_uid=obj.getUid(),\n
limit=2\n
)\n
\n
if len(software_instance_list) == 1:\n
hosting_subscription = software_instance_list[0].getSpecialise(portal_type=\'Hosting Subscription\')\n
for base_category in base_category_list:\n
category_list.append({base_category: hosting_subscription})\n
\n
return category_list\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
base_category_list, user_name, obj, portal_type
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryFromContentParent.py
0 → 100644
View file @
e452daa2
"""
This script returns a list of dictionaries which represent
the security groups which a person is member of. It extracts
the categories from the current content. It is useful in the
following cases:
- calculate a security group based on a given
category of the current object (ex. group). This
is used for example in ERP5 DMS to calculate
document security.
- assign local roles to a document based on
the person which the object related to through
a given base category (ex. destination). This
is used for example in ERP5 Project to calculate
Task / Task Report security.
The parameters are
base_category_list -- list of category values we need to retrieve
user_name -- string obtained from getSecurityManager().getUser().getId()
object -- object which we want to assign roles to
portal_type -- portal type of object
NOTE: for now, this script requires proxy manager
"""
category_list
=
[]
if
obj
is
None
:
return
[]
for
base_category
in
base_category_list
:
category_list
.
append
({
base_category
:
[
x
.
getParentValue
().
getRelativeUrl
()
for
x
in
obj
.
getValueList
(
base_category
)]})
return
category_list
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryFromContentParent.xml
View file @
e452daa2
...
...
@@ -48,46 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<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
- 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
- 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
The parameters are\n
\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
NOTE: for now, this script requires proxy manager\n
"""\n
\n
category_list = []\n
\n
if obj is None:\n
return []\n
\n
for base_category in base_category_list:\n
category_list.append({base_category: [x.getParentValue().getRelativeUrl() for x in obj.getValueList(base_category)]})\n
\n
return category_list\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
base_category_list, user_name, obj, portal_type
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryMapping.py
0 → 100644
View file @
e452daa2
"""
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'
,
[
'group'
]),
(
'ERP5Type_getSecurityCategoryFromAssignment'
,
[
'role'
]),
# Computer security
(
'ERP5Type_getComputerSecurityCategory'
,
[
'role'
]),
# Instance security
(
'ERP5Type_getSoftwareInstanceSecurityCategory'
,
[
'role'
]),
(
'ERP5Type_getSoftwareInstanceSecurityCategory'
,
[
'aggregate'
]),
)
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryMapping.xml
View file @
e452daa2
...
...
@@ -48,31 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
Core security script - defines the way to get security groups of the current user.\n
\n
WARNING: providing such script in erp5_dms could be dangerous\n
if this conflicts with an existing production site which uses\n
deprecated ERP5Type_asSecurityGroupIdList\n
"""\n
\n
return (\n
# Person security\n
(\'ERP5Type_getSecurityCategoryFromAssignment\', [\'group\']),\n
(\'ERP5Type_getSecurityCategoryFromAssignment\', [\'role\']),\n
\n
# Computer security\n
(\'ERP5Type_getComputerSecurityCategory\', [\'role\']),\n
\n
# Instance security\n
(\'ERP5Type_getSoftwareInstanceSecurityCategory\', [\'role\']),\n
(\'ERP5Type_getSoftwareInstanceSecurityCategory\', [\'aggregate\']),\n
\n
)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/InstanceType_getSecurityCategoryFromUser.py
0 → 100644
View file @
e452daa2
"""
This script returns a list of dictionaries which represent
the security groups which a person is member of. It extracts
the categories from the current content. It is useful in the
following cases:
- calculate a security group based on a given
category of the current object (ex. group). This
is used for example in ERP5 DMS to calculate
document security.
- assign local roles to a document based on
the person which the object related to through
a given base category (ex. destination). This
is used for example in ERP5 Project to calculate
Task / Task Report security.
The parameters are
base_category_list -- list of category values we need to retrieve
user_name -- string obtained from getSecurityManager().getUser().getId()
object -- object which we want to assign roles to
portal_type -- portal type of object
NOTE: for now, this script requires proxy manager
"""
category_list
=
[]
if
obj
is
None
:
return
[]
hosting_subscription
=
obj
.
getSpecialiseValue
(
portal_type
=
"Hosting Subscription"
)
if
hosting_subscription
is
not
None
:
person
=
hosting_subscription
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
if
person
is
not
None
:
for
base_category
in
base_category_list
:
category_list
.
append
({
base_category
:
[
person
.
getRelativeUrl
()]})
return
category_list
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/InstanceType_getSecurityCategoryFromUser.xml
View file @
e452daa2
...
...
@@ -48,51 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<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
- 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
- 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
The parameters are\n
\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
NOTE: for now, this script requires proxy manager\n
"""\n
\n
category_list = []\n
\n
if obj is None:\n
return []\n
\n
hosting_subscription = obj.getSpecialiseValue(portal_type="Hosting Subscription")\n
if hosting_subscription is not None:\n
person = hosting_subscription.getDestinationSectionValue(portal_type="Person")\n
if person is not None:\n
\n
for base_category in base_category_list:\n
category_list.append({base_category: [person.getRelativeUrl()]})\n
\n
return category_list\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
base_category_list, user_name, obj, portal_type
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PartitionType_getSecurityCategoryFromUser.py
0 → 100644
View file @
e452daa2
"""
This script returns a list of dictionaries which represent
the security groups which a person is member of. It extracts
the categories from the current content. It is useful in the
following cases:
- calculate a security group based on a given
category of the current object (ex. group). This
is used for example in ERP5 DMS to calculate
document security.
- assign local roles to a document based on
the person which the object related to through
a given base category (ex. destination). This
is used for example in ERP5 Project to calculate
Task / Task Report security.
The parameters are
base_category_list -- list of category values we need to retrieve
user_name -- string obtained from getSecurityManager().getUser().getId()
object -- object which we want to assign roles to
portal_type -- portal type of object
NOTE: for now, this script requires proxy manager
"""
category_list
=
[]
if
obj
is
None
:
return
[]
partition
=
obj
for
instance
in
partition
.
getPortalObject
().
portal_catalog
(
portal_type
=
[
"Software Instance"
,
"Slave Instance"
],
validation_state
=
"validated"
,
default_aggregate_uid
=
partition
.
getUid
()):
if
instance
is
not
None
:
hosting_subscription
=
instance
.
getSpecialiseValue
(
portal_type
=
"Hosting Subscription"
)
if
hosting_subscription
is
not
None
:
person
=
hosting_subscription
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
if
person
is
not
None
:
for
base_category
in
base_category_list
:
category_list
.
append
({
base_category
:
[
person
.
getRelativeUrl
()]})
return
category_list
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PartitionType_getSecurityCategoryFromUser.xml
View file @
e452daa2
...
...
@@ -48,56 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<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
- 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
- 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
The parameters are\n
\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
NOTE: for now, this script requires proxy manager\n
"""\n
\n
category_list = []\n
\n
if obj is None:\n
return []\n
\n
partition = obj\n
for instance in partition.getPortalObject().portal_catalog(\n
portal_type=["Software Instance", "Slave Instance"],\n
validation_state="validated",\n
default_aggregate_uid=partition.getUid()):\n
if instance is not None:\n
hosting_subscription = instance.getSpecialiseValue(portal_type="Hosting Subscription")\n
if hosting_subscription is not None:\n
person = hosting_subscription.getDestinationSectionValue(portal_type="Person")\n
if person is not None:\n
for base_category in base_category_list:\n
category_list.append({base_category: [person.getRelativeUrl()]})\n
\n
return category_list\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
base_category_list, user_name, obj, portal_type
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PaymentTransactionType_getSecurityCategoryFromUser.py
0 → 100644
View file @
e452daa2
"""
This script returns a list of dictionaries which represent
the security groups which a person is member of. It extracts
the categories from the current content. It is useful in the
following cases:
- calculate a security group based on a given
category of the current object (ex. group). This
is used for example in ERP5 DMS to calculate
document security.
- assign local roles to a document based on
the person which the object related to through
a given base category (ex. destination). This
is used for example in ERP5 Project to calculate
Task / Task Report security.
The parameters are
base_category_list -- list of category values we need to retrieve
user_name -- string obtained from getSecurityManager().getUser().getId()
object -- object which we want to assign roles to
portal_type -- portal type of object
NOTE: for now, this script requires proxy manager
"""
category_list
=
[]
if
obj
is
None
:
return
[]
person
=
obj
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
if
person
is
not
None
:
for
base_category
in
base_category_list
:
return
{
"Auditor"
:
[
"SHADOW-%s"
%
person
.
getReference
()]}
return
category_list
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PaymentTransactionType_getSecurityCategoryFromUser.xml
View file @
e452daa2
...
...
@@ -48,48 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<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
- 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
- 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
The parameters are\n
\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
NOTE: for now, this script requires proxy manager\n
"""\n
\n
category_list = []\n
\n
if obj is None:\n
return []\n
\n
person = obj.getDestinationSectionValue(portal_type="Person")\n
if person is not None:\n
for base_category in base_category_list:\n
return {"Auditor": ["SHADOW-%s" % person.getReference()]}\n
\n
return category_list\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
base_category_list, user_name, obj, portal_type
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PayzenEventType_getSecurityCategoryFromUser.py
0 → 100644
View file @
e452daa2
"""
This script returns a list of dictionaries which represent
the security groups which a person is member of. It extracts
the categories from the current content. It is useful in the
following cases:
- calculate a security group based on a given
category of the current object (ex. group). This
is used for example in ERP5 DMS to calculate
document security.
- assign local roles to a document based on
the person which the object related to through
a given base category (ex. destination). This
is used for example in ERP5 Project to calculate
Task / Task Report security.
The parameters are
base_category_list -- list of category values we need to retrieve
user_name -- string obtained from getSecurityManager().getUser().getId()
object -- object which we want to assign roles to
portal_type -- portal type of object
NOTE: for now, this script requires proxy manager
"""
category_list
=
[]
if
obj
is
None
:
return
[]
person
=
obj
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
if
person
is
not
None
:
for
base_category
in
base_category_list
:
return
{
"Assignee"
:
[
"SHADOW-%s"
%
person
.
getReference
()]}
return
category_list
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PayzenEventType_getSecurityCategoryFromUser.xml
View file @
e452daa2
...
...
@@ -48,48 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<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
- 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
- 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
The parameters are\n
\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
NOTE: for now, this script requires proxy manager\n
"""\n
\n
category_list = []\n
\n
if obj is None:\n
return []\n
\n
person = obj.getDestinationSectionValue(portal_type="Person")\n
if person is not None:\n
for base_category in base_category_list:\n
return {"Assignee": ["SHADOW-%s" % person.getReference()]}\n
\n
return category_list\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
base_category_list, user_name, obj, portal_type
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PersonType_getSecurityCategoryFromSelfShadow.py
0 → 100644
View file @
e452daa2
"""
This script returns a list of dictionaries which represent
the security groups which a person is member of. It extracts
the categories from the current content and associates
it to a given base_category. It is useful in the
following cases:
- calculate a security group based current object
in the context of a base category (ex. source_project).
This is used for example in ERP5 DMS to calculate
project security.
The parameters are
base_category_list -- list of category values we need to retrieve
user_name -- string obtained from getSecurityManager().getUser().getId()
object -- object which we want to assign roles to
portal_type -- portal type of object
NOTE: for now, this script requires proxy manager
"""
category_list
=
[]
if
obj
is
None
:
return
[]
return
{
'Auditor'
:
[
'SHADOW-%s'
%
obj
.
getReference
()]}
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PersonType_getSecurityCategoryFromSelfShadow.xml
View file @
e452daa2
...
...
@@ -48,38 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<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 and associates\n
it to a given base_category. It is useful in the\n
following cases:\n
\n
- calculate a security group based current object \n
in the context of a base category (ex. source_project).\n
This is used for example in ERP5 DMS to calculate\n
project security.\n
\n
The parameters are\n
\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
NOTE: for now, this script requires proxy manager\n
"""\n
\n
category_list = []\n
\n
if obj is None:\n
return []\n
\n
return {\'Auditor\': [\'SHADOW-%s\' % obj.getReference()]}\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
base_category_list, user_name, obj, portal_type
</string>
</value>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/SlaveInstanceType_getSecurityCategoryFromSoftwareInstance.py
0 → 100644
View file @
e452daa2
"""
This script returns a list of dictionaries which represent
the security groups which a person is member of. It extracts
the categories from the current content. It is useful in the
following cases:
- calculate a security group based on a given
category of the current object (ex. group). This
is used for example in ERP5 DMS to calculate
document security.
- assign local roles to a document based on
the person which the object related to through
a given base category (ex. destination). This
is used for example in ERP5 Project to calculate
Task / Task Report security.
The parameters are
base_category_list -- list of category values we need to retrieve
user_name -- string obtained from getSecurityManager().getUser().getId()
object -- object which we want to assign roles to
portal_type -- portal type of object
NOTE: for now, this script requires proxy manager
"""
category_list
=
[]
if
obj
is
None
:
return
[]
partition
=
obj
.
getAggregateValue
(
portal_type
=
"Computer Partition"
)
if
partition
is
not
None
:
software_instance
=
partition
.
getPortalObject
().
portal_catalog
.
getResultValue
(
portal_type
=
"Software Instance"
,
validation_state
=
"validated"
,
default_aggregate_uid
=
partition
.
getUid
())
if
software_instance
is
not
None
:
for
base_category
in
base_category_list
:
category_list
.
append
({
base_category
:
[
software_instance
.
getRelativeUrl
()]})
return
category_list
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/SlaveInstanceType_getSecurityCategoryFromSoftwareInstance.xml
View file @
e452daa2
...
...
@@ -48,51 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<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
- 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
- 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
The parameters are\n
\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
NOTE: for now, this script requires proxy manager\n
"""\n
\n
category_list = []\n
\n
if obj is None:\n
return []\n
\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
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>
<key>
<string>
_params
</string>
</key>
<value>
<string>
base_category_list, user_name, obj, portal_type
</string>
</value>
...
...
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/scripts/Base_recursiveReindexObject.py
0 → 100644
View file @
e452daa2
state_change
[
'object'
].
recursiveReindexObject
()
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/scripts/Base_recursiveReindexObject.xml
View file @
e452daa2
...
...
@@ -48,11 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
state_change[\'object\'].recursiveReindexObject()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/scripts/Base_updateAllLocalRoles.py
0 → 100644
View file @
e452daa2
"""
This script updates all local roles on the object. It requires Assignor
proxy role since it may be called by owner in draft state.
"""
state_change
[
'object'
].
updateLocalRolesOnSecurityGroups
()
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/scripts/Base_updateAllLocalRoles.xml
View file @
e452daa2
...
...
@@ -48,15 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
This script updates all local roles on the object. It requires Assignor\n
proxy role since it may be called by owner in draft state.\n
"""\n
state_change[\'object\'].updateLocalRolesOnSecurityGroups()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/scripts/SoftwareInstance_updateComputerPartitionLocalRoles.py
0 → 100644
View file @
e452daa2
portal_type_list
=
[
'Computer Partition'
]
software_instance
=
state_change
[
'object'
]
after_tag
=
(
software_instance
.
getPath
(),
(
'immediateReindexObject'
,
'recursiveImmediateReindexObject'
))
for
object_
in
software_instance
.
getAggregateValueList
(
portal_type
=
portal_type_list
):
object_
.
activate
(
after_path_and_method_id
=
after_tag
).
updateLocalRolesOnSecurityGroups
()
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/scripts/SoftwareInstance_updateComputerPartitionLocalRoles.xml
View file @
e452daa2
...
...
@@ -48,15 +48,6 @@
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal_type_list = [\'Computer Partition\']\n
software_instance = state_change[\'object\']\n
after_tag = (software_instance.getPath(), (\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))\n
for object_ in software_instance.getAggregateValueList(portal_type=portal_type_list):\n
object_.activate(after_path_and_method_id=after_tag).updateLocalRolesOnSecurityGroups()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
...
...
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