2016-06-04 16:52:18 +02:00
|
|
|
from argparse import ArgumentParser
|
2017-11-16 00:43:27 +01:00
|
|
|
from typing import Any
|
2013-11-25 23:13:29 +01:00
|
|
|
|
|
|
|
from django.core.management.base import BaseCommand
|
2023-10-12 19:43:45 +02:00
|
|
|
from typing_extensions import override
|
2013-11-25 23:13:29 +01:00
|
|
|
|
2019-03-09 07:52:14 +01:00
|
|
|
from zproject.backends import query_ldap
|
2013-11-25 23:13:29 +01:00
|
|
|
|
2020-01-14 21:59:46 +01:00
|
|
|
|
2013-11-25 23:13:29 +01:00
|
|
|
class Command(BaseCommand):
|
2023-10-12 19:43:45 +02:00
|
|
|
@override
|
2017-10-26 11:35:57 +02:00
|
|
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
2021-02-12 08:20:45 +01:00
|
|
|
parser.add_argument("email", metavar="<email>", help="email of user to query")
|
2015-08-21 02:10:41 +02:00
|
|
|
|
2023-10-12 19:43:45 +02:00
|
|
|
@override
|
2017-10-26 11:35:57 +02:00
|
|
|
def handle(self, *args: Any, **options: str) -> None:
|
2021-02-12 08:20:45 +01:00
|
|
|
email = options["email"]
|
2019-04-04 20:40:09 +02:00
|
|
|
values = query_ldap(email)
|
2019-03-09 08:32:06 +01:00
|
|
|
for value in values:
|
|
|
|
print(value)
|