Skip to content

Commit

Permalink
fix(apis/web/permission): 修复应用权限搜索问题
Browse files Browse the repository at this point in the history
  • Loading branch information
F-cq committed Nov 21, 2024
1 parent 5666aa5 commit 7dc7b1e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
14 changes: 1 addition & 13 deletions src/dashboard/apigateway/apigateway/apis/web/permission/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,6 @@ def get_app_permissions(self, gateway_queryset, resource_queryset):
)
class AppPermissionListApi(AppPermissionQuerySetMixin, generics.ListAPIView):

def _modify_request_data(self):
data = self.request.GET.copy()
resource_id = data.get("resource_id")
if resource_id:
try:
int(resource_id)
except ValueError:
resource_id = -1

data["resource_id"] = resource_id
return data

def get_queryset(self):
query_params = self.request.query_params
grant_dimension = query_params.get("grant_dimension")
Expand All @@ -151,7 +139,7 @@ def get_queryset(self):
app_gateway_permissions = []

app_resource_permissions = AppResourcePermissionFilter(
self._modify_request_data(), queryset=self.get_resource_queryset()
self.request.GET, queryset=self.get_resource_queryset()
).qs
if grant_dimension == GrantDimensionEnum.API.value:
app_resource_permissions = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,6 @@ def test_list(self, fake_gateway, request_view):
"count": 1,
},
},
{
"params": {
"resource_id": "测试",
},
"expected": {
"count": 0,
},
},
{
"params": {
"grant_dimension": "测试",
Expand Down

0 comments on commit 7dc7b1e

Please sign in to comment.