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
0985f9a8
Commit
0985f9a8
authored
Dec 10, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: Update Security (clean up)
Drop an duplication, probably came from copy and paste
parent
9013c2c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
27 deletions
+23
-27
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Computer%20Network.xml
...s_erp5/PortalTypeRolesTemplateItem/Computer%20Network.xml
+2
-10
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
...l_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
+21
-17
No files found.
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Computer%20Network.xml
View file @
0985f9a8
<type_roles>
<role
id=
'Assignee'
>
<property
id=
'title'
>
Compute Node Agent
</property>
<property
id=
'description'
>
Monovalued role
</property>
<property
id=
'base_category_script'
>
ERP5Type_getSecurityCategoryFromContent
</property>
<multi_property
id=
'categories'
>
local_role_group/computer
</multi_property>
<multi_property
id=
'base_category'
>
source_administration
</multi_property>
</role>
<role
id=
'Assignor'
>
<property
id=
'title'
>
Group company
</property>
<multi_property
id=
'categories'
>
local_role_group/group
</multi_property>
...
...
@@ -20,10 +13,9 @@
</role>
<role
id=
'Assignee'
>
<property
id=
'title'
>
Person Owner
</property>
<property
id=
'description'
>
XXX Review this
</property>
<property
id=
'base_category_script'
>
ERP5Type_acquireSecurityFromOwner
</property>
<property
id=
'base_category_script'
>
ERP5Type_getSecurityCategoryFromContent
</property>
<multi_property
id=
'categories'
>
local_role_group/user
</multi_property>
<multi_property
id=
'base_category'
>
source
</multi_property>
<multi_property
id=
'base_category'
>
source
_administration
</multi_property>
</role>
<role
id=
'Auditor'
>
<property
id=
'title'
>
Person Shadow
</property>
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
View file @
0985f9a8
...
...
@@ -315,7 +315,7 @@ class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin):
project
.
getReference
()],
False
)
self
.
assertRoles
(
network
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
network
,
'R-SHADOW-PERSON'
,
[
'Auditor'
])
self
.
assertRoles
(
network
,
self
.
user_id
,
[
'
Assignee'
,
'
Owner'
])
self
.
assertRoles
(
network
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
network
,
person
.
getUserId
(),
[
'Assignee'
])
self
.
assertRoles
(
network
,
project
.
getReference
(),
[
'Assignee'
])
...
...
@@ -341,7 +341,7 @@ class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin):
organisation
.
getReference
()],
False
)
self
.
assertRoles
(
network
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
network
,
'R-SHADOW-PERSON'
,
[
'Auditor'
])
self
.
assertRoles
(
network
,
self
.
user_id
,
[
'
Assignee'
,
'
Owner'
])
self
.
assertRoles
(
network
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
network
,
person
.
getUserId
(),
[
'Assignee'
])
self
.
assertRoles
(
network
,
organisation
.
getReference
(),
[
'Assignee'
])
...
...
@@ -353,21 +353,7 @@ class TestComputerNetwork(TestSlapOSGroupRoleSecurityMixin):
[
'G-COMPANY'
,
'R-SHADOW-PERSON'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
network
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
network
,
'R-SHADOW-PERSON'
,
[
'Auditor'
])
self
.
assertRoles
(
network
,
self
.
user_id
,
[
'Assignee'
,
'Owner'
])
def
test_ComputeNodeAgent
(
self
):
reference
=
'TESTPERSON-%s'
%
self
.
generateNewId
()
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
reference
=
reference
)
network
=
self
.
portal
.
computer_network_module
.
newContent
(
portal_type
=
'Computer Network'
,
source_administration
=
person
.
getRelativeUrl
())
network
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
network
,
[
'G-COMPANY'
,
'R-SHADOW-PERSON'
,
self
.
user_id
,
person
.
getUserId
()],
False
)
self
.
assertRoles
(
network
,
person
.
getUserId
(),
[
'Assignee'
])
self
.
assertRoles
(
network
,
self
.
user_id
,
[
'Assignee'
,
'Owner'
])
self
.
assertRoles
(
network
,
self
.
user_id
,
[
'Owner'
])
class
TestComputerNetworkModule
(
TestSlapOSGroupRoleSecurityMixin
):
def
test
(
self
):
...
...
@@ -526,6 +512,7 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin):
reference
=
'TESTHS-%s'
%
self
.
generateNewId
()
subscription
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
reference
=
reference
,
title
=
reference
,
destination_section
=
person
.
getRelativeUrl
())
project
=
self
.
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
)
...
...
@@ -552,6 +539,7 @@ class TestInstanceTree(TestSlapOSGroupRoleSecurityMixin):
reference
=
'TESTHS-%s'
%
self
.
generateNewId
()
subscription
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
reference
=
reference
,
title
=
reference
,
destination_section
=
person
.
getRelativeUrl
())
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
,
...
...
@@ -896,6 +884,7 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin):
subscription_reference
=
'TESTHS-%s '
%
self
.
generateNewId
()
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
title
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
reference
=
subscription_reference
,
destination_section
=
customer
.
getRelativeUrl
())
project
=
self
.
portal
.
project_module
.
newContent
(
...
...
@@ -925,6 +914,7 @@ class TestSlaveInstance(TestSlapOSGroupRoleSecurityMixin):
subscription_reference
=
'TESTHS-%s '
%
self
.
generateNewId
()
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
title
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
reference
=
subscription_reference
,
destination_section
=
customer
.
getRelativeUrl
())
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
...
...
@@ -1132,6 +1122,7 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin):
subscription_reference
=
'TESTHS-%s '
%
self
.
generateNewId
()
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
title
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
reference
=
subscription_reference
,
destination_section
=
customer
.
getRelativeUrl
())
project
=
self
.
portal
.
project_module
.
newContent
(
...
...
@@ -1161,6 +1152,7 @@ class TestSoftwareInstance(TestSlapOSGroupRoleSecurityMixin):
subscription_reference
=
'TESTHS-%s '
%
self
.
generateNewId
()
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
title
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
reference
=
subscription_reference
,
destination_section
=
customer
.
getRelativeUrl
())
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
...
...
@@ -1958,6 +1950,8 @@ class TestMailMessage(TestSlapOSGroupRoleSecurityMixin):
person
=
self
.
makePerson
(
user
=
1
)
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
reference
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
title
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
destination_section
=
person
.
getRelativeUrl
())
project
=
self
.
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
)
...
...
@@ -2033,6 +2027,8 @@ class TestMailMessage(TestSlapOSGroupRoleSecurityMixin):
person
=
self
.
makePerson
(
user
=
1
)
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
reference
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
title
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
destination_section
=
person
.
getRelativeUrl
())
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
,
...
...
@@ -2305,6 +2301,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
person
=
self
.
makePerson
(
user
=
1
)
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
reference
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
title
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
destination_section
=
person
.
getRelativeUrl
())
project
=
self
.
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
)
...
...
@@ -2364,6 +2362,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
person
=
self
.
makePerson
(
user
=
1
)
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
reference
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
title
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
destination_section
=
person
.
getRelativeUrl
())
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
,
...
...
@@ -2804,6 +2804,8 @@ class TestUpgradeDecision(TestSlapOSGroupRoleSecurityMixin):
person
=
self
.
makePerson
(
user
=
1
)
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
reference
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
title
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
destination_section
=
person
.
getRelativeUrl
())
project
=
self
.
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
)
...
...
@@ -2868,6 +2870,8 @@ class TestUpgradeDecision(TestSlapOSGroupRoleSecurityMixin):
person
=
self
.
makePerson
(
user
=
1
)
instance_tree
=
self
.
portal
.
instance_tree_module
.
newContent
(
portal_type
=
'Instance Tree'
,
reference
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
title
=
"INSTTREETEST-%s"
%
self
.
generateNewId
(),
destination_section
=
person
.
getRelativeUrl
())
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
,
...
...
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