Allow a user not assigned to an orga to edit themselves

This commit is contained in:
Kumi 2019-02-10 19:08:09 +00:00
parent 1a2ae036e5
commit ff292a96ce

View file

@ -219,7 +219,7 @@ def makeuser(request):
def edituser(request, user_id): def edituser(request, user_id):
if request.user.is_staff or request.user.id == user_id: if request.user.is_staff or request.user.id == user_id:
orgas = request.user.organization_set.all() orgas = request.user.organization_set.all()
user = User.objects.distinct().get(id=user_id, organization__in=orgas) user = request.user if request.user.id == user_id else User.objects.distinct().get(id=user_id, organization__in=orgas)
if not user: if not user:
return redirect("/users/") return redirect("/users/")