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
bd097b34
Commit
bd097b34
authored
Jan 16, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: test Computer Model local roles
parent
500f0ccd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
43 deletions
+74
-43
master/bt5/slapos_erp5/LocalRolesTemplateItem/computer_model_module.xml
...pos_erp5/LocalRolesTemplateItem/computer_model_module.xml
+9
-9
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Computer%20Model%20Module.xml
...PortalTypeRolesTemplateItem/Computer%20Model%20Module.xml
+14
-9
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Computer%20Model.xml
...pos_erp5/PortalTypeRolesTemplateItem/Computer%20Model.xml
+25
-8
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
...l_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
+26
-17
No files found.
master/bt5/slapos_erp5/LocalRolesTemplateItem/computer_model_module.xml
View file @
bd097b34
<local_roles_item>
<local_roles_item>
<local_roles>
<local_roles>
<role
id=
'
G-COMPANY
'
>
<role
id=
'
F-CUSTOMER
'
>
<item>
Auditor
</item>
<item>
Auditor
</item>
<item>
Author
</item>
</role>
</role>
<role
id=
'
R-MEMBER
'
>
<role
id=
'
F-PRODUCTION*
'
>
<item>
Auditor
</item>
<item>
Auditor
</item>
<item>
Author
</item>
<item>
Author
</item>
</role>
</role>
<role
id=
'R-SHADOW-PERSON'
>
<item>
Auditor
</item>
</role>
</local_roles>
</local_roles>
<local_role_group_ids>
<local_role_group_ids>
<local_role_group_id
id=
'group'
>
<local_role_group_id
id=
'function'
>
<principal
id=
'G-COMPANY'
>
Auditor
</principal>
<principal
id=
'F-CUSTOMER'
>
Auditor
</principal>
<principal
id=
'G-COMPANY'
>
Author
</principal>
</local_role_group_id>
</local_role_group_id>
<local_role_group_id
id=
'user'
>
<local_role_group_id
id=
'shadow'
>
<principal
id=
'R-MEMBER'
>
Auditor
</principal>
<principal
id=
'R-SHADOW-PERSON'
>
Auditor
</principal>
<principal
id=
'R-MEMBER'
>
Author
</principal>
</local_role_group_id>
</local_role_group_id>
</local_role_group_ids>
</local_role_group_ids>
</local_roles_item>
</local_roles_item>
\ No newline at end of file
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Computer%20Model%20Module.xml
View file @
bd097b34
<type_roles>
<type_roles>
<role
id=
'Auditor; Author'
>
<role
id=
'Auditor'
>
<property
id=
'title'
>
Group Company
</property>
<multi_property
id=
'categories'
>
local_role_group/group
</multi_property>
<multi_property
id=
'category'
>
group/company
</multi_property>
<multi_property
id=
'base_category'
>
group
</multi_property>
</role>
<role
id=
'Auditor; Author'
>
<property
id=
'title'
>
Member
</property>
<property
id=
'title'
>
Member
</property>
<multi_property
id=
'categories'
>
local_role_group/user
</multi_property>
<multi_property
id=
'categories'
>
local_role_group/function
</multi_property>
<multi_property
id=
'category'
>
role/member
</multi_property>
<multi_property
id=
'category'
>
function/customer
</multi_property>
<multi_property
id=
'base_category'
>
function
</multi_property>
</role>
<role
id=
'Auditor'
>
<property
id=
'title'
>
Person Shadow
</property>
<multi_property
id=
'categories'
>
local_role_group/shadow
</multi_property>
<multi_property
id=
'category'
>
role/shadow/person
</multi_property>
<multi_property
id=
'base_category'
>
role
</multi_property>
<multi_property
id=
'base_category'
>
role
</multi_property>
</role>
</role>
<role
id=
'Auditor; Author'
>
<property
id=
'title'
>
Production
</property>
<multi_property
id=
'category'
>
function/production*
</multi_property>
<multi_property
id=
'base_category'
>
function
</multi_property>
</role>
</type_roles>
</type_roles>
\ No newline at end of file
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Computer%20Model.xml
View file @
bd097b34
<type_roles>
<type_roles>
<role
id=
'Auditor'
>
<property
id=
'title'
>
Person Shadow
</property>
<multi_property
id=
'categories'
>
local_role_group/shadow
</multi_property>
<multi_property
id=
'category'
>
role/shadow/person
</multi_property>
<multi_property
id=
'base_category'
>
role
</multi_property>
</role>
<role
id=
'Auditor'
>
<property
id=
'title'
>
Project Customer
</property>
<property
id=
'description'
>
XXX add local role group
</property>
<property
id=
'condition'
>
python: context.getFollowUp("") != ""
</property>
<property
id=
'base_category_script'
>
ERP5Type_getSecurityCategoryFromContent
</property>
<multi_property
id=
'category'
>
function/customer
</multi_property>
<multi_property
id=
'base_category'
>
follow_up
</multi_property>
</role>
<role
id=
'Assignee'
>
<role
id=
'Assignee'
>
<property
id=
'title'
>
Compute Node Agent
</property>
<property
id=
'title'
>
Project Production Agent
</property>
<property
id=
'description'
>
Monovalued role
</property>
<property
id=
'description'
>
XXX add local role group
</property>
<property
id=
'condition'
>
python: context.getFollowUp("") != ""
</property>
<property
id=
'base_category_script'
>
ERP5Type_getSecurityCategoryFromContent
</property>
<property
id=
'base_category_script'
>
ERP5Type_getSecurityCategoryFromContent
</property>
<multi_property
id=
'categor
ies'
>
local_role_group/user
</multi_property>
<multi_property
id=
'categor
y'
>
function/production/agent
</multi_property>
<multi_property
id=
'base_category'
>
source_administration
</multi_property>
<multi_property
id=
'base_category'
>
follow_up
</multi_property>
</role>
</role>
<role
id=
'Assignor'
>
<role
id=
'Assignor'
>
<property
id=
'title'
>
Group company
</property>
<property
id=
'title'
>
Project Production Manager
</property>
<multi_property
id=
'categories'
>
local_role_group/group
</multi_property>
<property
id=
'description'
>
XXX add local role group
</property>
<multi_property
id=
'category'
>
group/company
</multi_property>
<property
id=
'condition'
>
python: context.getFollowUp("") != ""
</property>
<multi_property
id=
'base_category'
>
group
</multi_property>
<property
id=
'base_category_script'
>
ERP5Type_getSecurityCategoryFromContent
</property>
<multi_property
id=
'category'
>
function/production/manager
</multi_property>
<multi_property
id=
'base_category'
>
follow_up
</multi_property>
</role>
</role>
</type_roles>
</type_roles>
\ No newline at end of file
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
View file @
bd097b34
...
@@ -134,36 +134,45 @@ class TestComputeNode(TestSlapOSGroupRoleSecurityMixin):
...
@@ -134,36 +134,45 @@ class TestComputeNode(TestSlapOSGroupRoleSecurityMixin):
class
TestComputerModel
(
TestSlapOSGroupRoleSecurityMixin
):
class
TestComputerModel
(
TestSlapOSGroupRoleSecurityMixin
):
def
test_
GroupCompany
(
self
):
def
test_
default
(
self
):
model
=
self
.
portal
.
computer_model_module
.
newContent
(
model
=
self
.
portal
.
computer_model_module
.
newContent
(
portal_type
=
'Computer Model'
)
portal_type
=
'Computer Model'
)
model
.
updateLocalRolesOnSecurityGroups
()
model
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
model
,
self
.
assertSecurityGroup
(
model
,
[
'
G-COMPANY
'
,
self
.
user_id
],
False
)
[
'
R-SHADOW-PERSON
'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
model
,
'
G-COMPANY'
,
[
'Assign
or'
])
self
.
assertRoles
(
model
,
'
R-SHADOW-PERSON'
,
[
'Audit
or'
])
self
.
assertRoles
(
model
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
model
,
self
.
user_id
,
[
'Owner'
])
def
test_ComputeNodeAgent
(
self
):
def
test_ProjectMember
(
self
):
reference
=
'TESTPERSON-%s'
%
self
.
generateNewId
()
project
=
self
.
addProject
()
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
compute_node
=
self
.
portal
.
computer_model_module
.
newContent
(
reference
=
reference
)
model
=
self
.
portal
.
computer_model_module
.
newContent
(
portal_type
=
'Computer Model'
,
portal_type
=
'Computer Model'
,
source_administration
=
person
.
getRelativeUrl
())
follow_up_value
=
project
)
model
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
model
,
compute_node
.
updateLocalRolesOnSecurityGroups
()
[
'G-COMPANY'
,
self
.
user_id
,
person
.
getUserId
()],
False
)
self
.
assertSecurityGroup
(
compute_node
,
[
self
.
assertRoles
(
model
,
person
.
getUserId
(),
[
'Assignee'
])
self
.
user_id
,
self
.
assertRoles
(
model
,
self
.
user_id
,
[
'Owner'
])
'R-SHADOW-PERSON'
,
'%s_F-PRODAGNT'
%
project
.
getReference
(),
'%s_F-PRODMAN'
%
project
.
getReference
(),
'%s_F-CUSTOMER'
%
project
.
getReference
(),
],
False
)
self
.
assertRoles
(
compute_node
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
compute_node
,
'R-SHADOW-PERSON'
,
[
'Auditor'
])
self
.
assertRoles
(
compute_node
,
'%s_F-PRODAGNT'
%
project
.
getReference
(),
[
'Assignee'
])
self
.
assertRoles
(
compute_node
,
'%s_F-PRODMAN'
%
project
.
getReference
(),
[
'Assignor'
])
self
.
assertRoles
(
compute_node
,
'%s_F-CUSTOMER'
%
project
.
getReference
(),
[
'Auditor'
])
class
TestComputerModelModule
(
TestSlapOSGroupRoleSecurityMixin
):
class
TestComputerModelModule
(
TestSlapOSGroupRoleSecurityMixin
):
def
test
(
self
):
def
test
(
self
):
module
=
self
.
portal
.
computer_model_module
module
=
self
.
portal
.
computer_model_module
self
.
changeOwnership
(
module
)
self
.
changeOwnership
(
module
)
self
.
assertSecurityGroup
(
module
,
self
.
assertSecurityGroup
(
module
,
[
'G-COMPANY'
,
'R-MEMBER'
,
self
.
user_id
],
False
)
[
'F-PRODUCTION*'
,
'F-CUSTOMER'
,
'R-SHADOW-PERSON'
,
self
.
user_id
],
self
.
assertRoles
(
module
,
'R-MEMBER'
,
[
'Auditor'
,
'Author'
])
False
)
self
.
assertRoles
(
module
,
'G-COMPANY'
,
[
'Auditor'
,
'Author'
])
self
.
assertRoles
(
module
,
'F-CUSTOMER'
,
[
'Auditor'
])
self
.
assertRoles
(
module
,
'F-PRODUCTION*'
,
[
'Auditor'
,
'Author'
])
self
.
assertRoles
(
module
,
'R-SHADOW-PERSON'
,
[
'Auditor'
])
self
.
assertRoles
(
module
,
self
.
user_id
,
[
'Owner'
])
self
.
assertRoles
(
module
,
self
.
user_id
,
[
'Owner'
])
class
TestComputerModule
(
TestSlapOSGroupRoleSecurityMixin
):
class
TestComputerModule
(
TestSlapOSGroupRoleSecurityMixin
):
...
...
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