Skip to content

Commit 76a47d7

Browse files
committed
update orgs router to allow shared secret when determining org
1 parent f5fe0c6 commit 76a47d7

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

backend/btrixcloud/orgs.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,18 @@
1212
from uuid import UUID, uuid4
1313
from tempfile import NamedTemporaryFile
1414

15-
from typing import Optional, TYPE_CHECKING, Dict, Callable, List, AsyncGenerator, Any
15+
from typing import (
16+
Awaitable,
17+
Optional,
18+
TYPE_CHECKING,
19+
Dict,
20+
Callable,
21+
List,
22+
AsyncGenerator,
23+
Any,
24+
)
1625

26+
from motor.motor_asyncio import AsyncIOMotorDatabase
1727
from pydantic import ValidationError
1828
from pymongo import ReturnDocument
1929
from pymongo.collation import Collation
@@ -1498,13 +1508,13 @@ async def inc_org_bytes_stored_field(self, oid: UUID, field: str, size: int):
14981508
# ============================================================================
14991509
# pylint: disable=too-many-statements, too-many-arguments
15001510
def init_orgs_api(
1501-
app,
1502-
mdb,
1511+
app: APIRouter,
1512+
mdb: AsyncIOMotorDatabase[Any],
15031513
user_manager: UserManager,
15041514
crawl_manager: CrawlManager,
15051515
invites: InviteOps,
1506-
user_dep: Callable,
1507-
user_or_shared_secret_dep: Callable,
1516+
user_dep: Callable[[str], Awaitable[User]],
1517+
user_or_shared_secret_dep: Callable[[str], Awaitable[User]],
15081518
):
15091519
"""Init organizations api router for /orgs"""
15101520
# pylint: disable=too-many-locals,invalid-name
@@ -1568,7 +1578,7 @@ async def org_public(oid: UUID):
15681578

15691579
router = APIRouter(
15701580
prefix="/orgs/{oid}",
1571-
dependencies=[Depends(org_dep)],
1581+
dependencies=[Depends(org_or_shared_secret_dep)],
15721582
responses={404: {"description": "Not found"}},
15731583
)
15741584

0 commit comments

Comments
 (0)