Преглед изворни кода

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

Romain Rigaux пре 8 година
родитељ
комит
74b6fab
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