` def process_view(self, request, view_func, view_args, view_kwargs):
# 許可權判斷
# 獲取當前路由的name 和 settings中的許可權表比較
url_list = []
current_name = request.resolver_match.url_name
if current_name in NB_ROOT:
return None
if current_name not in NB_PERMISSIONS[request.ee["isadmin"]]:
is_ajax = request.headers.get('X-Requested-With') == 'XMLHttpRequest'
if is_ajax:
return JsonResponse({"code":403, "msg":"沒有許可權"})
return redirect('no_permission')
url_list.append(NB_PERMISSIONS[request.ee["isadmin"]].get(current_name).get("text"))`