From ac9cf77c9fa9ff37ae1cb7e1c6611f03ff453492 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Thu, 22 Aug 2024 14:30:14 +0800 Subject: [PATCH] fix permission --- server/contrib.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/contrib.py b/server/contrib.py index 8e5deee..6e0b7be 100644 --- a/server/contrib.py +++ b/server/contrib.py @@ -16,7 +16,7 @@ from uuid6 import uuid7 from config import TURNSTILE_SECRET_KEY, TURNSTILE_SITE_KEY, UTC -from server.auth import require_user_editor, require_user_login +from server.auth import require_user_login from server.base import AuthorizedRequest, BadRequestException, Request, http_client, pg from server.model import Patch, Wiki from server.router import Router @@ -58,7 +58,7 @@ class CreateSuggestion: @router -@litestar.post("/suggest", guards=[require_user_editor]) +@litestar.post("/suggest", guards=[require_user_login]) async def suggest_api( subject_id: int, data: Annotated[CreateSuggestion, Body(media_type=RequestEncodingType.URL_ENCODED)], @@ -160,7 +160,7 @@ async def delete_patch(patch_id: str, request: AuthorizedRequest) -> Redirect: raise NotAuthorizedException await conn.execute( - "update patch set deleted_at = $1 where id = $2 ", + "update patch set deleted_at = $1 where id = $2", datetime.now(tz=UTC), patch_id, )