Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access method to door api log, show only NFC in NFC ui #555

Merged
merged 2 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion api/locale/fi/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-12-01 18:23+0200\n"
"POT-Creation-Date: 2025-02-02 14:59+0000\n"
"PO-Revision-Date: 2020-12-01 18:28+0200\n"
"Last-Translator: Sami Olmari <sami@olmari.fi>\n"
"Language-Team: \n"
Expand All @@ -17,6 +17,8 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.4.2\n"
"X-Language: fi\n"
"X-Source-Language: en\n"

#: api/models.py:19
msgid "User creation date"
Expand Down Expand Up @@ -90,5 +92,13 @@ msgstr "Varaaja"
msgid "Who claimed this entry"
msgstr "Kuka varasi tämän merkinnän"

#: api/models.py:90
msgid "Method"
msgstr "Tapa"

#: api/models.py:91
msgid "Method of device access"
msgstr "Kirjautumistapa"

#~ msgid "User who claimed this"
#~ msgstr "Käyttäjä joka haltuunotti tämän"
23 changes: 23 additions & 0 deletions api/migrations/0007_deviceaccesslogentry_method.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 5.1.5 on 2025-02-02 14:58

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("api", "0006_auto_20201201_1558"),
]

operations = [
migrations.AddField(
model_name="deviceaccesslogentry",
name="method",
field=models.CharField(
default="",
help_text="Method of device access",
max_length=64,
verbose_name="Method",
),
),
]
8 changes: 8 additions & 0 deletions api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,11 @@ class DeviceAccessLogEntry(models.Model):
help_text=_("Who claimed this entry"),
on_delete=models.SET_NULL,
)

method = models.CharField(
blank=False,
verbose_name=_("Method"),
help_text=_("Method of device access"),
default="",
max_length=64,
)
1 change: 1 addition & 0 deletions api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def access_token_abstraction(self, request, format, method):

logentry.device = device
logentry.payload = access_token
logentry.method = method

# 0 = success, any other = failure
response_status = 0
Expand Down
62 changes: 33 additions & 29 deletions www/locale/fi/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-02-01 17:19+0000\n"
"POT-Creation-Date: 2025-02-02 14:59+0000\n"
"PO-Revision-Date: 2020-12-01 18:35+0200\n"
"Last-Translator: Sami Olmari <sami@olmari.fi>\n"
"Language-Team: \n"
Expand All @@ -32,44 +32,44 @@ msgstr "Jäsenpalvelut"
msgid "You must select at least one service"
msgstr "Valitse vähintään yksi jäsenpalvelu"

#: www/forms.py:92
#: www/forms.py:91
#, python-format
msgid "%(servicename)s, %(cost)s"
msgstr "%(servicename)s, %(cost)s"

#: www/forms.py:100 www/templates/www/custominvoice.html:32
#: www/forms.py:99 www/templates/www/custominvoice.html:32
#: www/templates/www/custominvoice.html:55 www/templates/www/user.html:136
#: www/templates/www/usersettings.html:51
msgid "Service"
msgstr "Jäsenpalvelu"

#: www/forms.py:102
#: www/forms.py:101
msgid "Choose service.."
msgstr "Valitse palvelu.."

#: www/forms.py:105
#: www/forms.py:104
msgid "How many units of service you want"
msgstr "Montako kertaa haluat maksaa palvelun"

#: www/forms.py:108
#: www/forms.py:107
msgid "Price per unit"
msgstr "Hinta per yksikkö"

#: www/forms.py:109
#: www/forms.py:108
msgid "See price from the service selected above"
msgstr "Katso hinta valitusta palvelusta yllä"

#: www/forms.py:124
#: www/forms.py:123
#, python-format
msgid "Price cannot be above service max cost: %(max)s"
msgstr "Hinta ei voi olla yli maksimin: %(max)s"

#: www/forms.py:129
#: www/forms.py:128
#, python-format
msgid "Cost cannot be below service min cost: %(min)s"
msgstr "Hinta ei voi olla alle minimin: %(min)s"

