Skip to content
This repository was archived by the owner on Jan 28, 2026. It is now read-only.

Commit ff18082

Browse files
authored
Merge pull request #24 from eea/develop
Develop
2 parents 82594f7 + 5ce6dfc commit ff18082

7 files changed

Lines changed: 29 additions & 10 deletions

File tree

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pipeline {
8686

8787
"Plone5 & Python3": {
8888
node(label: 'docker') {
89-
sh '''docker run -i --rm --name="$BUILD_TAG-plone5py3" -e GIT_BRANCH="$BRANCH_NAME" -e VERSIONS="validate-email=3.0.0rc2" -e ADDONS="$GIT_NAME[test]" -e DEVELOP="src/$GIT_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plone-test:5-python3 -v -vv -s $GIT_NAME'''
89+
sh '''docker run -i --rm --name="$BUILD_TAG-plone5py3" -e GIT_BRANCH="$BRANCH_NAME" -e ADDONS="$GIT_NAME[test]" -e DEVELOP="src/$GIT_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plone-test:5-python3 -v -vv -s $GIT_NAME'''
9090
}
9191
}
9292
)

docs/HISTORY.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
=========
33

4+
2.6 - (2021-04-09)
5+
---------------------------
6+
* remove dependency on validate_email [dumitval]
7+
* re-allow NFPs to edit users from orgs of their country [dumitval]
8+
49
2.5 - (2021-01-09)
510
---------------------------
611
* remove NFP edit permission on "own country" users [dumitval]

eea/userseditor/userdetails.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from eea.ldapadmin import ldap_config
1515
from eea.ldapadmin.ldap_config import _get_ldap_agent
1616
from eea.ldapadmin.logic_common import _is_authenticated
17+
from eea.ldapadmin.ui_common import nfp_can_change_user
1718
from eea.userseditor.permissions import EIONET_EDIT_USERS
1819
from eea.userseditor.users_editor import load_template
1920
from ldap import SCOPE_BASE
@@ -153,6 +154,14 @@ def can_edit_users(self):
153154

154155
return bool(user.has_permission(EIONET_EDIT_USERS, self.context))
155156

157+
def can_edit_user(self, uid):
158+
""" check the the authenticated user can edit a specific user
159+
This can mean he has the edit users permission or is an NFP and the
160+
target user is member of an organisation from the NFP's country """
161+
user = self.context.REQUEST.AUTHENTICATED_USER
162+
return (user.has_permission(EIONET_EDIT_USERS, self.context) or
163+
nfp_can_change_user(self, uid, no_org=False))
164+
156165
def can_view_roles(self):
157166
"""can_view_roles."""
158167
if not self.is_authenticated():

eea/userseditor/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.5
1+
2.6

eea/userseditor/views/userdetails.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ class UserDetailsView(BrowserView):
1818
def __call__(self):
1919
REQUEST = self.request
2020
uid = REQUEST.form.get('uid')
21+
auth_user = REQUEST.AUTHENTICATED_USER
22+
is_auth = ('Authenticated' in auth_user.getRoles())
2123

2224
if not uid:
23-
# a missing uid can only mean this page is called by accident
24-
25-
return
25+
if is_auth:
26+
uid = auth_user.getId()
27+
else:
28+
# a missing uid can only mean this page is called by accident
29+
return
2630
date_for_roles = REQUEST.form.get('date_for_roles')
2731

2832
if "," in uid:
@@ -33,7 +37,6 @@ def __call__(self):
3337
multi = None
3438
user, roles = self.context._prepare_user_page(uid)
3539

36-
is_auth = ('Authenticated' in REQUEST.AUTHENTICATED_USER.getRoles())
3740
# we can only connect to ldap with bind=True if we have an
3841
# authenticated user
3942
agent = self.context._get_ldap_agent(bind=is_auth)

eea/userseditor/zpt/userdetails/index.zpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,16 @@
8585
<div xmlns:foaf="http://xmlns.com/foaf/0.1/"
8686
tal:attributes="about string:${common/portal_url}/users/${view/user/uid}" typeof="foaf:Person"
8787
tal:define="user view/user;
88+
uid user/uid;
8889
disabled python:user.get('status') == 'disabled';
8990
can_view_roles common/can_view_roles;
91+
can_edit_user python:common.can_edit_user(uid);
9092
can_edit_users common/can_edit_users;
9193
is_authenticated common/is_authenticated;">
9294

9395
<h1 property="foaf:name">
9496
<tal:block content="user/full_name" />
95-
<a tal:condition="can_edit_users"
97+
<a tal:condition="can_edit_user"
9698
style="background:none"
9799
tal:attributes="href string:${common/portal_url}/eionet-account-tools/eionet_account_tools/users/edit_user?id=${user/uid}">
98100
<img src="/++resource++eea.userseditor-www/edit.gif" alt="Edit" />
@@ -102,7 +104,7 @@
102104
<div class="figure figure-right" style="clear: both"
103105
tal:condition="python:user['jpegPhoto'] and (not disabled or can_edit_users)">
104106
<div class="figure-image">
105-
<a tal:attributes="href string:userphoto_jpeg?uid=${user/uid}">
107+
<a>
106108
<img tal:attributes="src string:${common/base_url}/userphoto_jpeg?uid=${user/uid}" class="mouseclickpop"
107109
alt="photo of person" style="max-width:200px; max-height:150px" />
108110
</a>

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
platforms=['OS Independent'],
2222
zip_safe=False,
2323
install_requires=[
24-
'eea.usersdb>=1.3.40',
24+
'eea.usersdb>=2.6',
2525
'deform',
2626
'phonenumbers',
2727
'six'
2828
],
2929
extras_require={
3030
'test': [
31-
'eea.ldapadmin',
31+
'eea.ldapadmin>=2.8',
3232
],
3333
},
3434
)

0 commit comments

Comments
 (0)