Skip to content

Commit

Permalink
[IMP] Removed method which was duplicated
Browse files Browse the repository at this point in the history
  • Loading branch information
c8y3 committed Oct 11, 2024
1 parent 2d17510 commit 939c97b
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions source/app/blueprints/rest/manage/manage_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,44 +275,6 @@ def manage_user_cac_delete_cases(cur_id):
return response_error(msg=logs)


@manage_users_rest_blueprint.route('/manage/users/<int:cur_id>/case-access/delete', methods=['POST'])
@ac_api_requires(Permissions.server_administrator)
def manage_user_cac_delete_case(cur_id):

user = get_user(cur_id)
if not user:
return response_error("Invalid user ID")

if not request.is_json:
return response_error("Invalid request")

data = request.get_json()
if not data:
return response_error("Invalid request")

if not isinstance(data.get('case'), int):
return response_error("Expecting cases as int")

try:

success, logs = remove_case_access_from_user(user.id, data.get('case'))
db.session.commit()

except Exception as e:
log.error("Error while removing cases access from user: {}".format(e))
log.error(traceback.format_exc())
return response_error(msg=str(e))

if success:
track_activity(f"case access for case {data.get('case')} deleted for user {user.user}", ctx_less=True)

user = get_user_details(cur_id)

return response_success(msg="User case access updated", data=user)

return response_error(msg=logs)


@manage_users_rest_blueprint.route('/manage/users/update/<int:cur_id>', methods=['POST'])
@ac_api_requires(Permissions.server_administrator)
def update_user_api(cur_id):
Expand Down

0 comments on commit 939c97b

Please sign in to comment.