Improved permissions, 404 and 403 errors will be more frequent (when we type an invalid URL)
This commit is contained in:
parent
c384ee02eb
commit
1aae18e6a6
13 changed files with 272 additions and 105 deletions
11
apps/permission/views.py
Normal file
11
apps/permission/views.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from permission.backends import PermissionBackend
|
||||
|
||||
|
||||
class ProtectQuerysetMixin:
|
||||
def get_queryset(self, **kwargs):
|
||||
qs = super().get_queryset(**kwargs)
|
||||
|
||||
return qs.filter(PermissionBackend.filter_queryset(self.request.user, qs.model, "view"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue