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
500f0ccd
Commit
500f0ccd
authored
Jan 16, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: test Regularisation Request local roles
parent
d533a344
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
58 deletions
+23
-58
master/bt5/slapos_erp5/LocalRolesTemplateItem/regularisation_request_module/slapos_crm_regularisation_request_template.xml
...est_module/slapos_crm_regularisation_request_template.xml
+0
-6
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Regularisation%20Request.xml
.../PortalTypeRolesTemplateItem/Regularisation%20Request.xml
+2
-0
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
...l_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
+21
-52
No files found.
master/bt5/slapos_erp5/LocalRolesTemplateItem/regularisation_request_module/slapos_crm_regularisation_request_template.xml
View file @
500f0ccd
<local_roles_item>
<local_roles>
<role
id=
'G-COMPANY'
>
<item>
Assignor
</item>
</role>
<role
id=
'R-MEMBER'
>
<item>
Auditor
</item>
</role>
</local_roles>
<local_role_group_ids>
<local_role_group_id
id=
'group'
>
<principal
id=
'G-COMPANY'
>
Assignor
</principal>
</local_role_group_id>
<local_role_group_id
id=
'user'
>
<principal
id=
'R-MEMBER'
>
Auditor
</principal>
</local_role_group_id>
...
...
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Regularisation%20Request.xml
View file @
500f0ccd
...
...
@@ -36,6 +36,7 @@
<property
id=
'base_category_script'
>
ERP5Type_getSecurityCategoryFromContent
</property>
<multi_property
id=
'category'
>
function/production/agent
</multi_property>
<multi_property
id=
'base_category'
>
source_project
</multi_property>
<multi_property
id=
'base_category'
>
function
</multi_property>
</role>
<role
id=
'Assignor'
>
<property
id=
'title'
>
Source Project Production Manager
</property>
...
...
@@ -44,5 +45,6 @@
<property
id=
'base_category_script'
>
ERP5Type_getSecurityCategoryFromContent
</property>
<multi_property
id=
'category'
>
function/production/manager
</multi_property>
<multi_property
id=
'base_category'
>
source_project
</multi_property>
<multi_property
id=
'base_category'
>
function
</multi_property>
</role>
</type_roles>
\ No newline at end of file
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
View file @
500f0ccd
...
...
@@ -1494,9 +1494,11 @@ class TestSupportRequestModule(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
module
,
self
.
user_id
,
[
'Owner'
])
class
TestSupportRequest
(
TestSlapOSGroupRoleSecurityMixin
):
def
test_GroupCompany
(
self
):
support_request
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
)
ticket_portal_type
=
'Support Request'
def
test_default
(
self
):
support_request
=
self
.
portal
.
getDefaultModuleValue
(
self
.
ticket_portal_type
).
newContent
(
portal_type
=
self
.
ticket_portal_type
)
support_request
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
support_request
,
[
self
.
user_id
],
False
)
...
...
@@ -1506,8 +1508,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
reference
=
'TESTPERSON-%s'
%
self
.
generateNewId
()
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
reference
=
reference
)
support_request
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
support_request
=
self
.
portal
.
getDefaultModuleValue
(
self
.
ticket_portal_type
)
.
newContent
(
portal_type
=
self
.
ticket_portal_type
,
destination_decision_value
=
person
,
)
support_request
.
updateLocalRolesOnSecurityGroups
()
...
...
@@ -1517,9 +1519,11 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
support_request
,
self
.
user_id
,
[
'Owner'
])
def
test_Template
(
self
):
support_request
=
self
.
portal
.
restrictedTraverse
(
self
.
portal
.
portal_preferences
.
getPreferredSupportRequestTemplate
())
assert
support_request
.
getPortalType
()
==
'Support Request'
support_request
=
self
.
portal
.
restrictedTraverse
(
getattr
(
self
.
portal
.
portal_preferences
,
'getPreferred%sTemplate'
%
self
.
ticket_portal_type
.
title
().
replace
(
' '
,
''
)
)())
assert
support_request
.
getPortalType
()
==
self
.
ticket_portal_type
support_request
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
support_request
,
[
support_request
.
Base_getOwnerId
(),
'R-MEMBER'
],
False
)
...
...
@@ -1530,8 +1534,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
def
test_SourceProject
(
self
):
project
=
self
.
addProject
()
support_request
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
support_request
=
self
.
portal
.
getDefaultModuleValue
(
self
.
ticket_portal_type
)
.
newContent
(
portal_type
=
self
.
ticket_portal_type
,
source_project_value
=
project
)
support_request
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
support_request
,
[
self
.
user_id
,
...
...
@@ -1543,8 +1547,8 @@ class TestSupportRequest(TestSlapOSGroupRoleSecurityMixin):
def
test_DestinationProject
(
self
):
project
=
self
.
addProject
()
support_request
=
self
.
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
support_request
=
self
.
portal
.
getDefaultModuleValue
(
self
.
ticket_portal_type
)
.
newContent
(
portal_type
=
self
.
ticket_portal_type
,
destination_project_value
=
project
)
support_request
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
support_request
,
[
self
.
user_id
,
...
...
@@ -1722,48 +1726,13 @@ class TestRegularisationRequestModule(TestSlapOSGroupRoleSecurityMixin):
module
=
self
.
portal
.
regularisation_request_module
self
.
changeOwnership
(
module
)
self
.
assertSecurityGroup
(
module
,
[
'
G-COMPANY'
,
'R-MEMBER'
,
self
.
user_id
],
Fals
e
)
self
.
assertRoles
(
module
,
'
G-COMPANY'
,
[
'Auditor'
,
'Auth
or'
])
self
.
assertRoles
(
module
,
'
R-MEMB
ER'
,
[
'Auditor'
])
[
'
F-PRODUCTION*'
,
'F-CUSTOMER'
,
self
.
user_id
],
Tru
e
)
self
.
assertRoles
(
module
,
'
F-PRODUCTION*'
,
[
'Audit
or'
])
self
.
assertRoles
(
module
,
'
F-CUSTOM
ER'
,
[
'Auditor'
])
self
.
assertRoles
(
module
,
self
.
user_id
,
[
'Owner'
])
class
TestRegularisationRequest
(
TestSlapOSGroupRoleSecurityMixin
):
def
test_GroupCompany
(
self
):
product
=
self
.
portal
.
regularisation_request_module
.
newContent
(
portal_type
=
'Regularisation Request'
)
product
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
product
,
[
'G-COMPANY'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
product
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
product
,
self
.
user_id
,
[
'Owner'
])
def
test_Customer
(
self
):
reference
=
'TESTPERSON-%s'
%
self
.
generateNewId
()
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
reference
=
reference
)
product
=
self
.
portal
.
regularisation_request_module
.
newContent
(
portal_type
=
'Regularisation Request'
,
destination_decision_value
=
person
,
)
product
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
product
,
[
'G-COMPANY'
,
person
.
getUserId
(),
self
.
user_id
],
False
)
self
.
assertRoles
(
product
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
product
,
person
.
getUserId
(),
[
'Auditor'
])
self
.
assertRoles
(
product
,
self
.
user_id
,
[
'Owner'
])
def
test_Template
(
self
):
product
=
self
.
portal
.
restrictedTraverse
(
self
.
portal
.
portal_preferences
.
getPreferredRegularisationRequestTemplate
())
assert
product
.
getPortalType
()
==
'Regularisation Request'
product
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
product
,
[
'G-COMPANY'
,
product
.
Base_getOwnerId
(),
'R-MEMBER'
],
False
)
self
.
assertRoles
(
product
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
product
,
product
.
Base_getOwnerId
(),
[
'Owner'
])
self
.
assertRoles
(
product
,
'R-MEMBER'
,
[
'Auditor'
])
self
.
assertPermissionsOfRole
(
product
,
'Auditor'
,
[
'Access contents information'
,
'View'
])
class
TestRegularisationRequest
(
TestSupportRequest
):
ticket_portal_type
=
'Regularisation Request'
class
TestInvitationTokenModule
(
TestSlapOSGroupRoleSecurityMixin
):
def
test
(
self
):
...
...
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