Skip to content

Commit

Permalink
Groups: return API result OK when everything succeeded
Browse files Browse the repository at this point in the history
  • Loading branch information
lwesterhof committed Oct 9, 2023
1 parent 44bdfe7 commit 3450766
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,8 @@ def api_group_delete(ctx, group_name):
if sram_group:
if not sram.sram_delete_collaboration(ctx, co_identifier):
return api.Error('sram_error', 'Something went wrong deleting group "{}" in SRAM'.format(group_name))

return api.Result.ok()
except Exception:
return api.Error('error_internal', 'Something went wrong deleting group "{}". Please contact a system administrator'.format(group_name))

Expand Down Expand Up @@ -1221,6 +1223,7 @@ def api_group_user_add(ctx, username, group_name):
sram.invitation_mail_group_add_user(ctx, group_name, username.split('#')[0], co_identifier)
elif config.sram_flow == 'invitation':
sram.sram_put_collaboration_invitation(ctx, group_name, username.split('#')[0], co_identifier)

return api.Result.ok()
else:
return api.Error('policy_error', message)
Expand Down Expand Up @@ -1302,6 +1305,8 @@ def api_group_remove_user_from_group(ctx, username, group_name):
else:
if not sram.sram_delete_collaboration_membership(ctx, co_identifier, uid):
return api.Error('sram_error', 'Something went wrong removing {} from group "{}" in SRAM'.format(username, group_name))

return api.Result.ok()
except Exception:
return api.Error('error_internal', 'Something went wrong removing {} from group "{}". Please contact a system administrator'.format(username, group_name))

Expand Down

0 comments on commit 3450766

Please sign in to comment.