-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #176 from fsinfuhh/staging
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from argparse import ArgumentParser | ||
from pprint import pprint | ||
|
||
from django.conf import settings | ||
from django.core.management import BaseCommand | ||
|
||
from mafiasi.registration import utils | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Utilities for querying the IRZ ldap" | ||
|
||
def add_arguments(self, parser: ArgumentParser): | ||
argg = parser.add_mutually_exclusive_group(required=True) | ||
argg.add_argument("--group", nargs=1, help="Query for a group by gidNumber") | ||
argg.add_argument("--user", nargs=1, help="Query for a user by uid") | ||
|
||
def handle(self, *args, **options): | ||
if options["group"] is not None: | ||
pprint(utils.get_irz_ldap_group(options["group"])) | ||
elif options["user"] is not None: | ||
pprint(utils.get_irz_ldap_entry(options["user"])) | ||
else: | ||
raise ValueError(f"options contains neither a group nor user parameter: {options}") |