后端改了一处(views_manage.py)
This commit is contained in:
@@ -299,6 +299,8 @@ class StaffRoleListView(APIView):
|
|||||||
def post(self, request):
|
def post(self, request):
|
||||||
try:
|
try:
|
||||||
from merchant_ops.constants import PERMISSION_DEFINITIONS, SYSTEM_ROLE_TEMPLATES
|
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):
|
if is_merchant_owner(request.user):
|
||||||
mid = request.user.UserUID
|
mid = request.user.UserUID
|
||||||
ensure_owner_merchant(mid, request.user)
|
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(
|
all_perms = list(MerchantStaffPermission.query.filter(status=1).order_by('sort_order').values(
|
||||||
'perm_code', 'perm_name'))
|
'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}})
|
return Response({'code': 0, 'msg': '成功', 'data': {'roles': data, 'all_permissions': all_perms}})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return _err(e)
|
return _err(e)
|
||||||
|
|||||||
Reference in New Issue
Block a user