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
Labels
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
b8d6257d
Commit
b8d6257d
authored
Jun 22, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: Speed up query when searchAndActivate
Use child_aggregate is too slow on larger sets.
parent
eb7d7ded
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/Base_updateSlapOSLocalRolesOnSecurityGroups.py
...lapos_core/Base_updateSlapOSLocalRolesOnSecurityGroups.py
+8
-4
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/scripts/InternalPackingListLine_updateAggregateLocalRoles.py
...ipts/InternalPackingListLine_updateAggregateLocalRoles.py
+4
-5
No files found.
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/Base_updateSlapOSLocalRolesOnSecurityGroups.py
View file @
b8d6257d
from
zExceptions
import
Unauthorized
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
raise
Unauthorized
raise
Unauthorized
context
.
updateLocalRolesOnSecurityGroups
()
if
context
.
getPortalType
()
in
[
'Support Request'
,
'Upgrade Decision'
]:
document
=
context
if
document
.
getPortalType
()
==
"Upgrade Decision Line"
:
document
=
context
.
getParentValue
()
document
.
updateLocalRolesOnSecurityGroups
()
if
document
.
getPortalType
()
in
[
'Support Request'
,
'Upgrade Decision'
]:
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
if
activate_kw
is
None
:
if
activate_kw
is
None
:
...
@@ -12,7 +16,7 @@ if context.getPortalType() in ['Support Request', 'Upgrade Decision']:
...
@@ -12,7 +16,7 @@ if context.getPortalType() in ['Support Request', 'Upgrade Decision']:
portal
.
portal_catalog
.
searchAndActivate
(
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
portal
.
getPortalEventTypeList
(),
portal_type
=
portal
.
getPortalEventTypeList
(),
follow_up__uid
=
contex
t
.
getUid
(),
follow_up__uid
=
documen
t
.
getUid
(),
method_id
=
"updateLocalRolesOnSecurityGroups"
,
method_id
=
"updateLocalRolesOnSecurityGroups"
,
activate_kw
=
activate_kw
activate_kw
=
activate_kw
)
)
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/scripts/InternalPackingListLine_updateAggregateLocalRoles.py
View file @
b8d6257d
...
@@ -9,13 +9,12 @@ for object_ in internal_packing_list_line.getAggregateValueList(portal_type=port
...
@@ -9,13 +9,12 @@ for object_ in internal_packing_list_line.getAggregateValueList(portal_type=port
object_
.
activate
(
after_path_and_method_id
=
after_tag
).
updateLocalRolesOnSecurityGroups
()
object_
.
activate
(
after_path_and_method_id
=
after_tag
).
updateLocalRolesOnSecurityGroups
()
if
object_
.
getPortalType
()
==
"Computer"
:
if
object_
.
getPortalType
()
==
"Computer"
:
portal
.
portal_catalog
.
searchAndActivate
(
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
[
"Software Installation"
,
"Support Request"
,
"Upgrade Decision"
],
portal_type
=
[
"Software Installation"
,
"Support Request"
,
"Upgrade Decision
Line
"
],
default_or_child_aggregate
_uid
=
object_
.
getUid
(),
aggregate_
_uid
=
object_
.
getUid
(),
method_id
=
"Base_updateSlapOSLocalRolesOnSecurityGroups"
,
method_id
=
"Base_updateSlapOSLocalRolesOnSecurityGroups"
,
method_kw
=
dict
(
activate_kw
=
{
"after_path_and_method_id"
:
after_tag
}),
method_kw
=
dict
(
activate_kw
=
{
"after_path_and_method_id"
:
after_tag
}),
activate_kw
=
{
"after_path_and_method_id"
:
after_tag
}
activate_kw
=
{
"after_path_and_method_id"
:
after_tag
}
)
)
elif
object_
.
getPortalType
()
==
"Hosting Subscription"
:
elif
object_
.
getPortalType
()
==
"Hosting Subscription"
:
query
=
ComplexQuery
(
query
=
ComplexQuery
(
ComplexQuery
(
ComplexQuery
(
...
@@ -23,8 +22,8 @@ for object_ in internal_packing_list_line.getAggregateValueList(portal_type=port
...
@@ -23,8 +22,8 @@ for object_ in internal_packing_list_line.getAggregateValueList(portal_type=port
SimpleQuery
(
default_specialise_uid
=
object_
.
getUid
()),
SimpleQuery
(
default_specialise_uid
=
object_
.
getUid
()),
logical_operator
=
"AND"
),
logical_operator
=
"AND"
),
ComplexQuery
(
ComplexQuery
(
SimpleQuery
(
portal_type
=
[
"Support Request"
,
"Upgrade Decision"
]),
SimpleQuery
(
portal_type
=
[
"Support Request"
,
"Upgrade Decision
Line
"
]),
SimpleQuery
(
default_or_child_aggregate
_uid
=
object_
.
getUid
()),
SimpleQuery
(
aggregate_
_uid
=
object_
.
getUid
()),
logical_operator
=
"AND"
),
logical_operator
=
"AND"
),
logical_operator
=
"OR"
logical_operator
=
"OR"
)
)
...
...
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