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
0
Merge Requests
0
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
Rafael Monnerat
slapos.core
Commits
db59da79
Commit
db59da79
authored
May 22, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: Simplify the Extension code when bangAsSelf
parent
c0685e19
Changes
1
Hide 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 @
db59da79
...
@@ -27,8 +27,8 @@
...
@@ -27,8 +27,8 @@
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
,
newSecurityManager
setSecurityManager
,
newSecurityManager
from
Products.ERP5Security
import
SUPER_USER
from
Products.ERP5Type.UnrestrictedMethod
import
super_user
from
zExceptions
import
Unauthorized
from
zExceptions
import
Unauthorized
from
DateTime
import
DateTime
from
DateTime
import
DateTime
...
@@ -45,17 +45,15 @@ def SoftwareInstance_bangAsSelf(self, relative_url=None, reference=None,
...
@@ -45,17 +45,15 @@ def SoftwareInstance_bangAsSelf(self, relative_url=None, reference=None,
if
(
software_instance
.
getPortalType
()
==
"Slave Instance"
)
and
\
if
(
software_instance
.
getPortalType
()
==
"Slave Instance"
)
and
\
(
software_instance
.
getReference
()
==
reference
):
(
software_instance
.
getReference
()
==
reference
):
# XXX There is no account for Slave Instance
# XXX There is no account for Slave Instance
with
super_user
():
user
=
self
.
getPortalObject
().
acl_users
.
getUser
(
SUPER_USER
)
software_instance
.
bang
(
bang_tree
=
True
,
comment
=
comment
)
else
:
return
user_id
=
software_instance
.
getUserId
()
user
=
self
.
getPortalObject
().
acl_users
.
getUserById
(
user_id
)
sm
=
getSecurityManager
()
sm
=
getSecurityManager
()
user_id
=
software_instance
.
getUserId
()
newSecurityManager
(
None
,
self
.
getPortalObject
().
acl_users
.
getUserById
(
user_id
))
try
:
try
:
newSecurityManager
(
None
,
user
)
software_instance
.
bang
(
bang_tree
=
True
,
comment
=
comment
)
software_instance
.
bang
(
bang_tree
=
True
,
comment
=
comment
)
finally
:
finally
:
# Restore the original user.
setSecurityManager
(
sm
)
setSecurityManager
(
sm
)
def
SoftwareInstance_renameAndRequestDestroy
(
self
,
REQUEST
=
None
):
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