Allow any authenticated user to create new Structure entries in autocomplete
This commit is contained in:
@@ -3006,6 +3006,21 @@ class StructureAutocomplete(autocomplete.Select2QuerySetView):
|
|||||||
|
|
||||||
return qs
|
return qs
|
||||||
|
|
||||||
|
def has_add_permission(self, request):
|
||||||
|
"""Allow any authenticated user to create new Structure entries.
|
||||||
|
|
||||||
|
By default DAL requires the user to have the model add permission.
|
||||||
|
For Anatomy question creation we want any registered user to be
|
||||||
|
able to create structures, so relax that check to only require
|
||||||
|
authentication.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
auth = request.user.is_authenticated
|
||||||
|
except Exception:
|
||||||
|
auth = False
|
||||||
|
|
||||||
|
return bool(auth)
|
||||||
|
|
||||||
|
|
||||||
class SubspecialtyAutocomplete(autocomplete.Select2QuerySetView):
|
class SubspecialtyAutocomplete(autocomplete.Select2QuerySetView):
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user