#: www/forms.py:135
#: www/forms.py:134
#, python-format
msgid "Price must be the service cost: %(cost)s"
msgstr "Hinnan pitää olla palvelun hinta: %(cost)s"
Expand All @@ -78,7 +78,7 @@ msgstr "Hinnan pitää olla palvelun hinta: %(cost)s"
#: www/templates/registration/login.html:11
#: www/templates/registration/login.html:21
#: www/templates/registration/password_reset_complete.html:15
#: www/templates/www/base.html:52
#: www/templates/www/base.html:53
msgid "Log in"
msgstr "Kirjaudu sisään"

Expand Down Expand Up @@ -254,31 +254,35 @@ msgstr "Tiliote"
msgid "Custom invoices"
msgstr "Vapaamuotoiset laskut"

#: www/templates/www/base.html:43
#: www/templates/www/base.html:41
msgid "Django Admin"
msgstr "Djangon ylläpitokäyttöliittymä"

#: www/templates/www/base.html:44
msgid "Apply membership"
msgstr "Hae jäsenyyttä"

#: www/templates/www/base.html:50
#: www/templates/www/base.html:51
msgid "log out"
msgstr "kirjaudu ulos"

#: www/templates/www/base.html:59
#: www/templates/www/base.html:60
msgid "Language"
msgstr "Kieli"

#: www/templates/www/base.html:86
#: www/templates/www/base.html:87
msgid "Privacy policy"
msgstr "Tietosuojakäytäntö"

#: www/templates/www/base.html:87
#: www/templates/www/base.html:88
msgid "Report bugs at"
msgstr "Raportoi bugit ja osallistu projektiin"

#: www/templates/www/base.html:87
#: www/templates/www/base.html:88
msgid "GitHub"
msgstr "GitHub"

#: www/templates/www/base.html:88
#: www/templates/www/base.html:89
msgid "View changelog"
msgstr "Katso muutoslokia"

Expand Down Expand Up @@ -729,53 +733,53 @@ msgstr ""
"Jos sinulla on kysyttävää tai haluat muuttaa jotain mitä ei ole saatavilla "
"täällä, voit lähettää ehdotuksen sähköpostilla."

#: www/views.py:197
#: www/views.py:195
#, python-format
msgid "Rejected member application from %(name)s"
msgstr "Hylätty %(name)s:n jäsenhakemus"

#: www/views.py:202
#: www/views.py:200
#, python-format
msgid "Accepted member application from %(name)s"
msgstr "Hyväksytty %(name)sn jäsenhakemus"

#: www/views.py:255
#: www/views.py:253
msgid "User details saved"
msgstr "Käyttäjän tiedot tallennettu"

#: www/views.py:310
#: www/views.py:309
msgid "Welcome to member's Matrix space"
msgstr "Tervetuloa jäsenten Matrix-tilaan"

#: www/views.py:311
#: www/views.py:310
msgid "You have been invited"
msgstr "Sinut on nyt kutsuttu"

#: www/views.py:330
#: www/views.py:329
msgid "You already have this service"
msgstr "Sinulla on jo tämä jäsenpalvelu"

#: www/views.py:333
#: www/views.py:332
msgid "This service cannot be self subscribed to"
msgstr "Tätä palvelua ei voi ottaa käyttöön itsepalveluna"

#: www/views.py:341
#: www/views.py:340
msgid "Service subscribed. You may now pay for it."
msgstr "Palvelu otettu käyttöön. Ole hyvä ja maksa se seuraavaksi."

#: www/views.py:361
#: www/views.py:360
msgid "Service unsubscribed"
msgstr "Palvelu poistettu käytöstä"

#: www/views.py:366
#: www/views.py:365
msgid ""
"Service is not active. You must pay for the service first. Contact staff if "
"needed."
msgstr ""
"Palvelu ei ole aktiivinen. Maksa se ensin. Ota yhtes hallitukseen jos on "
"kysyttävää."

#: www/views.py:398
#: www/views.py:397
msgid "NFC Card successfully claimed"
msgstr "NFC-Kortti varattu onnistuneesti"

Expand Down
1 change: 1 addition & 0 deletions www/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ def test_nfc(self):
logentry = DeviceAccessLogEntry()
logentry.payload = "1234567"
logentry.device = device
logentry.method = "nfc"
logentry.granted = False
logentry.save()

Expand Down
1 change: 1 addition & 0 deletions www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ def usersettings(request, id):
granted=False,
nfccard=None,
claimed_by=None,
method='nfc',
date__gte=timezone.now() - timedelta(minutes=5),
)
.exclude(payload__isnull=True)
Expand Down