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
6e5c94cc
Commit
6e5c94cc
authored
Feb 13, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: fixup shadow user permission on payment transaction
parent
35e7326f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
13 deletions
+7
-13
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Payment%20Transaction.xml
...rp5/PortalTypeRolesTemplateItem/Payment%20Transaction.xml
+2
-9
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PaymentTransaction_getSecurityCategoryFromUser.py
...os_core/PaymentTransaction_getSecurityCategoryFromUser.py
+3
-1
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
...l_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
+2
-3
No files found.
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Payment%20Transaction.xml
View file @
6e5c94cc
<type_roles>
<role
id=
'Assignee'
>
<property
id=
'title'
>
Person Shadow
</property>
<property
id=
'condition'
>
python: (here.getDestinationSection('', portal_type='Person') == "") and (here.getLedger("") == "automated")
</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'
>
ReadOnly for Accountant
</property>
<property
id=
'condition'
>
python: context.getLedger("") == "automated"
</property>
...
...
@@ -13,12 +6,12 @@
<multi_property
id=
'category'
>
function/accounting*
</multi_property>
<multi_property
id=
'base_category'
>
function
</multi_property>
</role>
<role
id=
'A
uditor
'
>
<role
id=
'A
ssignee
'
>
<property
id=
'title'
>
Shadow User
</property>
<property
id=
'condition'
>
python: (here.getDestinationSection('', portal_type='Person') != "") and (here.getLedger("") == "automated")
</property>
<property
id=
'base_category_script'
>
PaymentTransaction_getSecurityCategoryFromUser
</property>
<multi_property
id=
'categories'
>
local_role_group/shadow
</multi_property>
<multi_property
id=
'base_category'
>
aggregate
</multi_property>
<multi_property
id=
'base_category'
>
destination_section
</multi_property>
</role>
<role
id=
'Auditor'
>
<property
id=
'title'
>
User
</property>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/PaymentTransaction_getSecurityCategoryFromUser.py
View file @
6e5c94cc
...
...
@@ -30,9 +30,11 @@ category_list = []
if
obj
is
None
:
return
[]
# XXX rename script to: setShadowUserAsAssignee
# use base category instead of Hardcoding getDestinationSectionValue
person
=
obj
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
if
person
is
not
None
:
if
base_category_list
:
return
{
"A
uditor
"
:
[
"SHADOW-%s"
%
person
.
getUserId
()]}
return
{
"A
ssignee
"
:
[
"SHADOW-%s"
%
person
.
getUserId
()]}
return
category_list
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5GroupRoleSecurity.py
View file @
6e5c94cc
...
...
@@ -170,9 +170,8 @@ class TestPaymentTransaction(TestSlapOSGroupRoleSecurityMixin):
portal_type
=
'Payment Transaction'
)
product
.
edit
(
ledger
=
'automated'
)
self
.
assertSecurityGroup
(
product
,
[
'F-ACCOUNTING*'
,
'R-SHADOW-PERSON'
,
self
.
user_id
],
False
)
[
'F-ACCOUNTING*'
,
self
.
user_id
],
False
)
self
.
assertRoles
(
product
,
'F-ACCOUNTING*'
,
[
'Auditor'
])
self
.
assertRoles
(
product
,
'R-SHADOW-PERSON'
,
[
'Assignee'
])
self
.
assertRoles
(
product
,
self
.
user_id
,
[
'Owner'
])
def
test_PaymentTransaction_UserWithoutLedger
(
self
):
...
...
@@ -205,7 +204,7 @@ class TestPaymentTransaction(TestSlapOSGroupRoleSecurityMixin):
[
'F-ACCOUNTING*'
,
self
.
user_id
,
person
.
getUserId
(),
shadow_user_id
],
False
)
self
.
assertRoles
(
product
,
'F-ACCOUNTING*'
,
[
'Auditor'
])
self
.
assertRoles
(
product
,
shadow_user_id
,
[
'A
uditor
'
])
self
.
assertRoles
(
product
,
shadow_user_id
,
[
'A
ssignee
'
])
self
.
assertRoles
(
product
,
person
.
getUserId
(),
[
'Auditor'
])
self
.
assertRoles
(
product
,
self
.
user_id
,
[
'Owner'
])
...
...
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