Skip to content

Commit

Permalink
Merge pull request #2147 from Agenta-AI/feature/age-1139-project-3-sc…
Browse files Browse the repository at this point in the history
…ope-api_key-by-project_id-and-keep-the-link-to

[Dependency]: Access control in API Keys
  • Loading branch information
jp-agenta authored Nov 5, 2024
2 parents ae779f3 + f6880f8 commit 8b9981c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
5 changes: 1 addition & 4 deletions agenta-backend/agenta_backend/routers/app_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,8 @@ async def create_app(
Permission.CREATE_APPLICATION,
)

workspace_id_from_apikey = await db_manager_ee.get_workspace_id_from_apikey(
api_key_from_headers, request.state.user_id
)
if payload.workspace_id is None:
payload.workspace_id = workspace_id_from_apikey
payload.workspace_id = request.state.workspace_id

try:
user_org_workspace_data = await get_user_org_and_workspace_id(
Expand Down
3 changes: 1 addition & 2 deletions agenta-backend/agenta_backend/services/app_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,9 @@ async def start_variant(
)
if isCloudEE():
user = await db_manager.get_user(user_uid=user_uid)
project = await db_manager_ee.get_project_by_id(project_id=project_id)
api_key = await api_key_service.create_api_key(
str(user.id),
workspace_id=str(project.workspace_id),
project_id=project_id,
expiration_date=None,
hidden=True,
)
Expand Down

0 comments on commit 8b9981c

Please sign in to comment.