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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
3e54dbd6
Commit
3e54dbd6
authored
Jun 27, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: use instance/computer project in the security mapping
parent
47a85370
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
master/bt5/slapos_cloud/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSSecurity.py
...teItem/portal_components/extension.erp5.SlapOSSecurity.py
+17
-1
No files found.
master/bt5/slapos_cloud/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSSecurity.py
View file @
3e54dbd6
...
...
@@ -47,10 +47,19 @@ def getComputeNodeSecurityCategory(self, base_category_list, user_name,
)
if
len
(
compute_node_list
)
==
1
:
category_dict
=
{}
for
base_category
in
base_category_list
:
if
base_category
==
"role"
:
category_list
.
append
(
{
base_category
:
[
'role/computer'
]})
elif
base_category
==
"destination_project"
:
compute_node
=
compute_node_list
[
0
]
project
=
compute_node
.
getFollowUpValue
(
portal_type
=
'Project'
)
if
project
is
not
None
:
category_dict
.
setdefault
(
base_category
,
[]).
append
(
project
.
getRelativeUrl
())
else
:
raise
NotImplementedError
(
'Not supported base category: %s'
%
base_category
)
category_list
.
append
(
category_dict
)
elif
len
(
compute_node_list
)
>
1
:
raise
ConsistencyError
(
"Error: There is more than one Compute Node "
\
"with reference '%s'"
%
user_name
)
...
...
@@ -77,11 +86,18 @@ def getSoftwareInstanceSecurityCategory(self, base_category_list, user_name,
for
base_category
in
base_category_list
:
if
base_category
==
"role"
:
category_dict
.
setdefault
(
base_category
,
[]).
extend
([
'role/instance'
])
if
base_category
==
"aggregate"
:
elif
base_category
==
"destination_project"
:
software_instance
=
software_instance_list
[
0
]
project
=
software_instance
.
getFollowUpValue
(
portal_type
=
'Project'
)
if
project
is
not
None
:
category_dict
.
setdefault
(
base_category
,
[]).
append
(
project
.
getRelativeUrl
())
elif
base_category
==
"aggregate"
:
software_instance
=
software_instance_list
[
0
]
instance_tree
=
software_instance
.
getSpecialiseValue
(
portal_type
=
'Instance Tree'
)
if
instance_tree
is
not
None
:
category_dict
.
setdefault
(
base_category
,
[]).
append
(
instance_tree
.
getRelativeUrl
())
else
:
raise
NotImplementedError
(
'Not supported base category: %s'
%
base_category
)
category_list
.
append
(
category_dict
)
elif
len
(
software_instance_list
)
>
1
:
raise
ConsistencyError
(
"Error: There is more than one Software Instance "
\
...
...
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