From 0e4234cb3567810740669a62f365bb14daf73d60 Mon Sep 17 00:00:00 2001 From: James Graham Date: Thu, 25 Jun 2020 11:38:26 +0100 Subject: [PATCH] fix: Hide person details from non-admin users See #35 --- people/templates/people/person/detail.html | 105 +++++++++++---------- 1 file changed, 57 insertions(+), 48 deletions(-) diff --git a/people/templates/people/person/detail.html b/people/templates/people/person/detail.html index 134f27c..5e49e83 100644 --- a/people/templates/people/person/detail.html +++ b/people/templates/people/person/detail.html @@ -14,61 +14,70 @@
-
- {% if person.gender %} -
Gender
-
{{ person.get_gender_display }}
+ {% if person.user == request.user or request.user.is_superuser %} + {% if person.user != request.user and request.user.is_superuser %} +
+ NB: You are able to see the details of this person because you are an admin. + Regular users are not able to see this information for people other than themselves. +
{% endif %} - {% if person.age_group %} -
Age Group
-
{{ person.get_age_group_display }}
- {% endif %} - - {% if person.nationality %} -
Nationality
-
{{ person.nationality.name }}
- {% endif %} - - {% if person.country_of_residence %} -
Country of Residence
-
{{ person.country_of_residence.name }}
- {% endif %} - - {% if person.organisation %} -
Organisation
-
{{ person.organisation }}
- - {% if person.organisation_started_date %} -
Started Date
-
{{ person.organisation_started_date }}
+
+ {% if person.gender %} +
Gender
+
{{ person.get_gender_display }}
{% endif %} - {% endif %} - {% if person.job_title %} -
Job Title
-
{{ person.job_title }}
- {% endif %} + {% if person.age_group %} +
Age Group
+
{{ person.get_age_group_display }}
+ {% endif %} - {% if person.role %} -
Role
-
{{ person.role }}
- {% endif %} + {% if person.nationality %} +
Nationality
+
{{ person.nationality.name }}
+ {% endif %} - {% if person.disciplines %} -
Discipline(s)
-
{{ person.disciplines }}
- {% endif %} + {% if person.country_of_residence %} +
Country of Residence
+
{{ person.country_of_residence.name }}
+ {% endif %} - {% if person.themes.exists %} -
Project Themes
-
- {% for theme in person.themes.all %} - {{ theme }}{% if not forloop.last %}, {% endif %} - {% endfor %} -
- {% endif %} -
+ {% if person.organisation %} +
Organisation
+
{{ person.organisation }}
+ + {% if person.organisation_started_date %} +
Started Date
+
{{ person.organisation_started_date }}
+ {% endif %} + {% endif %} + + {% if person.job_title %} +
Job Title
+
{{ person.job_title }}
+ {% endif %} + + {% if person.role %} +
Role
+
{{ person.role }}
+ {% endif %} + + {% if person.disciplines %} +
Discipline(s)
+
{{ person.disciplines }}
+ {% endif %} + + {% if person.themes.exists %} +
Project Themes
+
+ {% for theme in person.themes.all %} + {{ theme }}{% if not forloop.last %}, {% endif %} + {% endfor %} +
+ {% endif %} +
+ {% endif %} Update