missing 401

This commit is contained in:
Jörn-Michael Miehe 2022-04-01 17:15:56 +00:00
parent 5b68f5ef7e
commit e6c270a0fa
2 changed files with 3 additions and 4 deletions

View file

@ -32,7 +32,7 @@ class Responses:
"content": None,
}
NEEDS_USER = {
"description": "Must be logged in",
"description": "Not logged in",
"content": None,
}
NEEDS_PERMISSION = {

View file

@ -4,10 +4,9 @@
from fastapi import APIRouter, Depends, HTTPException, status
from ..config import Config
from ..db import User
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"])
@ -17,11 +16,11 @@ router = APIRouter(prefix="/service", tags=["service"])
responses={
status.HTTP_200_OK: Responses.OK,
status.HTTP_400_BAD_REQUEST: Responses.NOT_INSTALLED,
status.HTTP_401_UNAUTHORIZED: Responses.NEEDS_USER,
status.HTTP_403_FORBIDDEN: Responses.NEEDS_PERMISSION,
},
)
async def init_pki(
_: Config = Depends(get_current_config),
current_user: User = Depends(get_current_user),
) -> None: