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
23019bc0
Commit
23019bc0
authored
May 22, 2020
by
Rafael Monnerat
Committed by
Thomas Gambier
Jun 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: Simplify the Extension code when bangAsSelf
parent
8eeb4e1d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
master/bt5/slapos_cloud/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSCloud.py
...plateItem/portal_components/extension.erp5.SlapOSCloud.py
+6
-8
No files found.
master/bt5/slapos_cloud/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSCloud.py
View file @
23019bc0
...
...
@@ -27,8 +27,8 @@
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
,
newSecurityManager
from
Products.ERP5Security
import
SUPER_USER
from
Products.ERP5Type.UnrestrictedMethod
import
super_user
from
zExceptions
import
Unauthorized
from
DateTime
import
DateTime
...
...
@@ -45,17 +45,15 @@ def SoftwareInstance_bangAsSelf(self, relative_url=None, reference=None,
if
(
software_instance
.
getPortalType
()
==
"Slave Instance"
)
and
\
(
software_instance
.
getReference
()
==
reference
):
# XXX There is no account for Slave Instance
with
super_user
():
software_instance
.
bang
(
bang_tree
=
True
,
comment
=
comment
)
return
sm
=
getSecurityManager
()
user
=
self
.
getPortalObject
().
acl_users
.
getUser
(
SUPER_USER
)
else
:
user_id
=
software_instance
.
getUserId
()
newSecurityManager
(
None
,
self
.
getPortalObject
().
acl_users
.
getUserById
(
user_id
))
user
=
self
.
getPortalObject
().
acl_users
.
getUserById
(
user_id
)
sm
=
getSecurityManager
()
try
:
newSecurityManager
(
None
,
user
)
software_instance
.
bang
(
bang_tree
=
True
,
comment
=
comment
)
finally
:
# Restore the original user.
setSecurityManager
(
sm
)
def
SoftwareInstance_renameAndRequestDestroy
(
self
,
REQUEST
=
None
):
...
...
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