capella-collab-manager
capella-collab-manager copied to clipboard
Create and apply verification classes for admin and project manager
Right now, we have single RoleVerification
and ProjectRoleVerification
classes. However, most often we have to use the RoleVerification
like this:
fastapi.Depends(
auth_injectables.RoleVerification(
required_role=users_model.Role.ADMIN
)
)
and the ProjectRoleVerification
like this:
fastapi.Depends(
auth_injectables.ProjectRoleVerification(
required_role=ProjectUserRole.MANAGER
)
)
This approach has the disadvantage that we always have to import the user and project users model, needed to provide the required_role
argument. Here I would suggest to create two new injectables AdminRoleVerification
and ManagerProjectRoleVerification
that simply use the abstract RoleVerification
and ProjectRoleVerification
with the predefined role (both injectables should still have an optional field verify: bool = true
).