Verified Commit 039a603f authored by Thibaut Broggi's avatar Thibaut Broggi
Browse files

Add permission requirement for /user route

parent 220f4be0
from import BaseCommand
from django.contrib.auth.models import User, Group, Permission
groups = ["jedi", "padawan"]
groups = ["droid", "jedi", "padawan"]
permissions = {
"droid": [],
"jedi": [
"can_change_status", "can_change_priority", "can_vote", "can_edit"
"can_change_status", "can_change_priority", "can_vote", "can_edit", "can_edit_users"
"padawan": ["can_vote", "add_article"]
from django.contrib.auth.models import User
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.views.generic.list import ListView
class UserListView(ListView):
class UserListView(PermissionRequiredMixin, ListView):
model = User
paginate_by = 20
template_name = "rp/user_list.html"
template_name = 'rp/user_list.html'
permission_required = 'can_edit_users'
def get_queryset(self):
qs = super().get_queryset()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment