Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
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
Jérome Perrin
erp5
Commits
a868860f
Commit
a868860f
authored
Jan 12, 2017
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: new Base_getLoginValueByUserName script
parent
b8dc32ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
0 deletions
+96
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getLoginValueByUserName.py
...em/portal_skins/erp5_core/Base_getLoginValueByUserName.py
+12
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getLoginValueByUserName.xml
...m/portal_skins/erp5_core/Base_getLoginValueByUserName.xml
+70
-0
product/ERP5Security/tests/testERP5Security.py
product/ERP5Security/tests/testERP5Security.py
+14
-0
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getLoginValueByUserName.py
0 → 100644
View file @
a868860f
# Proxy roles: Manager to access searchUsers
if
REQUEST
is
not
None
:
return
login_path_set
=
{
login
[
'path'
]
for
login
in
sum
([
user
[
'login_list'
]
for
user
in
context
.
acl_users
.
searchUsers
(
login
=
user_name
,
exact_match
=
True
,
)
if
'login_list'
in
user
],
[])
}
if
login_path_set
:
login_path
,
=
login_path_set
return
context
.
getPortalObject
().
restrictedTraverse
(
login_path
)
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getLoginValueByUserName.xml
0 → 100644
View file @
a868860f
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<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>
user_name, REQUEST=None
</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>
Base_getLoginValueByUserName
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5Security/tests/testERP5Security.py
View file @
a868860f
...
...
@@ -633,6 +633,20 @@ class TestUserManagement(ERP5TypeTestCase):
self
.
assertEqual
(
None
,
self
.
portal
.
Base_getUserValueByUserId
(
"not a user_id"
))
def
test_Base_getLoginValueByUserName
(
self
):
user_id1
,
login1
,
_
=
self
.
_makePerson
()
user_id2
,
login2
,
_
=
self
.
_makePerson
()
login_value1
=
self
.
portal
.
Base_getLoginValueByUserName
(
login1
)
self
.
assertEqual
(
'Person'
,
login_value1
.
getPortalType
())
self
.
assertEqual
(
login1
,
login_value1
.
getReference
())
login_value2
=
self
.
portal
.
Base_getLoginValueByUserName
(
login2
)
self
.
assertEqual
(
'Person'
,
login_value2
.
getPortalType
())
self
.
assertEqual
(
login2
,
login_value2
.
getReference
())
self
.
assertEqual
(
None
,
self
.
portal
.
Base_getLoginValueByUserName
(
"not a login"
))
class
TestUserManagementExternalAuthentication
(
TestUserManagement
):
def
getTitle
(
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