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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
erp5
Commits
62d8d3ac
Commit
62d8d3ac
authored
Dec 09, 2016
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use PAS API: take 2.
parent
882f0022
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
41 additions
and
42 deletions
+41
-42
bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserAssignment.py
...ortal_skins/erp5_banking_core/Baobab_getUserAssignment.py
+1
-1
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style/Base_activateSimpleView.py
...rtal_skins/erp5_deferred_style/Base_activateSimpleView.py
+3
-4
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_activateReport.py
...tal_skins/erp5_deferred_style_core/Base_activateReport.py
+3
-3
product/ERP5/Tool/NotificationTool.py
product/ERP5/Tool/NotificationTool.py
+13
-14
product/ERP5/tests/testAccounting_l10n_fr.py
product/ERP5/tests/testAccounting_l10n_fr.py
+3
-2
product/ERP5/tests/testQueryModule.py
product/ERP5/tests/testQueryModule.py
+2
-2
product/ERP5/tests/testTask.py
product/ERP5/tests/testTask.py
+2
-2
product/ERP5/tests/testTaskReportDivergence.py
product/ERP5/tests/testTaskReportDivergence.py
+1
-1
product/ERP5/tests/testZODBHistory.py
product/ERP5/tests/testZODBHistory.py
+1
-1
product/ERP5Form/tests/testGUIwithSecurity.py
product/ERP5Form/tests/testGUIwithSecurity.py
+1
-1
product/ERP5OOo/tests/testDeferredStyle.py
product/ERP5OOo/tests/testDeferredStyle.py
+2
-2
product/ERP5OOo/tests/testDms.py
product/ERP5OOo/tests/testDms.py
+1
-1
product/ERP5Security/ERP5KeyAuthPlugin.py
product/ERP5Security/ERP5KeyAuthPlugin.py
+5
-5
product/ERP5Security/tests/testERP5Security.py
product/ERP5Security/tests/testERP5Security.py
+1
-1
product/ERP5Type/tests/ERP5TypeTestCase.py
product/ERP5Type/tests/ERP5TypeTestCase.py
+1
-1
product/ERP5Type/tests/testDynamicClassGeneration.py
product/ERP5Type/tests/testDynamicClassGeneration.py
+1
-1
No files found.
bt5/erp5_banking_core/SkinTemplateItem/portal_skins/erp5_banking_core/Baobab_getUserAssignment.py
View file @
62d8d3ac
if
user_id
is
None
:
person
=
context
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
else
:
person_list
=
[
x
for
x
in
context
.
acl_users
.
searchUsers
(
login
=
user_id
,
exact_match
=
True
)
if
'path'
in
x
]
person_list
=
[
x
for
x
in
context
.
acl_users
.
searchUsers
(
id
=
user_id
,
exact_match
=
True
)
if
'path'
in
x
]
if
person_list
:
person
,
=
person_list
person
=
context
.
getPortalObject
().
restrictedTraverse
(
person
[
'path'
])
...
...
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style/Base_activateSimpleView.py
View file @
62d8d3ac
...
...
@@ -7,7 +7,8 @@ skin_name = request.get('deferred_portal_skin', portal.portal_skins.getDefaultSk
tag
=
'active-report-wrapped-%s'
%
random
.
randint
(
0
,
1000
)
priority
=
3
person_value
=
portal
.
ERP5Site_getAuthenticatedMemberPersonValue
()
user
=
portal
.
portal_membership
.
getAuthenticatedMember
()
person_value
=
user
.
getUserValue
()
if
person_value
is
None
:
portal
.
changeSkin
(
None
)
return
context
.
Base_redirect
(
'view'
,
keep_items
=
dict
(
...
...
@@ -20,8 +21,6 @@ if person_value.getDefaultEmailText('') in ('', None):
portal_status_message
=
translateString
(
"You haven't defined your email address"
)))
user_name
=
person_value
.
getReference
()
# save request parameters
# XXX we exclude some reserved names in a very ad hoc way
request_form
=
{}
...
...
@@ -62,7 +61,7 @@ activity_context.activate(
skin_name
=
skin_name
,
request_form
=
request_form
,
deferred_style_dialog_method
=
deferred_style_dialog_method
,
user_name
=
user
_name
,
user_name
=
user
.
getId
()
,
params
=
params
,
)
...
...
bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_activateReport.py
View file @
62d8d3ac
...
...
@@ -3,7 +3,8 @@ request = container.REQUEST
portal
=
context
.
getPortalObject
()
N_
=
portal
.
Base_translateString
person_value
=
portal
.
ERP5Site_getAuthenticatedMemberPersonValue
()
user
=
portal
.
portal_membership
.
getAuthenticatedMember
()
person_value
=
user
.
getUserValue
()
if
person_value
is
None
:
portal
.
changeSkin
(
None
)
return
context
.
Base_redirect
(
'view'
,
keep_items
=
dict
(
...
...
@@ -15,7 +16,6 @@ if person_value.getDefaultEmailText('') in ('', None):
portal_status_message
=
N_
(
"You haven't defined your email address"
)))
user_name
=
person_value
.
getReference
()
tag
=
'active-report-%s'
%
random
.
randint
(
0
,
1000
)
priority
=
2
format
=
request
.
get
(
'format'
,
''
)
...
...
@@ -43,7 +43,7 @@ context.activate(activity="SQLQueue", tag=tag, after_tag=after_tag,
priority
=
priority
).
Base_computeReportSection
(
form
=
form
.
getId
(),
request_other
=
request_other
,
user_name
=
user
_name
,
user_name
=
user
.
getId
(),
tag
=
tag
,
skin_name
=
skin_name
,
format
=
format
,
...
...
product/ERP5/Tool/NotificationTool.py
View file @
62d8d3ac
...
...
@@ -245,10 +245,9 @@ class NotificationTool(BaseTool):
This method provides only high-level functionality so that you can't use email address
for sender and recipient, or raw data for attachments.
sender -- a
login name(reference of Person document) or a Person
document
sender -- a
user id or a user
document
recipient -- a login name(reference of Person document) or a Person document,
a list of thereof
recipient -- a user id or a user document, or a list thereof
subject -- the subject of the message
...
...
@@ -282,14 +281,13 @@ class NotificationTool(BaseTool):
event_keyword_argument_dict -- additional keyword arguments which is used for
constructor of event document.
portal_type_list -- Portal Type of Users
TODO: support default notification email
"""
portal
=
self
.
getPortalObject
()
catalog_tool
=
getToolByName
(
self
,
'portal_catalog'
)
if
portal_type_list
is
None
:
portal_type_list
=
(
'Person'
,)
searchUsers
=
self
.
acl_users
.
searchUsers
def
getUserValueByUserId
(
user_id
):
user
,
=
searchUsers
(
id
=
user_id
,
exact_match
=
True
)
return
portal
.
restrictedTraverse
(
user
[
'path'
])
if
notifier_list
is
None
:
# XXX TODO: Use priority_level. Need to implement default notifier query system.
...
...
@@ -304,8 +302,7 @@ class NotificationTool(BaseTool):
# Find "From" Person
from_person
=
None
if
isinstance
(
sender
,
basestring
):
sender
=
catalog_tool
.
getResultValue
(
portal_type
=
portal_type_list
,
reference
=
sender
)
sender
=
getUserValueByUserId
(
sender
)
if
sender
is
not
None
:
email_value
=
sender
.
getDefaultEmailValue
()
if
email_value
is
not
None
and
email_value
.
asText
():
...
...
@@ -313,15 +310,17 @@ class NotificationTool(BaseTool):
# Find "To" Person list
to_person_list
=
[]
# XXX: evaluating a document as boolean is bad, as __bool__ may be
# overloaded to (for example) return False if there are no children (which
# would have unintended effects here).
if
recipient
:
if
not
isinstance
(
recipient
,
(
list
,
tuple
)):
recipient
=
(
recipient
,)
recipient
=
(
recipient
,
)
for
person
in
recipient
:
if
isinstance
(
person
,
basestring
):
person_value
=
catalog_tool
.
getResultValue
(
portal_type
=
portal_type_list
,
reference
=
person
)
person_value
=
getUserValueByUserId
(
person
)
if
person_value
is
None
:
raise
ValueError
(
"Can't find
person document which reference is '%s'"
%
person
)
raise
ValueError
(
"Can't find
user with id %r"
%
(
person
,
)
)
person
=
person_value
to_person_list
.
append
(
person
)
...
...
product/ERP5/tests/testAccounting_l10n_fr.py
View file @
62d8d3ac
...
...
@@ -74,7 +74,8 @@ class TestAccounting_l10n_fr(AccountingTestCase):
def
createUserAndlogin
(
self
,
name
=
username
):
# create a user with an email address
person_module
=
self
.
portal
.
person_module
if
person_module
.
_getOb
(
'pers'
,
None
)
is
None
:
person
=
person_module
.
_getOb
(
'pers'
,
None
)
if
person
is
None
:
person
=
person_module
.
newContent
(
id
=
'pers'
,
portal_type
=
'Person'
,
reference
=
self
.
username
,
first_name
=
self
.
first_name
,
...
...
@@ -85,7 +86,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
uf
=
self
.
portal
.
acl_users
uf
.
zodb_roles
.
assignRoleToPrincipal
(
'Assignor'
,
self
.
username
)
user
=
uf
.
getUser
ById
(
self
.
username
).
__of__
(
uf
)
user
=
uf
.
getUser
(
self
.
username
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
def
test_FEC
(
self
):
...
...
product/ERP5/tests/testQueryModule.py
View file @
62d8d3ac
...
...
@@ -99,8 +99,8 @@ class TestQueryModule(ERP5TypeTestCase):
assignment
.
validate
()
self
.
tic
()
uf
=
self
.
portal
.
acl_users
owner_user
=
uf
.
getUser
(
'owner_user'
).
__of__
(
uf
)
question_user
=
uf
.
getUser
(
'question_user'
).
__of__
(
uf
)
owner_user
=
uf
.
getUser
ById
(
'owner_user'
).
__of__
(
uf
)
question_user
=
uf
.
getUser
ById
(
'question_user'
).
__of__
(
uf
)
# add Author local roles on person and query modules
self
.
portal
.
person_module
.
manage_setLocalRoles
(
'owner_user'
,
[
'Author'
])
...
...
product/ERP5/tests/testTask.py
View file @
62d8d3ac
...
...
@@ -127,7 +127,7 @@ class TestTaskMixin:
# def stepLogin(self, **kw):
# portal = self.getPortal()
# uf = portal.acl_users
# if not uf.getUser('dummy'):
# if not uf.getUser
ById
('dummy'):
# uf._doAddUser('manager', '', ['Manager'], [])
# self.login('manager')
# person_module = portal.getDefaultModule(self.person_portal_type)
...
...
@@ -718,7 +718,7 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase):
simulation_tool
=
self
.
getPortal
().
portal_simulation
uf
=
self
.
getPortal
().
acl_users
if
not
uf
.
getUser
(
'manager'
):
if
not
uf
.
getUser
ById
(
'manager'
):
uf
.
_doAddUser
(
'manager'
,
''
,
[
'Manager'
],
[])
self
.
login
(
'manager'
)
try
:
...
...
product/ERP5/tests/testTaskReportDivergence.py
View file @
62d8d3ac
...
...
@@ -99,7 +99,7 @@ class TestTaskReportDivergenceMixin(TestTaskMixin, SecurityTestCase):
simulation_tool
=
portal
.
portal_simulation
rule_tool
=
portal
.
portal_rules
uf
=
self
.
getPortal
().
acl_users
if
not
uf
.
getUser
(
'manager'
):
if
not
uf
.
getUser
ById
(
'manager'
):
uf
.
_doAddUser
(
'manager'
,
''
,
[
'Manager'
],
[])
self
.
login
(
'manager'
)
simulation_tool
.
Base_setDefaultSecurity
()
...
...
product/ERP5/tests/testZODBHistory.py
View file @
62d8d3ac
...
...
@@ -73,7 +73,7 @@ class TestZODBHistory(ERP5TypeTestCase):
def
addUser
(
self
,
user_name
,
role
=
[
'Member'
,
'Owner'
,
'Assignor'
]):
""" Create a test user."""
uf
=
self
.
portal
.
acl_users
if
not
uf
.
getUser
(
user_name
):
if
not
uf
.
getUser
ById
(
user_name
):
uf
.
_doAddUser
(
user_name
,
''
,
role
,
[])
def
_clearCache
(
self
):
...
...
product/ERP5Form/tests/testGUIwithSecurity.py
View file @
62d8d3ac
...
...
@@ -61,7 +61,7 @@ class TestGUISecurity(ERP5TypeTestCase):
def
loginAs
(
self
,
id
=
'user'
):
uf
=
self
.
getPortal
().
acl_users
user
=
uf
.
getUser
ById
(
id
).
__of__
(
uf
)
user
=
uf
.
getUser
(
id
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
def
stepCreateObjects
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
...
...
product/ERP5OOo/tests/testDeferredStyle.py
View file @
62d8d3ac
...
...
@@ -72,8 +72,8 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
def
loginAsUser
(
self
,
username
):
uf
=
self
.
portal
.
acl_users
u
f
.
zodb_roles
.
assignRoleToPrincipal
(
'Manager'
,
username
)
u
ser
=
uf
.
getUserById
(
username
).
__of__
(
uf
)
u
ser
=
uf
.
getUser
(
username
).
__of__
(
uf
)
u
f
.
zodb_roles
.
assignRoleToPrincipal
(
'Manager'
,
user
.
getId
()
)
newSecurityManager
(
None
,
user
)
def
test_skin_selection
(
self
):
...
...
product/ERP5OOo/tests/testDms.py
View file @
62d8d3ac
...
...
@@ -2090,7 +2090,7 @@ return 1
"""
# Create a root level zope user
root_user_folder
=
self
.
getPortalObject
().
aq_parent
.
acl_users
if
not
root_user_folder
.
getUser
(
'zope_user'
):
if
not
root_user_folder
.
getUser
ById
(
'zope_user'
):
root_user_folder
.
_doAddUser
(
'zope_user'
,
''
,
[
'Manager'
,],
[])
self
.
commit
()
# Create document with good content
...
...
product/ERP5Security/ERP5KeyAuthPlugin.py
View file @
62d8d3ac
...
...
@@ -335,15 +335,15 @@ class ERP5KeyAuthPlugin(ERP5UserManager, CookieAuthHelper):
return
None
#Search the user by his login
user
_list
=
self
.
getUserByLogin
(
login
)
if
len
(
user_list
)
!=
1
:
user
=
self
.
getUser
(
login
)
if
user
is
None
:
raise
_AuthenticationFailure
()
user
=
user_list
[
0
]
user
_value
=
user
.
getUserValue
()
if
True
:
try
:
# get assignment list
assignment_list
=
[
x
for
x
in
user
.
contentValues
(
portal_type
=
"Assignment"
)
\
assignment_list
=
[
x
for
x
in
user
_value
.
contentValues
(
portal_type
=
"Assignment"
)
\
if
x
.
getValidationState
()
==
"open"
]
valid_assignment_list
=
[]
# check dates if exist
...
...
@@ -359,7 +359,7 @@ class ERP5KeyAuthPlugin(ERP5UserManager, CookieAuthHelper):
# validate
if
len
(
valid_assignment_list
)
>
0
:
return
(
login
,
login
)
return
(
user
.
getId
(),
user
.
getUserName
()
)
finally
:
pass
...
...
product/ERP5Security/tests/testERP5Security.py
View file @
62d8d3ac
...
...
@@ -115,7 +115,7 @@ class TestUserManagement(ERP5TypeTestCase):
from
Products.PluggableAuthService.interfaces.plugins
import
\
IAuthenticationPlugin
uf
=
self
.
getUserFolder
()
self
.
assertNotEquals
(
uf
.
getUser
ById
(
login
,
None
),
None
)
self
.
assertNotEquals
(
uf
.
getUser
(
login
),
None
)
for
plugin_name
,
plugin
in
uf
.
_getOb
(
'plugins'
).
listPlugins
(
IAuthenticationPlugin
):
if
plugin
.
authenticateCredentials
(
...
...
product/ERP5Type/tests/ERP5TypeTestCase.py
View file @
62d8d3ac
...
...
@@ -260,7 +260,7 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
'''Creates the default user.'''
uf
=
self
.
portal
.
acl_users
# do nothing if the user already exists
if
not
uf
.
getUser
(
user_name
):
if
not
uf
.
getUser
ById
(
user_name
):
uf
.
_doAddUser
(
user_name
,
'secret'
,
[
'Member'
],
[])
def
_setUpDummyMailHost
(
self
):
...
...
product/ERP5Type/tests/testDynamicClassGeneration.py
View file @
62d8d3ac
...
...
@@ -1419,7 +1419,7 @@ class _TestZodbComponent(SecurityTestCase):
otherwise it should not be importable at all
"""
uf
=
self
.
portal
.
acl_users
if
not
uf
.
getUser
(
'ERP5TypeTestCase_NonDeveloper'
):
if
not
uf
.
getUser
ById
(
'ERP5TypeTestCase_NonDeveloper'
):
uf
.
_doAddUser
(
'ERP5TypeTestCase_NonDeveloper'
,
''
,
[
'Manager'
,
'Member'
,
'Assignee'
,
'Assignor'
,
'Author'
,
'Auditor'
,
'Associate'
],
[])
...
...
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