Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Access/accessrequest_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def get_decline_access_request(request, access_type, request_id):
current_ids = list(
GroupAccessMapping.get_pending_access_mapping(
request_id=group_name
).filter(request_id__contains=date_suffix)
).filter(request_id__icontains=date_suffix)
)
request_ids.extend(current_ids)
access_type = "groupAccess"
Expand Down
2 changes: 1 addition & 1 deletion Access/group_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ def save_group_access_request(form_data, auth_user):
def _create_group_access_mapping(
group, user, request_id, access_tag, access_label, access_reason
):
access = AccessV2.get(access_type=access_tag, access_label=access_label)
access = AccessV2.get(access_tag=access_tag, access_label=access_label)
if not access:
access = AccessV2.create(access_tag=access_tag, access_label=access_label)
else:
Expand Down
4 changes: 2 additions & 2 deletions Access/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ def decline_access(self, decline_reason=None):
@staticmethod
def get_pending_access_mapping(request_id):
return UserAccessMapping.objects.filter(
request_id__contains=request_id, status__in=["Pending", "SecondaryPending"]
request_id__icontains=request_id, status__in=["Pending", "SecondaryPending"]
).values_list("request_id", flat=True)

def update_access_status(self, current_status):
Expand Down Expand Up @@ -1055,7 +1055,7 @@ def get_by_request_id(request_id):
@staticmethod
def get_pending_access_mapping(request_id):
return GroupAccessMapping.objects.filter(
request_id__contains=request_id, status__in=["Pending", "SecondaryPending"]
request_id__icontains=request_id, status__in=["Pending", "SecondaryPending"]
).values_list("request_id", flat=True)

def is_pending(self):
Expand Down
24 changes: 12 additions & 12 deletions Access/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Django views."""
import json
import logging
import logging, traceback
from rest_framework.authentication import TokenAuthentication, BasicAuthentication
from rest_framework.decorators import api_view
from django.contrib.auth.decorators import login_required
Expand Down Expand Up @@ -386,7 +386,7 @@ def accept_bulk(request, selector):
context["returnIds"] = return_ids
return JsonResponse(context, status=200)
except Exception as ex:
logger.error("Error processing bulk accept, Error: %s", str(ex))
logger.error("Error processing bulk accept, Error: %s", traceback.format_exc())
json_response = {}
json_response["error"] = INVALID_REQUEST_MESSAGE
json_response["success"] = False
Expand All @@ -412,7 +412,7 @@ def _get_request_ids_for_bulk_processing(posted_request_ids, selector):
current_ids = list(
GroupAccessMapping.get_pending_access_mapping(
request_id=group_name
).filter(request_id__contains=date_suffix)
).filter(request_id__icontains=date_suffix)
)
access_request_ids.extend(current_ids)
selector = "groupAccess"
Expand All @@ -439,7 +439,7 @@ def decline_access(request, access_type, request_id):
context = get_decline_access_request(request, access_type, request_id)
return JsonResponse(context, status=200)
except Exception as ex:
logger.exception("Error declining access, Error: %s", str(ex))
logger.exception("Error declining access, Error: %s", traceback.format_exc())
return JsonResponse(
{"error": "Failed to decline the access request"}, status=400
)
Expand All @@ -461,7 +461,7 @@ def remove_group_member(request):
return JsonResponse(response, status=400)
return JsonResponse({"message": "Success"})
except Exception as ex:
logger.exception("Error removing memeber from group, Error: %s", str(ex))
logger.exception("Error removing memeber from group, Error: %s", traceback.format_exc())
return JsonResponse({"error": "Failed to remove the user"}, status=400)


Expand All @@ -486,7 +486,7 @@ def all_user_access_list(request, load_ui=True):
user = djangoUser.objects.get(username=username)
except Exception as ex:
# show all
logger.exception(ex)
logger.exception("Error raised in all_user_access_list: %s" % (traceback.format_exc()))

try:
last_page = 1
Expand Down Expand Up @@ -562,7 +562,7 @@ def all_user_access_list(request, load_ui=True):
logger.exception(
"""Error fetching all users access list,
request not found OR Invalid request type, Error: %s""",
str(ex),
traceback.format_exc(),
)
json_response = {}
json_response["error"] = {
Expand Down Expand Up @@ -621,7 +621,7 @@ def mark_revoked(request):
json_response["msg"] = "Success"
json_response["request_ids"] = success_list
except Exception as ex:
logger.exception("Error Revoking User Access, Error: %s", str(ex))
logger.exception("Error Revoking User Access, Error: %s", traceback.format_exc())
json_response["error"] = "Error Revoking User Access"
return JsonResponse(json_response, status=403)

Expand All @@ -648,7 +648,7 @@ def individual_resolve(request):
json_response["status_list"].append({'title': 'The Request ('+request_id+') is already resolved.', 'msg': 'The request is already in final state.'})
return render(request,'EnigmaOps/accessStatus.html',json_response)
except Exception as e:
logger.exception(str(e))
logger.exception("Error raised during individual_resolve %s" % (traceback.format_exc()))
json_response["error"] = {
"error_msg": "Bad request",
"msg": "Error in request not found OR Invalid request type",
Expand Down Expand Up @@ -693,7 +693,7 @@ def ignore_failure(request, selector):
return render(request, "EnigmaOps/accessStatus.html", json_response)
except Exception as e:
logger.debug("Error in request not found OR Invalid request type")
logger.exception(e)
logger.exception("Error while executing ignore_failure: %s" % (traceback.format_exc()))
json_response = {}
json_response["error"] = {
"error_msg": str(e),
Expand Down Expand Up @@ -731,7 +731,7 @@ def resolve_bulk(request):
return render(request, "EnigmaOps/accessStatus.html", json_response)
except Exception as e:
logger.debug("Error in request not found OR Invalid request type")
logger.exception(e)
logger.exception("Raised error during resolve_bulk: %s" % (traceback.format_exc()))
json_response = {}
json_response['error'] = {'error_msg': "Bad request", 'msg': "Error in request not found OR Invalid request type"}
return render(request,'EnigmaOps/accessStatus.html',json_response)
Expand All @@ -744,6 +744,6 @@ def revoke_group_access(request):

return JsonResponse(response)
except Exception as e:
logger.exception(str(e))
logger.exception("Error while revoking group access %s" % (traceback.format_exc()))
logger.debug("Something went wrong while revoking group access")
return JsonResponse({"message": "Failed to revoke group Access"}, status=400)
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ all: build test lint
## make dev : Build and start docker containers - (web/test/db)
.PHONY: dev
dev:
@docker-compose build && docker-compose up -d
@docker-compose build && docker-compose up -d web celery

## make build : Build and start docker containers - (web and db)
.PHONY: build
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
env_file:
- ./secrets/ops_mysql_dev.env
volumes:
- ./dbs:/var/lib/mysql --socket=/tmp/mysql.sock
- ./mounts/mysql_db/data:/var/lib/mysql
redis:
container_name: redis
image: redis:alpine
Expand Down