forked from sr2/cloud-api
feat: iam dependencies
IAM endpoints now use dependencies to perform most initial database get requests. Issue #6
This commit is contained in:
parent
d4f1b73deb
commit
c6a2b301dc
4 changed files with 100 additions and 61 deletions
|
|
@ -1,7 +1,28 @@
|
|||
"""
|
||||
Module specific exceptions for <this module>
|
||||
Module specific exceptions for the IAM module
|
||||
|
||||
Exceptions:
|
||||
- List: Description
|
||||
- Exceptions: Description
|
||||
"""
|
||||
"""
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import HTTPException, status
|
||||
|
||||
|
||||
class GroupNotFoundException(HTTPException):
|
||||
def __init__(self, group_id: Optional[int] = None) -> None:
|
||||
detail = "Group not found" if group_id is None else f"User with ID '{group_id}' was not found."
|
||||
super().__init__(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail=detail,
|
||||
)
|
||||
|
||||
|
||||
class PermNotFoundException(HTTPException):
|
||||
def __init__(self, perm_id: Optional[int] = None) -> None:
|
||||
detail = "Permission not found" if perm_id is None else f"User with ID '{perm_id}' was not found."
|
||||
super().__init__(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail=detail,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue