Skip to content

Commit

Permalink
fix(mongodb): mongo用户权限规则授权修复 TencentBlueKing#7373
Browse files Browse the repository at this point in the history
  • Loading branch information
WytheLi authored and zhangzhw8 committed Oct 28, 2024
1 parent 8b68708 commit 403b492
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion dbm-ui/backend/ticket/builders/mongodb/mongo_authorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,22 @@
from backend.ticket.constants import TicketType


class MongoDBAuthorizeInfoSerializer(serializers.Serializer):
username = serializers.CharField(help_text=_("授权账号"))
access_dbs = serializers.ListSerializer(child=serializers.CharField(), help_text=_("准入DB"))
account_id = serializers.CharField(help_text=_("账号ID"))
auth_db = serializers.CharField(help_text=_("认证用户"))
cluster_ids = serializers.ListSerializer(child=serializers.IntegerField(), help_text=_("目标集群ID"))
password = serializers.CharField(help_text=_("密码"))
rule_sets = serializers.ListSerializer(child=serializers.JSONField(), help_text=_("规则集"))
target_instances = serializers.ListSerializer(child=serializers.CharField(), help_text=_("目标集群域名"))


class MongoDBAuthorizeRulesSerializer(serializers.Serializer):
authorize_uid = serializers.CharField(help_text=_("授权数据缓存uid"))
authorize_data = serializers.ListSerializer(help_text=_("授权数据列表"), child=serializers.JSONField(), required=False)
authorize_data = serializers.ListSerializer(
help_text=_("授权数据列表"), child=MongoDBAuthorizeInfoSerializer(), required=False
)

def validate(self, attrs):
return attrs
Expand Down

0 comments on commit 403b492

Please sign in to comment.