Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024-07-30 | MAIN --> PROD | DEV (e096c4c) --> STAGING #4130

Merged
merged 2 commits into from
Jul 30, 2024
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
25 changes: 23 additions & 2 deletions backend/audit/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
from django.conf import settings
from django.contrib import admin, messages
from audit.forms import SacValidationWaiverForm, UeiValidationWaiverForm
Expand All @@ -18,6 +19,8 @@
from django.contrib.admin import SimpleListFilter
from django.utils.translation import gettext_lazy as _

logger = logging.getLogger(__name__)


class SACAdmin(admin.ModelAdmin):
"""
Expand Down Expand Up @@ -139,20 +142,32 @@ def save_model(self, request, obj, form, change):
SingleAuditChecklist.STATUS.READY_FOR_CERTIFICATION,
SingleAuditChecklist.STATUS.AUDITOR_CERTIFIED,
]:
logger.info(
f"User {request.user.email} is applying waiver for SAC with status: {sac.submission_status}"
)
self.handle_auditor_certification(request, obj, sac)
self.handle_auditee_certification(request, obj, sac)
super().save_model(request, obj, form, change)
logger.info(
f"SAC {sac.report_id} updated successfully with waiver by user: {request.user.email}."
)
else:
messages.set_level(request, messages.WARNING)
messages.warning(
request,
f"Cannot apply waiver to SAC with status {sac.submission_status}. Expected status to be one of {SingleAuditChecklist.STATUS.READY_FOR_CERTIFICATION}, {SingleAuditChecklist.STATUS.AUDITOR_CERTIFIED}",
)

super().save_model(request, obj, form, change)
logger.warning(
f"User {request.user.email} attempted to apply waiver to SAC with invalid status: {sac.submission_status}"
)

except Exception as e:
messages.set_level(request, messages.ERROR)
messages.error(request, str(e))
logger.error(
f"Error saving SAC waiver by user {request.user.email}: {str(e)}",
exc_info=True,
)

def handle_auditor_certification(self, request, obj, sac):
if SacValidationWaiver.TYPES.AUDITOR_CERTIFYING_OFFICIAL in obj.waiver_types:
Expand Down Expand Up @@ -187,6 +202,9 @@ def handle_auditor_certification(self, request, obj, sac):
event_user=request.user,
event_type=SubmissionEvent.EventType.AUDITOR_CERTIFICATION_COMPLETED,
)
logger.info(
f"Auditor certification completed for SAC {sac.report_id} by user: {request.user.email}."
)

def handle_auditee_certification(self, request, obj, sac):
if SacValidationWaiver.TYPES.AUDITEE_CERTIFYING_OFFICIAL in obj.waiver_types:
Expand Down Expand Up @@ -220,6 +238,9 @@ def handle_auditee_certification(self, request, obj, sac):
event_user=request.user,
event_type=SubmissionEvent.EventType.AUDITEE_CERTIFICATION_COMPLETED,
)
logger.info(
f"Auditee certification completed for SAC {sac.report_id} by user: {request.user.email}."
)


class UeiValidationWaiverAdmin(admin.ModelAdmin):
Expand Down
64 changes: 32 additions & 32 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
"license": "ISC",
"devDependencies": {
"@4tw/cypress-drag-drop": "^2.2.5",
"@babel/eslint-parser": "^7.24.8",
"@babel/eslint-parser": "^7.25.1",
"@eslint/js": "^9.7.0",
"cypress": "^13.13.1",
"cypress-axe": "^1.5.0",
"cypress-downloadfile": "^1.2.4",
"cypress-file-upload": "^5.0.8",
"cypress-otp": "^1.0.3",
"eslint": "^9.7.0",
"eslint": "^9.8.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-cypress": "^3.3.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-cypress": "^3.4.0",
"eslint-plugin-prettier": "^5.2.1",
"prettier": "^3.3.3",
"stylelint": "^15.10.1",
"stylelint-config-scss": "^1.0.0-security",
Expand All @@ -48,7 +48,7 @@
"esbuild-sass-plugin": "3.3.1",
"glob": "11.0.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.39",
"postcss": "^8.4.40",
"postcss-cli": "^11.0.0"
}
}
Loading