Skip to content
Snippets Groups Projects
Commit 1b836408 authored by Flavio TARSETTI's avatar Flavio TARSETTI
Browse files

Merge branch '541_improve_db_map_script' into 'master'

Improve database map command output

See merge request !317
parents 3a342451 e80912c0
No related branches found
No related tags found
1 merge request!317Improve database map command output
Pipeline #36896 failed
......@@ -42,6 +42,13 @@ class Command(BaseCommand):
default=None,
help="Path element up to which the the string must be cleaned",
)
parser.add_argument(
"--show-all",
action="store_true",
dest="show_all",
default=False,
help="Show all users",
)
def handle(self, *ignored, **options):
......@@ -50,6 +57,7 @@ class Command(BaseCommand):
for database in Database.objects.all():
folder = database.declaration["root_folder"]
folder_filter = options["folder_filter"]
show_all = options["show_all"]
if folder_filter:
try:
start = folder.rindex(folder_filter) + len(folder_filter)
......@@ -61,10 +69,14 @@ class Command(BaseCommand):
database.fullname(), database.get_sharing_display(), folder
)
for user in [
"{}: {} {}".format(user.username, user.first_name, user.last_name)
for user in database.all_shared_with_users()
]:
self.stdout.write("{}, {}".format(db_info, user))
for user in database.all_shared_with_users():
if user.is_active or show_all:
user_info = "{}: {} {} {}".format(
user.username, user.first_name, user.last_name, user.email
)
message = "{}, {}".format(db_info, user_info)
if show_all:
message += " active: {}".format(user.is_active)
self.stdout.write(message)
else:
self.stdout.write(db_info)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment