Skip to content

Commit

Permalink
fix: 目录meta list接口rsa设置不返回 (TencentBlueKing#868)
Browse files Browse the repository at this point in the history
  • Loading branch information
neronkl authored Jan 9, 2023
1 parent 2c1100a commit 32a1663
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/api/bkuser_core/api/web/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@
"""

EXCLUDE_SETTINGS_META_KEYS = ["password_rsa_private_key"]

EXCLUDE_SETTINGS_META_IN_META_LISTVIEW = [
"enable_password_rsa_encrypted",
"password_rsa_public_key",
"password_rsa_private_key",
]
7 changes: 5 additions & 2 deletions src/api/bkuser_core/api/web/setting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
from rest_framework import generics

from .serializers import SettingMetaOutputSLZ, SettingMetasListInputSLZ
from bkuser_core.user_settings.models import SettingMeta

# from bkuser_core.bkiam.permissions import ManageFieldPermission
from bkuser_core.api.web.constants import EXCLUDE_SETTINGS_META_IN_META_LISTVIEW
from bkuser_core.user_settings.models import SettingMeta


class SettingMetasListApi(generics.ListAPIView):
Expand All @@ -31,7 +32,9 @@ def get_queryset(self):
category_type = data["category_type"]
namespace = data["namespace"]

queryset = SettingMeta.objects.filter(category_type=category_type)
queryset = SettingMeta.objects.filter(category_type=category_type).exclude(
key__in=EXCLUDE_SETTINGS_META_IN_META_LISTVIEW
)
if namespace:
queryset = queryset.filter(namespace=namespace)
return queryset

0 comments on commit 32a1663

Please sign in to comment.