Skip to content

Commit

Permalink
Merge branch 'main' into performance/libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
nas-tabchiche committed Mar 4, 2024
2 parents 5e02bc5 + b667711 commit d685dd4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
26 changes: 26 additions & 0 deletions backend/core/management/commands/status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from django.core.management.base import BaseCommand
from core.models import *
from iam.models import User, Folder
class Command(BaseCommand):
help = 'Displays instance status'

def handle(self, *args, **kwargs):
nb_users = User.objects.all().count()
nb_first_login = User.objects.filter(first_login=True).count()
nb_libraries = Library.objects.all().count()
nb_domains = Folder.objects.filter(content_type='DO').count()
nb_projects = Project.objects.all().count()
nb_assets = Asset.objects.all().count()
nb_threats = Threat.objects.all().count()
nb_functions = SecurityFunction.objects.all().count()
nb_measures = SecurityMeasure.objects.all().count()
nb_evidences = Evidence.objects.all().count()
nb_compliance_assessments = ComplianceAssessment.objects.all().count()
nb_risk_assessments = RiskAssessment.objects.all().count()
nb_risk_scenarios = RiskScenario.objects.all().count()
nb_risk_acceptances = RiskAcceptance.objects.all().count()
self.stdout.write(f"users={nb_users} first_logins={nb_first_login} libraries={nb_libraries} " +
f"domains={nb_domains} projects={nb_projects} assets={nb_assets} " +
f"threats={nb_threats} functions={nb_functions} measures={nb_measures} " +
f"evidences={nb_evidences} compliance={nb_compliance_assessments} risk={nb_risk_assessments} " +
f"scenarios={nb_risk_scenarios} acceptances={nb_risk_acceptances}")
2 changes: 2 additions & 0 deletions backend/iam/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def post(self, request) -> Response:
status=HTTP_401_UNAUTHORIZED,
)

user.first_login=False
user.save()
return Response(None, status=HTTP_202_ACCEPTED)


Expand Down

0 comments on commit d685dd4

Please sign in to comment.