Police-Data-Accessibility-Project / data-sources-app

An API and UI for using and maintaining the Data Sources database
MIT License
2 stars 4 forks source link

Refactor `security.py` and add error message for insufficient permissions #310

Open maxachis opened 1 month ago

maxachis commented 1 month ago

Both is_valid and api_required are fairly dense with if-conditionals whose logic it can be difficult to parse without digging deep into it. This could benefit from refactoring.

In addition, there is no error message for when a user does not have the correct permissions to perform an action. For additional clarity, we probably want to add this.