Skip to content

Commit

Permalink
rename compute session permission ctx methods
Browse files Browse the repository at this point in the history
  • Loading branch information
fregataa committed Oct 2, 2024
1 parent b3fca22 commit f768839
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/ai/backend/manager/models/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -2012,12 +2012,12 @@ async def build_ctx_in_domain_scope(
ctx: ClientContext,
scope: DomainScope,
) -> ComputeSessionPermissionContext:
permission_ctx = await self.build_in_domain_scope(ctx, scope.domain_name)
_user_perm_ctx = await self.build_in_user_scope_in_domain(
permission_ctx = await self._build_at_domain_scope_non_recursively(ctx, scope.domain_name)
_user_perm_ctx = await self._build_at_user_scope_in_domain(
ctx, ctx.user_id, scope.domain_name
)
permission_ctx.merge(_user_perm_ctx)
_project_perm_ctx = await self.build_in_project_scopes_in_domain(ctx, scope.domain_name)
_project_perm_ctx = await self._build_at_project_scopes_in_domain(ctx, scope.domain_name)
permission_ctx.merge(_project_perm_ctx)
return permission_ctx

Expand All @@ -2026,8 +2026,8 @@ async def build_ctx_in_project_scope(
ctx: ClientContext,
scope: ProjectScope,
) -> ComputeSessionPermissionContext:
permission_ctx = await self.build_in_project_scope(ctx, scope.project_id)
_user_perm_ctx = await self.build_in_user_scope(ctx, ctx.user_id)
permission_ctx = await self._build_at_project_scope_non_recursively(ctx, scope.project_id)
_user_perm_ctx = await self._build_at_user_scope_non_recursively(ctx, ctx.user_id)
permission_ctx.merge(_user_perm_ctx)
return permission_ctx

Expand All @@ -2036,9 +2036,9 @@ async def build_ctx_in_user_scope(
ctx: ClientContext,
scope: UserRBACScope,
) -> ComputeSessionPermissionContext:
return await self.build_in_user_scope(ctx, scope.user_id)
return await self._build_at_user_scope_non_recursively(ctx, scope.user_id)

async def build_in_domain_scope(
async def _build_at_domain_scope_non_recursively(
self,
ctx: ClientContext,
domain_name: str,
Expand All @@ -2050,7 +2050,7 @@ async def build_in_domain_scope(
)
return result

async def build_in_user_scope_in_domain(
async def _build_at_user_scope_in_domain(
self,
ctx: ClientContext,
user_id: UUID,
Expand All @@ -2073,7 +2073,7 @@ async def build_in_user_scope_in_domain(
)
return result

async def build_in_project_scopes_in_domain(
async def _build_at_project_scopes_in_domain(
self,
ctx: ClientContext,
domain_name: str,
Expand All @@ -2087,11 +2087,11 @@ async def build_in_project_scopes_in_domain(
)
for row in await self.db_session.scalars(_project_stmt):
_row = cast(GroupRow, row)
_project_perm_ctx = await self.build_in_project_scope(ctx, _row.id)
_project_perm_ctx = await self._build_at_project_scope_non_recursively(ctx, _row.id)
result.merge(_project_perm_ctx)
return result

async def build_in_project_scope(
async def _build_at_project_scope_non_recursively(
self,
ctx: ClientContext,
project_id: UUID,
Expand All @@ -2103,7 +2103,7 @@ async def build_in_project_scope(
)
return result

async def build_in_user_scope(
async def _build_at_user_scope_non_recursively(
self,
ctx: ClientContext,
user_id: UUID,
Expand Down

0 comments on commit f768839

Please sign in to comment.