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
21
Merge Requests
21
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
nexedi
slapos.core
Commits
30832018
Commit
30832018
authored
Dec 12, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: Yet a bit more fixes and test
parent
6d709dce
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Organisation.xml
.../slapos_erp5/PortalTypeRolesTemplateItem/Organisation.xml
+2
-1
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
...l_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
+23
-2
No files found.
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Organisation.xml
View file @
30832018
...
@@ -8,12 +8,13 @@
...
@@ -8,12 +8,13 @@
<role
id=
'Auditor'
>
<role
id=
'Auditor'
>
<property
id=
'title'
>
Member
</property>
<property
id=
'title'
>
Member
</property>
<property
id=
'description'
>
User can only see SlapOS company for invoice purposes.
</property>
<property
id=
'description'
>
User can only see SlapOS company for invoice purposes.
</property>
<property
id=
'condition'
>
python: here.get
Group() == "company
"
</property>
<property
id=
'condition'
>
python: here.get
Role() == "admin
"
</property>
<multi_property
id=
'category'
>
role/member
</multi_property>
<multi_property
id=
'category'
>
role/member
</multi_property>
<multi_property
id=
'base_category'
>
role
</multi_property>
<multi_property
id=
'base_category'
>
role
</multi_property>
</role>
</role>
<role
id=
'Assignee'
>
<role
id=
'Assignee'
>
<property
id=
'title'
>
Organisation Member
</property>
<property
id=
'title'
>
Organisation Member
</property>
<property
id=
'condition'
>
python: here.getReference() is not None
</property>
<property
id=
'base_category_script'
>
ERP5Type_getSecurityCategoryFromSelf
</property>
<property
id=
'base_category_script'
>
ERP5Type_getSecurityCategoryFromSelf
</property>
<multi_property
id=
'categories'
>
local_role_group/organisation
</multi_property>
<multi_property
id=
'categories'
>
local_role_group/organisation
</multi_property>
<multi_property
id=
'base_category'
>
destination
</multi_property>
<multi_property
id=
'base_category'
>
destination
</multi_property>
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
View file @
30832018
...
@@ -465,11 +465,21 @@ class TestOrganisation(TestSlapOSGroupRoleSecurityMixin):
...
@@ -465,11 +465,21 @@ class TestOrganisation(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
organisation
,
'R-SHADOW-PERSON'
,
[
'Auditor'
])
self
.
assertRoles
(
organisation
,
'R-SHADOW-PERSON'
,
[
'Auditor'
])
self
.
assertRoles
(
organisation
,
self
.
user_id
,
[
'Owner'
,
'Assignee'
])
self
.
assertRoles
(
organisation
,
self
.
user_id
,
[
'Owner'
,
'Assignee'
])
def
test_GroupCompany
(
self
):
def
test_without_reference
(
self
):
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
)
organisation
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
organisation
,
[
'G-COMPANY'
,
self
.
user_id
,
'R-SHADOW-PERSON'
],
False
)
self
.
assertRoles
(
organisation
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
organisation
,
'R-SHADOW-PERSON'
,
[
'Auditor'
])
self
.
assertRoles
(
organisation
,
self
.
user_id
,
[
'Owner'
,
'Assignee'
])
def
test_RoleAdmin
(
self
):
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
)
portal_type
=
'Organisation'
)
organisation
.
setReference
(
"TESTORG-%s"
%
self
.
generateNewId
())
organisation
.
setReference
(
"TESTORG-%s"
%
self
.
generateNewId
())
organisation
.
set
Group
(
"company
"
)
organisation
.
set
Role
(
"admin
"
)
organisation
.
updateLocalRolesOnSecurityGroups
()
organisation
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
organisation
,
self
.
assertSecurityGroup
(
organisation
,
[
'G-COMPANY'
,
self
.
user_id
,
organisation
.
getReference
(),
'R-SHADOW-PERSON'
,
'R-MEMBER'
],
False
)
[
'G-COMPANY'
,
self
.
user_id
,
organisation
.
getReference
(),
'R-SHADOW-PERSON'
,
'R-MEMBER'
],
False
)
...
@@ -479,6 +489,17 @@ class TestOrganisation(TestSlapOSGroupRoleSecurityMixin):
...
@@ -479,6 +489,17 @@ class TestOrganisation(TestSlapOSGroupRoleSecurityMixin):
self
.
assertRoles
(
organisation
,
'R-SHADOW-PERSON'
,
[
'Auditor'
])
self
.
assertRoles
(
organisation
,
'R-SHADOW-PERSON'
,
[
'Auditor'
])
self
.
assertRoles
(
organisation
,
self
.
user_id
,
[
'Owner'
,
'Assignee'
])
self
.
assertRoles
(
organisation
,
self
.
user_id
,
[
'Owner'
,
'Assignee'
])
def
test_defaultSlapOSOrganisation
(
self
):
# Test to ensure slapos organisation is well configured by default
organisation
=
self
.
portal
.
organisation_module
.
slapos
organisation
.
updateLocalRolesOnSecurityGroups
()
self
.
assertSecurityGroup
(
organisation
,
[
'G-COMPANY'
,
self
.
user_id
,
'R-SHADOW-PERSON'
,
'R-MEMBER'
],
False
)
self
.
assertRoles
(
organisation
,
'G-COMPANY'
,
[
'Assignor'
])
self
.
assertRoles
(
organisation
,
'R-MEMBER'
,
[
'Auditor'
])
self
.
assertRoles
(
organisation
,
'R-SHADOW-PERSON'
,
[
'Auditor'
])
self
.
assertRoles
(
organisation
,
self
.
user_id
,
[
'Owner'
,
'Assignee'
])
class
TestOrganisationModule
(
TestSlapOSGroupRoleSecurityMixin
):
class
TestOrganisationModule
(
TestSlapOSGroupRoleSecurityMixin
):
def
test
(
self
):
def
test
(
self
):
module
=
self
.
portal
.
organisation_module
module
=
self
.
portal
.
organisation_module
...
...
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