Skip to content

Commit

Permalink
Merge pull request #6387 from OCHA-DAP/bugfix/HDX-9958-fix-missing-or…
Browse files Browse the repository at this point in the history
…g-name-new-account-email

PR: HDX-9958 missing org name in new account confirmation email
  • Loading branch information
alexandru-m-g authored Jul 17, 2024
2 parents 958db03 + eef0f79 commit 3618238
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions ckanext-hdx_org_group/ckanext/hdx_org_group/actions/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,10 @@ def hdx_user_invite(context, data_dict):

if group.is_organization:
_get_action('organization_member_create')(context, member_dict)
group_dict = _get_action('organization_show')(context,
{'id': data['group_id']})
group_dict = _get_action('organization_show')({}, {'id': data['group_id']})
else:
_get_action('group_member_create')(context, member_dict)
group_dict = _get_action('group_show')(context,
{'id': data['group_id']})
group_dict = _get_action('group_show')({}, {'id': data['group_id']})
try:
expiration_in_hours = int(config.get('hdx.password.invitation_reset_key.expiration_in_hours', 48))
reset_password.create_reset_key(user, expiration_in_minutes=60 * expiration_in_hours)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ def hdx_group_update(context, data_dict):
def hdx_group_delete(context, data_dict):
return _run_core_group_org_action(context, data_dict, core.delete.group_delete)

def _check_user_is_maintainer(context, user_id, org_id):
def _check_user_is_maintainer(user_id, org_id):
group = model.Group.get(org_id)
result = logic.get_action('package_search')(context, {
result = logic.get_action('package_search')({}, {
'q': '*:*',
'fq': 'maintainer:{0}, organization:{1}'.format(user_id, group.name),
'rows': 100,
Expand All @@ -314,7 +314,7 @@ def organization_member_delete(original_action, context, data_dict):
if not user_id:
user_id = model.User.get(data_dict.get('username')).id

if _check_user_is_maintainer(context, user_id, data_dict.get('id')):
if _check_user_is_maintainer(user_id, data_dict.get('id')):
abort(403, _('User is set as maintainer for datasets belonging to this org. Can\t delete, please change maintainer first'))

return original_action(context, data_dict)
Expand All @@ -326,7 +326,7 @@ def organization_member_create(original_action, context, data_dict):
user_id = model.User.get(data_dict.get('username')).id

if data_dict.get('role') == 'member':
if _check_user_is_maintainer(context, user_id, data_dict.get('id')):
if _check_user_is_maintainer(user_id, data_dict.get('id')):
abort(403, _('User is set as maintainer for datasets belonging to this org. Can\'t change role to \'member\', please change maintainer first'))

return original_action(context, data_dict)
Expand Down

0 comments on commit 3618238

Please sign in to comment.