diff --git a/backend/apps/system/api/apikey.py b/backend/apps/system/api/apikey.py index 051843ef..4887e247 100644 --- a/backend/apps/system/api/apikey.py +++ b/backend/apps/system/api/apikey.py @@ -20,7 +20,7 @@ async def grid(session: SessionDep, current_user: CurrentUser) -> list[ApikeyGri @router.post("") @system_log(LogConfig(operation_type=OperationType.CREATE, module=OperationModules.API_KEY,result_id_expr='result.self')) async def create(session: SessionDep, current_user: CurrentUser): - count = session.exec(select(func.count()).select_from(ApiKeyModel)).one() + count = session.exec(select(func.count()).select_from(ApiKeyModel).where(ApiKeyModel.uid == current_user.id)).one() if count >= 5: raise ValueError("Maximum of 5 API keys allowed") access_key = secrets.token_urlsafe(16) diff --git a/frontend/src/components/layout/Apikey.vue b/frontend/src/components/layout/Apikey.vue index 81501170..99e51761 100644 --- a/frontend/src/components/layout/Apikey.vue +++ b/frontend/src/components/layout/Apikey.vue @@ -1,6 +1,8 @@