Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Davide Arcuri committed Aug 5, 2024
1 parent 240433d commit 1323e48
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion orochi/website/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,21 @@ class ResultAdmin(admin.ModelAdmin):
@admin.register(Dump)
class DumpAdmin(GuardedModelAdmin):
actions = ["assign_to_users", "remove_from_users"]
list_display = ("name", "author", "index", "status")
list_display = ("name", "author", "index", "status", "get_auth_users")
search_fields = ["author__name", "name", "index"]
list_filter = ("author", "status", "created_at")
exclude = ("suggested_symbols_path", "regipy_plugins", "banner")

def get_auth_users(self, obj):
auth_users = [
user.username
for user in get_user_model().objects.all()
if "can_see" in get_perms(user, obj)
]
return ", ".join(auth_users)

get_auth_users.short_description = "Authorized Users"

def assign_to_users(self, request, queryset):
if "apply" in request.POST:
users = request.POST.getlist("authorized_users")
Expand Down

0 comments on commit 1323e48

Please sign in to comment.