fastapi-mongo-base 1.3.7__tar.gz → 1.3.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastapi_mongo_base-1.3.7/src/fastapi_mongo_base.egg-info → fastapi_mongo_base-1.3.8}/PKG-INFO +1 -1
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/pyproject.toml +1 -1
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/core/errors/resource_errors.py +2 -1
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/utils/usso_routes.py +17 -1
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8/src/fastapi_mongo_base.egg-info}/PKG-INFO +1 -1
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/LICENSE.txt +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/MANIFEST.in +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/README.md +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/docs/boilerplate.md +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/docs/changelog.md +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/docs/contributing.md +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/docs/endpoints.md +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/docs/extra.css +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/docs/index.md +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/docs/installation.md +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/docs/license.md +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/docs/quickstart.md +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/docs/settings.md +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/docs/tutorial.md +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/docs/usage.md +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/mkdocs.yml +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/pytest.ini +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/setup.cfg +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/__init__.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/core/__init__.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/core/app_factory.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/core/config.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/core/db.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/core/enums.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/core/error_responses.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/core/errors/mongodb_errors.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/core/exceptions.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/models.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/py.typed +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/routes.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/schemas.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/sql.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/tasks.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/utils/__init__.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/utils/basic.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/utils/bsontools.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/utils/timezone.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base.egg-info/SOURCES.txt +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base.egg-info/dependency_links.txt +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base.egg-info/requires.txt +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base.egg-info/top_level.txt +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/tests/__init__.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/tests/app/__init__.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/tests/app/logs/app.log +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/tests/app/main.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/tests/app/server.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/tests/conftest.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/tests/test_apis.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/tests/test_app.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/tests/test_mongodb_errors.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/tests/test_openapi_errors.py +0 -0
- {fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/tests/test_resource_errors.py +0 -0
{fastapi_mongo_base-1.3.7/src/fastapi_mongo_base.egg-info → fastapi_mongo_base-1.3.8}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-mongo-base
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.8
|
|
4
4
|
Summary: A simple boilerplate application, including models and schemas and abstract router, for FastAPI with MongoDB
|
|
5
5
|
Author-email: Mahdi Kiani <mahdikiany@gmail.com>
|
|
6
6
|
Maintainer-email: Mahdi Kiani <mahdikiany@gmail.com>
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "fastapi-mongo-base"
|
|
7
|
-
version = "1.3.
|
|
7
|
+
version = "1.3.8"
|
|
8
8
|
description = "A simple boilerplate application, including models and schemas and abstract router, for FastAPI with MongoDB"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -13,6 +13,7 @@ class ResourceError(BaseHTTPException):
|
|
|
13
13
|
|
|
14
14
|
def __init__(
|
|
15
15
|
self,
|
|
16
|
+
error_code: str | None = None,
|
|
16
17
|
detail: str | None = None,
|
|
17
18
|
message: dict | None = None,
|
|
18
19
|
**kwargs: object,
|
|
@@ -20,7 +21,7 @@ class ResourceError(BaseHTTPException):
|
|
|
20
21
|
"""Initialize ResourceError with optional detail, message, and data."""
|
|
21
22
|
super().__init__(
|
|
22
23
|
status_code=self.status_code,
|
|
23
|
-
error_code=self.error_code,
|
|
24
|
+
error_code=error_code or self.error_code,
|
|
24
25
|
detail=detail or self.message_en,
|
|
25
26
|
message=message,
|
|
26
27
|
**kwargs,
|
{fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/utils/usso_routes.py
RENAMED
|
@@ -420,7 +420,8 @@ class AbstractOwnedUSSORouter(AbstractUSSORouterBase):
|
|
|
420
420
|
self_action: The action for owned resource (default "owner").
|
|
421
421
|
self_access: Allow list access to own resources (default True).
|
|
422
422
|
workspace_only: When True, owner_id must be a workspace_id;
|
|
423
|
-
raises 400 if user has no workspace
|
|
423
|
+
raises 400 if user has no workspace and no broad
|
|
424
|
+
resource scope (default False).
|
|
424
425
|
"""
|
|
425
426
|
|
|
426
427
|
owner_attr: str = "owner_id"
|
|
@@ -438,6 +439,20 @@ class AbstractOwnedUSSORouter(AbstractUSSORouterBase):
|
|
|
438
439
|
Callable[[type["AbstractOwnedUSSORouter"], UserData], str] | None
|
|
439
440
|
) = None # same as get_owner_id
|
|
440
441
|
|
|
442
|
+
def _has_broad_resource_access(self, user: UserData) -> bool:
|
|
443
|
+
"""
|
|
444
|
+
Return True when the user has an unfiltered scope on this resource.
|
|
445
|
+
|
|
446
|
+
Users with e.g. ``*:*`` or ``create:ns/service/resource`` (no query
|
|
447
|
+
filters) may operate without ``workspace_id`` in their JWT.
|
|
448
|
+
"""
|
|
449
|
+
return authorization.check_access(
|
|
450
|
+
user_scopes=user.scopes or [],
|
|
451
|
+
resource_path=self.resource_path,
|
|
452
|
+
action="read",
|
|
453
|
+
filters=None,
|
|
454
|
+
)
|
|
455
|
+
|
|
441
456
|
def _resolve_owner_id(self, user: UserData) -> str:
|
|
442
457
|
"""Resolve owner_id, raising a clear error if workspace is missing."""
|
|
443
458
|
owner_id = self.get_owner_id(user)
|
|
@@ -445,6 +460,7 @@ class AbstractOwnedUSSORouter(AbstractUSSORouterBase):
|
|
|
445
460
|
self.workspace_only
|
|
446
461
|
and user.claims.get("sub_type") != "agent"
|
|
447
462
|
and not owner_id
|
|
463
|
+
and not self._has_broad_resource_access(user)
|
|
448
464
|
):
|
|
449
465
|
raise exceptions.BaseHTTPException(
|
|
450
466
|
status_code=400,
|
{fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8/src/fastapi_mongo_base.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-mongo-base
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.8
|
|
4
4
|
Summary: A simple boilerplate application, including models and schemas and abstract router, for FastAPI with MongoDB
|
|
5
5
|
Author-email: Mahdi Kiani <mahdikiany@gmail.com>
|
|
6
6
|
Maintainer-email: Mahdi Kiani <mahdikiany@gmail.com>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/core/__init__.py
RENAMED
|
File without changes
|
{fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/core/app_factory.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/core/error_responses.py
RENAMED
|
File without changes
|
|
File without changes
|
{fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/core/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/utils/bsontools.py
RENAMED
|
File without changes
|
{fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base/utils/timezone.py
RENAMED
|
File without changes
|
{fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base.egg-info/requires.txt
RENAMED
|
File without changes
|
{fastapi_mongo_base-1.3.7 → fastapi_mongo_base-1.3.8}/src/fastapi_mongo_base.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|