feat(auth): enhance auxiliary authentication

This commit is contained in:
InfinityPacer
2024-10-19 03:16:04 +08:00
parent 386ff672a7
commit d8e7c7e6d7
9 changed files with 294 additions and 167 deletions
+14 -2
View File
@@ -5,8 +5,7 @@ from sqlalchemy.orm import Session
from app import schemas
from app.core.security import verify_token
from app.db import DbOper
from app.db import get_db
from app.db import DbOper, get_db
from app.db.models.user import User
@@ -52,6 +51,19 @@ class UserOper(DbOper):
用户管理
"""
def add(self, **kwargs):
"""
新增用户
"""
user = User(**kwargs)
user.create(self._db)
def get_by_name(self, name: str) -> User:
"""
根据用户名获取用户
"""
return User.get_by_name(self._db, name)
def get_permissions(self, name: str) -> dict:
"""
获取用户权限