浏览代码

HUE-7090 [security] Protect from missing groupName in the list_sentry_roles_by_group API

Romain Rigaux 8 年之前
父节点
当前提交
74b6fab52b
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      apps/security/src/security/api/hive.py
  2. 1 1
      apps/security/src/security/api/sentry.py

+ 1 - 1
apps/security/src/security/api/hive.py

@@ -62,7 +62,7 @@ def list_sentry_roles_by_group(request):
   result = {'status': -1, 'message': 'Error'}
 
   try:
-    if request.POST['groupName']:
+    if request.POST.get('groupName'):
       groupName = request.POST['groupName']
     else:
       # Admins can see everything, other only the groups they belong too

+ 1 - 1
apps/security/src/security/api/sentry.py

@@ -100,7 +100,7 @@ def list_sentry_roles_by_group(request):
   component = request.POST['component']
 
   try:
-    if request.POST['groupName']:
+    if request.POST.get('groupName'):
       groupName = request.POST['groupName']
     else:
       # Admins can see everything, other only the groups they belong too