missing 401
This commit is contained in:
parent
5b68f5ef7e
commit
e6c270a0fa
2 changed files with 3 additions and 4 deletions
|
@ -32,7 +32,7 @@ class Responses:
|
||||||
"content": None,
|
"content": None,
|
||||||
}
|
}
|
||||||
NEEDS_USER = {
|
NEEDS_USER = {
|
||||||
"description": "Must be logged in",
|
"description": "Not logged in",
|
||||||
"content": None,
|
"content": None,
|
||||||
}
|
}
|
||||||
NEEDS_PERMISSION = {
|
NEEDS_PERMISSION = {
|
||||||
|
|
|
@ -4,10 +4,9 @@
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, status
|
from fastapi import APIRouter, Depends, HTTPException, status
|
||||||
|
|
||||||
from ..config import Config
|
|
||||||
from ..db import User
|
from ..db import User
|
||||||
from ..easyrsa import CertificateType, EasyRSA
|
from ..easyrsa import CertificateType, EasyRSA
|
||||||
from ._common import Responses, get_current_config, get_current_user
|
from ._common import Responses, get_current_user
|
||||||
|
|
||||||
router = APIRouter(prefix="/service", tags=["service"])
|
router = APIRouter(prefix="/service", tags=["service"])
|
||||||
|
|
||||||
|
@ -17,11 +16,11 @@ router = APIRouter(prefix="/service", tags=["service"])
|
||||||
responses={
|
responses={
|
||||||
status.HTTP_200_OK: Responses.OK,
|
status.HTTP_200_OK: Responses.OK,
|
||||||
status.HTTP_400_BAD_REQUEST: Responses.NOT_INSTALLED,
|
status.HTTP_400_BAD_REQUEST: Responses.NOT_INSTALLED,
|
||||||
|
status.HTTP_401_UNAUTHORIZED: Responses.NEEDS_USER,
|
||||||
status.HTTP_403_FORBIDDEN: Responses.NEEDS_PERMISSION,
|
status.HTTP_403_FORBIDDEN: Responses.NEEDS_PERMISSION,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
async def init_pki(
|
async def init_pki(
|
||||||
_: Config = Depends(get_current_config),
|
|
||||||
current_user: User = Depends(get_current_user),
|
current_user: User = Depends(get_current_user),
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue