From 025413b4fc28726a8014af6fd154da5da7035492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20G=C3=B6bel?= <dgoebel@techfak.uni-bielefeld.de> Date: Fri, 17 Nov 2023 15:29:54 +0100 Subject: [PATCH] Filter by correct UID when listing all buckets with UID #70 --- .pre-commit-config.yaml | 6 +++--- Dockerfile-Gunicorn | 2 +- app/api/endpoints/buckets.py | 4 ++-- requirements-dev.txt | 4 ++-- requirements.txt | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d98118b..fc02d00 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,13 +31,13 @@ repos: files: app args: [-c] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.6.1 + rev: v1.7.0 hooks: - id: mypy files: app args: [--config=pyproject.toml] additional_dependencies: - - boto3-stubs-lite[s3] + - boto3-stubs-lite[s3]>=1.29.0,<1.30.0 - sqlalchemy>=2.0.0,<2.1.0 - - pydantic>=2.4.0,<2.5.0 + - pydantic>=2.5.0,<2.6.0 - types-requests diff --git a/Dockerfile-Gunicorn b/Dockerfile-Gunicorn index 64c2d08..79f82be 100644 --- a/Dockerfile-Gunicorn +++ b/Dockerfile-Gunicorn @@ -4,7 +4,7 @@ ENV PORT=8000 RUN pip install --no-cache-dir httpx[cli] -HEALTHCHECK --interval=35s --timeout=4s CMD httpx http://localhost:$PORT/health || exit 1 +HEALTHCHECK --interval=30s --timeout=4s CMD httpx http://localhost:$PORT/health || exit 1 COPY ./scripts/prestart.sh /app/prestart.sh COPY ./requirements.txt /app/requirements.txt diff --git a/app/api/endpoints/buckets.py b/app/api/endpoints/buckets.py index 4b255de..eaad0ef 100644 --- a/app/api/endpoints/buckets.py +++ b/app/api/endpoints/buckets.py @@ -92,14 +92,14 @@ async def list_buckets( All the buckets for which the user has READ permissions. """ current_span = trace.get_current_span() - if user is not None: + if user is not None: # pragma: no cover current_span.set_attribute("uid", user) current_span.set_attribute("bucket_type", bucket_type.name) await authorization("list_all" if user is None or current_user.uid != user else "list") if user is None: buckets = await CRUDBucket.get_all(db) else: - buckets = await CRUDBucket.get_for_user(db, current_user.uid, bucket_type) + buckets = await CRUDBucket.get_for_user(db, user, bucket_type) def map_buckets(bucket: Bucket) -> BucketOutSchema: # define function to fetch objects only one time for each bucket diff --git a/requirements-dev.txt b/requirements-dev.txt index 33c6b6f..92dafe2 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -7,9 +7,9 @@ coverage[toml]>=7.3.0,<7.4.0 ruff>=0.1.0,<0.2.0 black>=23.11.0,<23.12.0 isort>=5.12.0,<5.13.0 -mypy>=1.6.0,<1.7.0 +mypy>=1.7.0,<1.8.0 # stubs for mypy -boto3-stubs-lite[s3]>=1.28.0,<1.29.0 +boto3-stubs-lite[s3]>=1.29.0,<1.30.0 types-requests # Miscellaneous pre-commit>=3.5.0,<3.6.0 diff --git a/requirements.txt b/requirements.txt index 03e1aa6..9629ad6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,8 +4,8 @@ clowmdb>=2.2.0,<2.3.0 # Webserver packages anyio>=3.7.0,<4.0.0 fastapi>=0.104.0,<0.105.0 -pydantic>=2.4.0,<2.5.0 -pydantic-settings>=2.0.0,<2.1.0 +pydantic>=2.5.0,<2.6.0 +pydantic-settings>=2.1.0,<2.2.0 uvicorn>=0.24.0,<0.25.0 # Database packages PyMySQL>=1.1.0,<1.2.0 @@ -14,7 +14,7 @@ aiomysql>=0.2.0,<0.3.0 # Security packages authlib>=1.2.0,<1.3.0 # Ceph and S3 packages -boto3>=1.28.0,<1.29.0 +boto3>=1.29.0,<1.30.0 rgwadmin>=2.4.0,<2.5.0 # Miscellaneous tenacity>=8.2.0,<8.3.0 -- GitLab