Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ cython_debug/

.ruff_cache

uv.lock

local_test
crudadmin_data/
crudadmin_data/
17 changes: 6 additions & 11 deletions crudadmin/admin_interface/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,14 @@ async def get_current_user_inner(
raise UnauthorizedException("Could not validate credentials")

user_id = session_data.user_id
user = await self.db_config.crud_users.get(db=db, id=user_id)
user = await self.db_config.crud_users.get(
db=db,
id=user_id,
schema_to_select=AdminUserRead,
return_as_model=True,
)

if user:
if isinstance(user, dict):
try:
user = AdminUserRead(**user)
except Exception as e:
raise UnauthorizedException("Invalid user data") from e
elif not isinstance(user, AdminUserRead):
try:
user = AdminUserRead.from_orm(user)
except Exception as e:
raise UnauthorizedException("Invalid user data") from e
return user

logger.debug("User not found")
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies = [
"user-agents>=2.2.0",
"aiosqlite>=0.20.0",
"greenlet>=3.1.1",
"fastcrud>=0.15.12",
"fastcrud>=0.19.1",
]

[tool.hatch.build.targets.sdist]
Expand Down Expand Up @@ -127,6 +127,9 @@ markers = [
]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
filterwarnings = [
"ignore::DeprecationWarning:testcontainers",
]

[tool.ruff]
line-length = 88
Expand Down
Loading