Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:approval bug #793

Merged
merged 6 commits into from
Aug 9, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
from django.utils.functional import cached_property
from pydantic import BaseModel, parse_obj_as

from apigateway.apps.permission.constants import GrantDimensionEnum, PermissionLevelEnum, PermissionStatusEnum
from apigateway.apps.permission.constants import (
GrantDimensionEnum,
PermissionLevelEnum,
PermissionStatusEnum,
)
from apigateway.apps.permission.models import AppGatewayPermission, AppPermissionApplyStatus, AppResourcePermission
from apigateway.biz.released_resource import ReleasedResourceHandler
from apigateway.biz.resource_version import ResourceVersionHandler
Expand Down Expand Up @@ -227,10 +231,17 @@ def build(self) -> list:
resource["api_name"] = resource_fields.get("gateway__name", "")
resource["gateway_id"] = resource_fields.get("gateway_id")
resource["doc_link"] = doc_links.get(resource_id, "")
resource["api_permission_apply_status"] = gateway_id_to_permission_apply_status.get(

api_permission_apply_status = gateway_id_to_permission_apply_status.get(
resource_fields.get("gateway_id"), ""
)
resource["resource_permission_apply_status"] = resource_id_to_permission_apply_status.get(resource_id, "")
resource["api_permission_apply_status"] = api_permission_apply_status
Lawrence-lkq marked this conversation as resolved.
Show resolved Hide resolved
if api_permission_map.get(resource["gateway_id"]):
resource["resource_permission_apply_status"] = ""
else:
resource["resource_permission_apply_status"] = resource_id_to_permission_apply_status.get(
resource_id, ""
)
Lawrence-lkq marked this conversation as resolved.
Show resolved Hide resolved

resource_permissions = parse_obj_as(List[ResourcePermission], list(resource_map.values()))
return [perm.as_dict() for perm in resource_permissions]
Expand Down
Loading