2025-03-24 14:34:56 +01:00

21 lines
535 B
Python

import logging
from authstuff.models import ActiveDirectoryEntry
from django.http import JsonResponse
logger = logging.getLogger(__name__)
def detail(request, login):
result = {'canonicalName' : login, 'found' : False}
try:
addata = ActiveDirectoryEntry.objects.get(canonicalName=login)
result['found'] = True
result['role'] = addata.role
result['updated'] = addata.modified
except ActiveDirectoryEntry.DoesNotExist:
pass
response = JsonResponse(result)
return response