Skip to content

Commit

Permalink
Merge pull request #2623 from data-for-change/2586-add_test_roles_end…
Browse files Browse the repository at this point in the history
…point

added /test_role endpoint
  • Loading branch information
tkalir authored Apr 21, 2024
2 parents 51bffa6 + ad3732f commit 31c33ed
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions anyway/flask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,7 @@ def acc_in_area_query():

app.add_url_rule("/api/v1/news-flash", endpoint=None, view_func=news_flash, methods=["GET"])


@app.after_request
def add_allow_methods_header(response):
if request.path.startswith("/api/news-flash/"):
Expand Down Expand Up @@ -1547,3 +1548,19 @@ def get(self):
return get_downloaded_data(
args.get("format", "csv"), args.get("years_ago", DEFAULT_NUMBER_OF_YEARS_AGO)
)


def test_roles():
return test_roles_func()


@roles_accepted(
BE_CONST.Roles2Names.Authenticated.value,
BE_CONST.Roles2Names.Location_verification.value,
need_all_permission=True,
)
def test_roles_func():
return jsonify({"message": "Roles test successful!"}), 200


app.add_url_rule("/api/test_roles", endpoint=None, view_func=test_roles, methods=["GET"])

0 comments on commit 31c33ed

Please sign in to comment.