Commit e16d0f41 authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Merge branch 'fix/birthdays-member-only' into 'master'

Prevent non-authenticated users from accessing member birthdays

Closes #115

See merge request !148
parents fd7e291c ef56ccfc
...@@ -12,3 +12,4 @@ Jan Martens <jan-martens@hotmail.com> <jan-martens@hotmail.com> ...@@ -12,3 +12,4 @@ Jan Martens <jan-martens@hotmail.com> <jan-martens@hotmail.com>
Luuk Scholten <info@luukscholten.com> <l.scholten@student.science.ru.nl> Luuk Scholten <info@luukscholten.com> <l.scholten@student.science.ru.nl>
Joost Rijneveld <joost@joostrijneveld.nl> <l.rijneveld@science.ru.nl> Joost Rijneveld <joost@joostrijneveld.nl> <l.rijneveld@science.ru.nl>
Nienke Wessel <n.wessel@xs4all.nl> Nienke Wessel <n.wessel@xs4all.nl>
Wietse Kuipers <wietse@kuiprs.nl> WKuipers
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
{% endif %} {% endif %}
{% endspaceless %}, {% endspaceless %},
customButtons: { customButtons: {
{% if request.user.is_authenticated %}
showBirthdays: { showBirthdays: {
text: Cookies.get('showbirthdays') ? '{% trans "hide birthdays" %}' : '{% trans "show birthdays" %}', text: Cookies.get('showbirthdays') ? '{% trans "hide birthdays" %}' : '{% trans "show birthdays" %}',
click: function(e) { click: function(e) {
...@@ -64,6 +65,7 @@ ...@@ -64,6 +65,7 @@
} }
} }
} }
{% endif %}
}, },
header: { header: {
right: 'showBirthdays, list,agendaWeek,month prev,next today' right: 'showBirthdays, list,agendaWeek,month prev,next today'
......
...@@ -6,6 +6,7 @@ from rest_framework import viewsets ...@@ -6,6 +6,7 @@ from rest_framework import viewsets
from rest_framework.decorators import list_route from rest_framework.decorators import list_route
from rest_framework.exceptions import ParseError from rest_framework.exceptions import ParseError
from rest_framework.response import Response from rest_framework.response import Response
from rest_framework import permissions
from members.api.serializers import MemberBirthdaySerializer from members.api.serializers import MemberBirthdaySerializer
from members.models import Member from members.models import Member
...@@ -13,6 +14,7 @@ from members.models import Member ...@@ -13,6 +14,7 @@ from members.models import Member
class MemberViewset(viewsets.ViewSet): class MemberViewset(viewsets.ViewSet):
queryset = Member.objects.all() queryset = Member.objects.all()
permission_classes = (permissions.IsAuthenticated,)
def _get_birthdays(self, member, start, end): def _get_birthdays(self, member, start, end):
birthdays = [] birthdays = []
......
...@@ -7,235 +7,222 @@ msgid "" ...@@ -7,235 +7,222 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-10-26 21:16+0200\n" "POT-Creation-Date: 2016-10-28 23:57+0200\n"
"PO-Revision-Date: 2016-10-26 21:17+0200\n" "PO-Revision-Date: 2016-10-29 00:04+0200\n"
"Last-Translator: Thom Wiggers <thom@thomwiggers.nl>\n" "Last-Translator: Sébastiaan Versteeg <se_bastiaan@outlook.com>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: nl\n" "Language: nl\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.8.9\n" "X-Generator: Poedit 1.8.10\n"
#: members/admin.py:28 #: admin.py:29
msgid "membership type" msgid "membership type"
msgstr "lidtype" msgstr "lidtype"
#: members/admin.py:51 #: admin.py:52
msgid "Age" msgid "Age"
msgstr "Leeftijd" msgstr "Leeftijd"
#: members/admin.py:56 #: admin.py:57
msgid "≥ 18" msgid "≥ 18"
msgstr "≥ 18" msgstr "≥ 18"
#: members/admin.py:57 #: admin.py:58
msgid "< 18" msgid "< 18"
msgstr "< 18" msgstr "< 18"
#: members/admin.py:58 #: admin.py:59
msgid "Unknown" msgid "Unknown"
msgstr "Onbekend" msgstr "Onbekend"
#: members/admin.py:115 #: admin.py:127
msgid "First name"
msgstr "Voornaam"
#: members/admin.py:116
msgid "Last name"
msgstr "Achternaam"
#: members/admin.py:117
msgid "Address"
msgstr "Adres"
#: members/admin.py:118
msgid "Address line 2"
msgstr "Tweede adresregel"
#: members/admin.py:119 members/models.py:148
msgid "Postal code"
msgstr "Postcode"
#: members/admin.py:120 members/models.py:154
msgid "City"
msgstr "Woonplaats"
#: members/admin.py:130
msgid "Download address label for selected users" msgid "Download address label for selected users"
msgstr "Download adreslabels voor geselecteerde gebruikers" msgstr "Download adreslabels voor geselecteerde gebruikers"
#: members/forms.py:35 #: forms.py:35
msgid "Send welcome email" msgid "Send welcome email"
msgstr "Stuur welkomste-mails" msgstr "Stuur welkomste-mails"
#: members/forms.py:36 #: forms.py:36
msgid "This email will include the generated password" msgid "This email will include the generated password"
msgstr "Deze e-mail zal het gegenereerde wachtwoord bevatten" msgstr "Deze e-mail zal het gegenereerde wachtwoord bevatten"
#: members/models.py:54 #: models.py:54
msgid "Computing Science" msgid "Computing Science"
msgstr "Informatica" msgstr "Informatica"
#: members/models.py:55 #: models.py:55
msgid "Information Sciences" msgid "Information Sciences"
msgstr "Informatiekunde" msgstr "Informatiekunde"
#: members/models.py:67 members/templates/members/profile.html:38 #: models.py:67 templates/members/profile.html:38
msgid "Study programme" msgid "Study programme"
msgstr "Studie" msgstr "Studie"
#: members/models.py:76 #: models.py:76
msgid "Enter a valid student- or e/z/u-number." msgid "Enter a valid student- or e/z/u-number."
msgstr "Voer een geldig student- of e/z/u-nummer in." msgstr "Voer een geldig student- of e/z/u-nummer in."
#: members/models.py:82 #: models.py:82
msgid "Starting year" msgid "Starting year"
msgstr "Eerste lidmaatschapsjaar" msgstr "Eerste lidmaatschapsjaar"
#: members/models.py:83 #: models.py:83
msgid "The year this member started studying." msgid "The year this member started studying."
msgstr "Het jaar waarop dit lid begon met studeren." msgstr "Het jaar waarop dit lid begon met studeren."
#: members/models.py:119 #: models.py:119
msgid "Is this user currently active" msgid "Is this user currently active"
msgstr "Is deze user op dit moment actief" msgstr "Is deze user op dit moment actief"
#: members/models.py:133 #: models.py:133
msgid "Include the house number" msgid "Include the house number"
msgstr "Inclusief huisnummer" msgstr "Inclusief huisnummer"
#: members/models.py:135 #: models.py:135
msgid "Street and house number" msgid "Street and house number"
msgstr "Straat en huisnummer" msgstr "Straat en huisnummer"
#: members/models.py:141 #: models.py:141
msgid "Second address line" msgid "Second address line"
msgstr "Tweede adresregel" msgstr "Tweede adresregel"
#: members/models.py:160 #: models.py:148
msgid "Postal code"
msgstr "Postcode"
#: models.py:154
msgid "City"
msgstr "Woonplaats"
#: models.py:160
msgid "Phone number" msgid "Phone number"
msgstr "Telefoonnummer" msgstr "Telefoonnummer"
#: members/models.py:161 #: models.py:161
msgid "Enter a phone number so Thalia may reach you" msgid "Enter a phone number so Thalia may reach you"
msgstr "Voer een telefoonnummer in zodat Thalia je kan bereiken" msgstr "Voer een telefoonnummer in zodat Thalia je kan bereiken"
#: members/models.py:164 members/models.py:186 #: models.py:164 models.py:186
msgid "Please enter a valid phone number" msgid "Please enter a valid phone number"
msgstr "Voer svp een geldig telefoonnummer in" msgstr "Voer svp een geldig telefoonnummer in"
#: members/models.py:174 #: models.py:174
msgid "Emergency contact name" msgid "Emergency contact name"
msgstr "Contact voor noodgevallen" msgstr "Contact voor noodgevallen"
#: members/models.py:175 #: models.py:175
msgid "Who should we contact in case of emergencies" msgid "Who should we contact in case of emergencies"
msgstr "Wie Thalia moet bereiken in bij noodgevallen" msgstr "Wie Thalia moet bereiken in bij noodgevallen"
#: members/models.py:182 #: models.py:182
msgid "Emergency contact phone number" msgid "Emergency contact phone number"
msgstr "Telefoonnummer noodcontact" msgstr "Telefoonnummer noodcontact"
#: members/models.py:183 #: models.py:183
msgid "The phone number for the emergency contact" msgid "The phone number for the emergency contact"
msgstr "Het telefoonummer van de noodcontact" msgstr "Het telefoonummer van de noodcontact"
#: members/models.py:195 members/templates/members/profile.html:45 #: models.py:195 templates/members/profile.html:45
msgid "Birthday" msgid "Birthday"
msgstr "Verjaardag" msgstr "Verjaardag"
#: members/models.py:200 #: models.py:200
msgid "Display birthday" msgid "Display birthday"
msgstr "Laat verjaardag zien" msgstr "Laat verjaardag zien"
#: members/models.py:202 #: models.py:202
msgid "Show the birthday on your profile page and in the birthday calendar" msgid ""
"Show your birthday to other members on your profile page and in the birthday "
"calendar"
msgstr "" msgstr ""
"Laat de verjaardag op je profielpagina en in de verjaardagskalender zien" "Toon je verjaardag aan andere leden op je profielpagina en in de "
"verjaardagskalender"
#: members/models.py:209 members/templates/members/profile.html:41 #: models.py:209 templates/members/profile.html:41
msgid "Website" msgid "Website"
msgstr "Website" msgstr "Website"
#: members/models.py:210 #: models.py:210
msgid "Website to display on your profile page" msgid "Website to display on your profile page"
msgstr "Website om op je profiel te linken" msgstr "Website om op je profiel te linken"
#: members/models.py:216 #: models.py:216
msgid "Profile text" msgid "Profile text"
msgstr "Profieltekst" msgstr "Profieltekst"
#: members/models.py:217 #: models.py:217
msgid "Text to display on your profile" msgid "Text to display on your profile"
msgstr "Tekst om te laten zien op je profielpagina" msgstr "Tekst om te laten zien op je profielpagina"
#: members/models.py:224 #: models.py:224
msgid "Initials" msgid "Initials"
msgstr "Initialen" msgstr "Initialen"
#: members/models.py:231 #: models.py:231
msgid "Nickname" msgid "Nickname"
msgstr "Bijnaam" msgstr "Bijnaam"
#: members/models.py:238 #: models.py:238
msgid "How to display name" msgid "How to display name"
msgstr "Weergave naam" msgstr "Weergave naam"
#: members/models.py:239 #: models.py:239
msgid "Show full name" msgid "Show full name"
msgstr "Volledige naam" msgstr "Volledige naam"
#: members/models.py:240 #: models.py:240
msgid "Show only nickname" msgid "Show only nickname"
msgstr "Alleen initialen" msgstr "Alleen initialen"
#: members/models.py:241 #: models.py:241
msgid "Show only first name" msgid "Show only first name"
msgstr "Alleen voornaam" msgstr "Alleen voornaam"
#: members/models.py:242 #: models.py:242
msgid "Show initials and last name" msgid "Show initials and last name"
msgstr "Alleen initialen en achternaam" msgstr "Alleen initialen en achternaam"
#: members/models.py:243 #: models.py:243
msgid "Show name like \"John 'nickname' Doe\"" msgid "Show name like \"John 'nickname' Doe\""
msgstr "Laat zien als \"John 'bijnaam' Doe\"" msgstr "Laat zien als \"John 'bijnaam' Doe\""
#: members/models.py:244 #: models.py:244
msgid "Show nickname and last name" msgid "Show nickname and last name"
msgstr "Laat bijnaam en achternaam zien" msgstr "Laat bijnaam en achternaam zien"
#: members/models.py:249 #: models.py:249
msgid "Photo" msgid "Photo"
msgstr "Foto" msgstr "Foto"
#: members/models.py:258 #: models.py:258
msgid "Preferred language" msgid "Preferred language"
msgstr "Voorkeurstaal" msgstr "Voorkeurstaal"
#: members/models.py:259 #: models.py:259
msgid "Preferred language for e.g. news letters" msgid "Preferred language for e.g. news letters"
msgstr "Voorkeurstaal voor b.v.b. nieuwsbrieven" msgstr "Voorkeurstaal voor b.v.b. nieuwsbrieven"
#: members/models.py:266 #: models.py:266
msgid "Receive opt-in mailings" msgid "Receive opt-in mailings"
msgstr "Ontvang opt-in mailings" msgstr "Ontvang opt-in mailings"
#: members/models.py:267 #: models.py:267
msgid "Receive mailings about vacancies and events from Thalia's sponsors." msgid "Receive mailings about vacancies and events from Thalia's sponsors."
msgstr "Ontvang mailings over vacatures en evenmenten van Thalia's sponsoren" msgstr "Ontvang mailings over vacatures en evenmenten van Thalia's sponsoren"
#: members/models.py:273 #: models.py:273
msgid "Receive newsletter" msgid "Receive newsletter"
msgstr "Ontvang nieuwsbrief" msgstr "Ontvang nieuwsbrief"
#: members/models.py:274 #: models.py:274
msgid "Receive the Thalia Newsletter" msgid "Receive the Thalia Newsletter"
msgstr "Ontvang de Thalia nieuwsbrief" msgstr "Ontvang de Thalia nieuwsbrief"
#: members/models.py:281 #: models.py:281
msgid "" msgid ""
"Yes, I want Thalia to take the membership fees from my bank account through " "Yes, I want Thalia to take the membership fees from my bank account through "
"direct debit for each year." "direct debit for each year."
...@@ -243,127 +230,124 @@ msgstr "" ...@@ -243,127 +230,124 @@ msgstr ""
"Ja, ik wil dat Thalia verschuldigde lidmaatschapsgelden elk jaar van mijn " "Ja, ik wil dat Thalia verschuldigde lidmaatschapsgelden elk jaar van mijn "
"bankrekening afschrijft." "bankrekening afschrijft."
#: members/models.py:284 #: models.py:284
msgid "No, I will pay the contribution myself" msgid "No, I will pay the contribution myself"
msgstr "Nee, ik zal de contributie zelf betalen" msgstr "Nee, ik zal de contributie zelf betalen"
#: members/models.py:285 #: models.py:285
msgid "Direct debit" msgid "Direct debit"
msgstr "Automatische afschijving" msgstr "Automatische afschijving"
#: members/models.py:286 #: models.py:286
msgid "Each year, have Thalia take the membership fees from my bank account" msgid "Each year, have Thalia take the membership fees from my bank account"
msgstr "" msgstr ""
"Laat Thalia elk jaar het lidmaatschapsgeld van mijn bankrekening afschrijven" "Laat Thalia elk jaar het lidmaatschapsgeld van mijn bankrekening afschrijven"
#: members/models.py:292 #: models.py:292
msgid "Bank account" msgid "Bank account"
msgstr "Bankrekening" msgstr "Bankrekening"
#: members/models.py:293 #: models.py:293
msgid "Bank account for direct debit" msgid "Bank account for direct debit"
msgstr "Bankrekening voor automatische afschrijving" msgstr "Bankrekening voor automatische afschrijving"
#: members/models.py:315 #: models.py:315
msgid "Display name" msgid "Display name"
msgstr "Weergavenaam" msgstr "Weergavenaam"
#: members/models.py:340 #: models.py:340
msgid "Member" msgid "Member"
msgstr "Lid" msgstr "Lid"
#: members/models.py:341 #: models.py:341
msgid "Supporter" msgid "Supporter"
msgstr "Begunstiger" msgstr "Begunstiger"
#: members/models.py:342 #: models.py:342
msgid "Honorary Member" msgid "Honorary Member"
msgstr "Erelid" msgstr "Erelid"
#: members/models.py:347 #: models.py:347
msgid "Membership type" msgid "Membership type"
msgstr "Lidtype" msgstr "Lidtype"
#: members/models.py:356 #: models.py:356
msgid "User" msgid "User"
msgstr "Gebruiker" msgstr "Gebruiker"
#: members/models.py:360 #: models.py:360
msgid "Membership since" msgid "Membership since"
msgstr "Lid sinds" msgstr "Lid sinds"
#: members/models.py:361 #: models.py:361
msgid "The date the member started holding this membership." msgid "The date the member started holding this membership."
msgstr "De datum waarop het lid dit lidmaatschap is begonnen." msgstr "De datum waarop het lid dit lidmaatschap is begonnen."
#: members/models.py:366 #: models.py:366
msgid "Membership until" msgid "Membership until"
msgstr "Lid tot" msgstr "Lid tot"
#: members/models.py:367 #: models.py:367
msgid "The date the member stops holding this membership." msgid "The date the member stops holding this membership."
msgstr "De datum waarop het lid dit lidmaatschap beëindigd." msgstr "De datum waarop het lid dit lidmaatschap beëindigd."
#: members/templates/members/account.html:6 #: templates/members/account.html:6 templates/members/edit_profile.html:5
#: members/templates/members/edit_profile.html:5 #: templates/members/index.html:6 templates/members/index.html:9
#: members/templates/members/index.html:6 #: templates/members/profile.html:6
#: members/templates/members/index.html:9
#: members/templates/members/profile.html:6
msgid "members" msgid "members"
msgstr "leden" msgstr "leden"
#: members/templates/members/account.html:9 #: templates/members/account.html:9
msgid "Account" msgid "Account"
msgstr "Bankrekening" msgstr "Bankrekening"
#: members/templates/members/account.html:14 #: templates/members/account.html:14
#, python-format #, python-format
msgid "You’re currently logged in as <strong>%(user)s</strong>" msgid "You’re currently logged in as <strong>%(user)s</strong>"
msgstr "U bent momenteel ingelogd als <strong>%(user)s</strong>" msgstr "U bent momenteel ingelogd als <strong>%(user)s</strong>"
#: members/templates/members/account.html:19 #: templates/members/account.html:19
msgid "show public profile" msgid "show public profile"
msgstr "bekijk publieke profielpagina" msgstr "bekijk publieke profielpagina"
#: members/templates/members/account.html:20 #: templates/members/account.html:20
msgid "Take a look at your own profile." msgid "Take a look at your own profile."
msgstr "Bekijk je eigen profielpagina."