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
16
Merge Requests
16
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
e2797512
Commit
e2797512
authored
Jun 04, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: Drop unused scripts from old security definitions
parent
3aca11ec
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1 addition
and
222 deletions
+1
-222
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_acquireSecurityFromOwner.py
...al_skins/slapos_core/ERP5Type_acquireSecurityFromOwner.py
+0
-15
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_acquireSecurityFromOwner.xml
...l_skins/slapos_core/ERP5Type_acquireSecurityFromOwner.xml
+0
-70
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryFromChildAssignmentList.py
...re/ERP5Type_getSecurityCategoryFromChildAssignmentList.py
+0
-41
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryFromChildAssignmentList.xml
...e/ERP5Type_getSecurityCategoryFromChildAssignmentList.xml
+0
-62
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSCoreSkins.py
...teItem/portal_components/test.erp5.testSlapOSCoreSkins.py
+1
-34
No files found.
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_acquireSecurityFromOwner.py
deleted
100644 → 0
View file @
3aca11ec
"""
WARNING: this script requires proxy manager
This script tries to acquire category values from other objects
base_category_list - list of category values we need to retrieve
object - object which we want to assign roles to.
"""
user_name
=
ob
.
Base_getOwnerId
()
#pylint: disable=redefined-builtin
# XXX Hardcoded role
return
{
'Assignee'
:
[
user_name
],
}
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_acquireSecurityFromOwner.xml
deleted
100644 → 0
View file @
3aca11ec
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
base_category_list, user_name, ob, portal_type
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Type_acquireSecurityFromOwner
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryFromChildAssignmentList.py
deleted
100644 → 0
View file @
3aca11ec
"""
This script returns a list of dictionaries which represent
the security groups which a person is member of. It extracts
the categories from the current content. It is useful in the
following cases:
- calculate a security group based on a given
category of all Assifbment subobjects (ex. destination_project). This
is used for example in ERP5 to calculate
security of person objects so that members
of the same project can view each other.
The parameters are
base_category_list -- list of category values we need to retrieve
user_name -- string obtained from getSecurityManager().getUser().getId()
object -- object which we want to assign roles to
portal_type -- portal type of object
NOTE: for now, this script requires proxy manager
"""
category_list
=
[]
if
obj
is
None
:
return
[]
person_object
=
obj
# We look for every valid assignments of this user
for
assignment
in
person_object
.
contentValues
(
filter
=
{
'portal_type'
:
'Assignment'
}):
if
assignment
.
getValidationState
()
==
'open'
:
category_dict
=
{}
for
base_category
in
base_category_list
:
category_value_list
=
assignment
.
getAcquiredValueList
(
base_category
)
if
category_value_list
:
for
category_value
in
category_value_list
:
category_dict
.
setdefault
(
base_category
,
[]).
append
(
'%s'
%
category_value
.
getRelativeUrl
())
category_list
.
append
(
category_dict
)
return
category_list
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryFromChildAssignmentList.xml
deleted
100644 → 0
View file @
3aca11ec
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
base_category_list, user_name, obj, portal_type
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Type_getSecurityCategoryFromChildAssignmentList
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSCoreSkins.py
View file @
e2797512
...
@@ -55,12 +55,6 @@ class TestSlapOSCoreMixin(SlapOSTestCaseMixinWithAbort):
...
@@ -55,12 +55,6 @@ class TestSlapOSCoreMixin(SlapOSTestCaseMixinWithAbort):
reference
=
"TESTTREE-%s"
%
self
.
generateNewId
(),
reference
=
"TESTTREE-%s"
%
self
.
generateNewId
(),
destination_section
=
person
.
getRelativeUrl
())
destination_section
=
person
.
getRelativeUrl
())
class
TestERP5Type_acquireSecurityFromOwner
(
TestSlapOSCoreMixin
):
def
test
(
self
):
doc
=
self
.
createPerson
()
self
.
assertEqual
({
'Assignee'
:
[
self
.
user_id
]},
self
.
portal
.
ERP5Type_acquireSecurityFromOwner
([],
None
,
doc
,
None
))
class
TestPerson_getSecurityCategoryFromSelfShadow
(
TestSlapOSCoreMixin
):
class
TestPerson_getSecurityCategoryFromSelfShadow
(
TestSlapOSCoreMixin
):
def
test
(
self
):
def
test
(
self
):
doc
=
self
.
createPerson
()
doc
=
self
.
createPerson
()
...
@@ -207,31 +201,4 @@ class TestPayzenEvent_getSecurityCategoryFromUserr(TestSlapOSCoreMixin):
...
@@ -207,31 +201,4 @@ class TestPayzenEvent_getSecurityCategoryFromUserr(TestSlapOSCoreMixin):
self
.
portal
.
PayzenEvent_getSecurityCategoryFromUser
([
"destination_section"
],
None
,
event
,
None
))
self
.
portal
.
PayzenEvent_getSecurityCategoryFromUser
([
"destination_section"
],
None
,
event
,
None
))
self
.
assertEqual
({
'Assignee'
:
[
shadow_user_id
]},
self
.
assertEqual
({
'Assignee'
:
[
shadow_user_id
]},
self
.
portal
.
PayzenEvent_getSecurityCategoryFromUser
([
"couscous"
,
"destination_section"
],
None
,
event
,
None
))
self
.
portal
.
PayzenEvent_getSecurityCategoryFromUser
([
"couscous"
,
"destination_section"
],
None
,
event
,
None
))
class
TestERP5Type_getSecurityCategoryFromChildAssignmentList
(
TestSlapOSCoreMixin
):
def
test
(
self
):
person
=
self
.
createPerson
()
project
=
self
.
portal
.
project_module
.
newContent
(
portal_type
=
"Project"
)
person
.
newContent
(
portal_type
=
'Assignment'
,
destination_project_value
=
project
).
open
()
self
.
assertEqual
([],
self
.
portal
.
ERP5Type_getSecurityCategoryFromChildAssignmentList
([],
None
,
None
,
None
))
self
.
assertEqual
([{}],
self
.
portal
.
ERP5Type_getSecurityCategoryFromChildAssignmentList
([{}],
None
,
person
,
None
))
self
.
assertEqual
([{}],
self
.
portal
.
ERP5Type_getSecurityCategoryFromChildAssignmentList
([
"destination_section"
],
None
,
person
,
None
))
self
.
assertEqual
([{
'destination_project'
:
[
project
.
getRelativeUrl
()]}],
self
.
portal
.
ERP5Type_getSecurityCategoryFromChildAssignmentList
([
"destination_project"
],
None
,
person
,
None
))
self
.
assertEqual
([{
'destination_project'
:
[
project
.
getRelativeUrl
()]}],
self
.
portal
.
ERP5Type_getSecurityCategoryFromChildAssignmentList
(
[
"destination_section"
,
"destination_project"
],
None
,
person
,
None
))
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