From 7890d0992afc16891849bfcb32e01bafe54b5a9f Mon Sep 17 00:00:00 2001 From: XingQue Date: Sat, 20 Jun 2026 14:00:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E7=AB=AF=E6=94=B9=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E5=A4=84=EF=BC=88views=5Fmanage.py=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- merchant_ops/views_manage.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/merchant_ops/views_manage.py b/merchant_ops/views_manage.py index e69098e..4a41239 100644 --- a/merchant_ops/views_manage.py +++ b/merchant_ops/views_manage.py @@ -299,6 +299,8 @@ class StaffRoleListView(APIView): def post(self, request): try: from merchant_ops.constants import PERMISSION_DEFINITIONS, SYSTEM_ROLE_TEMPLATES + from merchant_ops.services.bootstrap import seed_global_permissions + seed_global_permissions() if is_merchant_owner(request.user): mid = request.user.UserUID ensure_owner_merchant(mid, request.user) @@ -320,6 +322,8 @@ class StaffRoleListView(APIView): }) all_perms = list(MerchantStaffPermission.query.filter(status=1).order_by('sort_order').values( 'perm_code', 'perm_name')) + if not all_perms: + all_perms = [{'perm_code': c, 'perm_name': n} for c, n in PERMISSION_DEFINITIONS] return Response({'code': 0, 'msg': '成功', 'data': {'roles': data, 'all_permissions': all_perms}}) except Exception as e: return _err(e)