Skip to content

Use FastAPI Depends() to handle authentication on endpoints #124

@jbriones1

Description

@jbriones1

Issue

We have many of the same permission checks on several endpoints to either check someone is a website administrator, elections officer, or just logged in. We should use FastAPI's dependency injection feature to automatically add these checks without having to duplicate the check, and the errors.

Code changes:

  • Refactor existing permissions checks to a small set of core functions
  • Update all endpoints that require these checks to use the dependencies decorator

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions