Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • AlekSIS/onboarding/AlekSIS-App-Kort
1 result
Show changes
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-03-19 15:48+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n % 10 == 1 && n % 100 != "
"11 ? 0 : n % 1 == 0 && n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % "
"100 > 14) ? 1 : n % 1 == 0 && (n % 10 ==0 || (n % 10 >=5 && n % 10 <=9) || "
"(n % 100 >=11 && n % 100 <=14 )) ? 2: 3);\n"
#: aleksis/apps/kort/apps.py:31
msgid "Access and manage printer status and print jobs"
msgstr ""
#: aleksis/apps/kort/forms.py:15
msgid "Select person(s) or group(s)"
msgstr ""
#: aleksis/apps/kort/forms.py:16
msgid "Select validity"
msgstr ""
#: aleksis/apps/kort/forms.py:17
msgid "Select layout"
msgstr ""
#: aleksis/apps/kort/forms.py:18
msgid "Select printer (optional)"
msgstr ""
#: aleksis/apps/kort/forms.py:22 aleksis/apps/kort/forms.py:111
#: aleksis/apps/kort/templates/kort/printer/detail.html:8
msgid "Card Printer"
msgstr ""
#: aleksis/apps/kort/forms.py:23
msgid "Select a printer to directly print the newly issued card."
msgstr ""
#: aleksis/apps/kort/forms.py:28
msgid "Persons"
msgstr ""
#: aleksis/apps/kort/forms.py:41
msgid "Groups"
msgstr ""
#: aleksis/apps/kort/forms.py:51 aleksis/apps/kort/models.py:191
msgid "Card layout"
msgstr ""
#: aleksis/apps/kort/forms.py:53 aleksis/apps/kort/models.py:263
#: aleksis/apps/kort/tables.py:30
#: aleksis/apps/kort/templates/kort/card/detail_content.html:24
#: aleksis/apps/kort/templates/kort/card/short.html:12
msgid "Valid until"
msgstr ""
#: aleksis/apps/kort/forms.py:63
msgid "You must select at least one person or group."
msgstr ""
#: aleksis/apps/kort/forms.py:71
msgid "The selected groups don't have any members."
msgstr ""
#: aleksis/apps/kort/forms.py:91
msgid "Generic attributes"
msgstr ""
#: aleksis/apps/kort/forms.py:93
msgid "Printer settings"
msgstr ""
#: aleksis/apps/kort/forms.py:138 aleksis/apps/kort/models.py:228
msgid "Required data fields"
msgstr ""
#: aleksis/apps/kort/models.py:24
msgid "Online"
msgstr ""
#: aleksis/apps/kort/models.py:25
msgid "Offline"
msgstr ""
#: aleksis/apps/kort/models.py:26
msgid "With errors"
msgstr ""
#: aleksis/apps/kort/models.py:27
msgid "Not registered"
msgstr ""
#: aleksis/apps/kort/models.py:56
msgid "Registered"
msgstr ""
#: aleksis/apps/kort/models.py:57
msgid "In progress"
msgstr ""
#: aleksis/apps/kort/models.py:58
msgid "Finished"
msgstr ""
#: aleksis/apps/kort/models.py:59
msgid "Failed"
msgstr ""
#: aleksis/apps/kort/models.py:64 aleksis/apps/kort/models.py:223
#: aleksis/apps/kort/templates/kort/card_layout/detail_content.html:11
#: aleksis/apps/kort/templates/kort/card_layout/short.html:4
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:11
#: aleksis/apps/kort/templates/kort/printer/short.html:4
msgid "Name"
msgstr ""
#: aleksis/apps/kort/models.py:65
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:24
msgid "Description"
msgstr ""
#: aleksis/apps/kort/models.py:66
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:17
#: aleksis/apps/kort/templates/kort/printer/short.html:8
msgid "Location"
msgstr ""
#: aleksis/apps/kort/models.py:70 aleksis/apps/kort/models.py:336
#: aleksis/apps/kort/tables.py:95
#: aleksis/apps/kort/templates/kort/card/detail_content.html:38
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:38
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:90
#: aleksis/apps/kort/templates/kort/printer/short.html:12
msgid "Status"
msgstr ""
#: aleksis/apps/kort/models.py:74 aleksis/apps/kort/models.py:340
msgid "Status text"
msgstr ""
#: aleksis/apps/kort/models.py:75 aleksis/apps/kort/tables.py:58
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:31
msgid "Last seen at"
msgstr ""
#: aleksis/apps/kort/models.py:80
msgid "OAuth2 application"
msgstr ""
#: aleksis/apps/kort/models.py:87
msgid "CUPS printer"
msgstr ""
#: aleksis/apps/kort/models.py:89
msgid "Generate card number on server"
msgstr ""
#: aleksis/apps/kort/models.py:91
msgid "Card detector"
msgstr ""
#: aleksis/apps/kort/models.py:181
msgid "Card printer"
msgstr ""
#: aleksis/apps/kort/models.py:182
#: aleksis/apps/kort/templates/kort/printer/list.html:8
#: aleksis/apps/kort/templates/kort/printer/list.html:9
msgid "Card printers"
msgstr ""
#: aleksis/apps/kort/models.py:186
msgid "Media file"
msgstr ""
#: aleksis/apps/kort/models.py:198
msgid "Media file for a card layout"
msgstr ""
#: aleksis/apps/kort/models.py:199
msgid "Media files for card layouts"
msgstr ""
#: aleksis/apps/kort/models.py:224
#: aleksis/apps/kort/templates/kort/card_layout/detail_content.html:43
msgid "Template"
msgstr ""
#: aleksis/apps/kort/models.py:225
#: aleksis/apps/kort/templates/kort/card_layout/detail_content.html:49
msgid "Custom CSS"
msgstr ""
#: aleksis/apps/kort/models.py:226
msgid "Width"
msgstr ""
#: aleksis/apps/kort/models.py:226 aleksis/apps/kort/models.py:227
msgid "in mm"
msgstr ""
#: aleksis/apps/kort/models.py:227
msgid "Height"
msgstr ""
#: aleksis/apps/kort/models.py:248
msgid "Template is invalid: {}"
msgstr ""
#: aleksis/apps/kort/models.py:254 aleksis/apps/kort/models.py:267
#: aleksis/apps/kort/templates/kort/card/detail_content.html:31
#: aleksis/apps/kort/templates/kort/card_layout/detail.html:8
msgid "Card Layout"
msgstr ""
#: aleksis/apps/kort/models.py:255
msgid "Card Layouts"
msgstr ""
#: aleksis/apps/kort/models.py:260
#: aleksis/apps/kort/templates/kort/card/detail_content.html:11
#: aleksis/apps/kort/templates/kort/card/short.html:4
msgid "Person"
msgstr ""
#: aleksis/apps/kort/models.py:262
msgid "Chip Number"
msgstr ""
#: aleksis/apps/kort/models.py:264 aleksis/apps/kort/tables.py:31
msgid "Deactivated"
msgstr ""
#: aleksis/apps/kort/models.py:270
msgid "PDF file"
msgstr ""
#: aleksis/apps/kort/models.py:303
msgid "There is no layout provided for the card."
msgstr ""
#: aleksis/apps/kort/models.py:322 aleksis/apps/kort/models.py:331
#: aleksis/apps/kort/templates/kort/card/detail.html:8
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:84
msgid "Card"
msgstr ""
#: aleksis/apps/kort/models.py:323
#: aleksis/apps/kort/templates/kort/card/list.html:8
#: aleksis/apps/kort/templates/kort/card/list.html:9
msgid "Cards"
msgstr ""
#: aleksis/apps/kort/models.py:328
msgid "Printer"
msgstr ""
#: aleksis/apps/kort/models.py:343
msgid "Card print job"
msgstr ""
#: aleksis/apps/kort/models.py:344
msgid "Card print jobs"
msgstr ""
#: aleksis/apps/kort/tables.py:28
#: aleksis/apps/kort/templates/kort/card/detail_content.html:17
#: aleksis/apps/kort/templates/kort/card/short.html:8
msgid "Chip number"
msgstr ""
#: aleksis/apps/kort/tables.py:29 aleksis/apps/kort/tables.py:57
msgid "Current status"
msgstr ""
#: aleksis/apps/kort/tables.py:32 aleksis/apps/kort/tables.py:61
#: aleksis/apps/kort/tables.py:85
msgid "Actions"
msgstr ""
#: aleksis/apps/kort/tables.py:54
msgid "Printer name"
msgstr ""
#: aleksis/apps/kort/tables.py:55
msgid "Printer location"
msgstr ""
#: aleksis/apps/kort/tables.py:59
msgid "Running jobs"
msgstr ""
#: aleksis/apps/kort/tables.py:81
msgid "Layout name"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/actions.html:8
#: aleksis/apps/kort/templates/kort/card/detail.html:9
#, python-format
msgid "Card of %(person)s"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/actions.html:14
#: aleksis/apps/kort/templates/kort/card/actions.html:31
#: aleksis/apps/kort/templates/kort/card_layout/actions.html:11
#: aleksis/apps/kort/templates/kort/printer/actions.html:11
msgid "Close"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/actions.html:20
#: aleksis/apps/kort/templates/kort/card_layout/actions.html:17
#: aleksis/apps/kort/templates/kort/printer/actions.html:17
msgid "Show"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/actions.html:25
msgid "Do you really want to deactivate the following card?"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/actions.html:35
#: aleksis/apps/kort/templates/kort/card/actions.html:41
msgid "Deactivate"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/actions.html:47
#: aleksis/apps/kort/templates/kort/card/delete.html:30
#: aleksis/apps/kort/templates/kort/card_layout/actions.html:33
#: aleksis/apps/kort/templates/kort/card_layout/delete.html:29
#: aleksis/apps/kort/templates/kort/card_layout/detail.html:31
#: aleksis/apps/kort/templates/kort/printer/actions.html:33
#: aleksis/apps/kort/templates/kort/printer/delete.html:29
#: aleksis/apps/kort/templates/kort/printer/detail.html:31
msgid "Delete"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/delete.html:8
msgid "Delete Card"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/delete.html:12
msgid "Do you really want to delete the following card?"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/delete.html:16
msgid ""
"\n"
" Please pay attention that a deletion of a card is irreversible and should be only used to clean up misprints.\n"
" If you just want to make a card unusable because a student has lost his card or left the school,\n"
" please deactivate the card instead.\n"
" "
msgstr ""
#: aleksis/apps/kort/templates/kort/card/delete.html:26
#: aleksis/apps/kort/templates/kort/card_layout/delete.html:25
#: aleksis/apps/kort/templates/kort/printer/delete.html:25
msgid "Go back"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/detail_content.html:6
msgid "Card details"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/detail_content.html:19
msgid "not set yet"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/detail_content.html:53
msgid "Show card as PDF"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/detail_content.html:61
msgid "Generate card as PDF"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/edit.html:12
#: aleksis/apps/kort/templates/kort/card/edit.html:13
msgid "Edit card"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/issue.html:12
#: aleksis/apps/kort/templates/kort/card/issue.html:13
msgid "Issue card(s)"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/issue.html:23
msgid ""
"\n"
" Please select the persons and/or the groups to whom you want to issue new cards.\n"
" After clicking on 'Next', you will be able to check whether the data of the persons\n"
" are complete and include everything needed for the cards.\n"
" "
msgstr ""
#: aleksis/apps/kort/templates/kort/card/issue.html:32
msgid ""
"\n"
" In the following table you can see all selected persons and the related data needed for the cards.\n"
" Please select the persons to whom you want to issue new cards.\n"
" "
msgstr ""
#: aleksis/apps/kort/templates/kort/card/issue.html:65
msgid "Previous step"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/issue.html:71
msgid "Issue cards for selected persons"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/issue.html:77
msgid "Next step"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/issue.html:83
msgid "Cancel"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/list.html:17
msgid "Issue new card(s)"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/print_form.html:8
#: aleksis/apps/kort/templates/kort/card/print_form.html:16
msgid "Print card"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/status.html:3
msgid "Valid"
msgstr ""
#: aleksis/apps/kort/templates/kort/card/status.html:5
msgid "Not valid"
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/actions.html:26
#: aleksis/apps/kort/templates/kort/card_layout/detail.html:24
#: aleksis/apps/kort/templates/kort/printer/actions.html:27
#: aleksis/apps/kort/templates/kort/printer/detail.html:24
msgid "Edit"
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/create.html:12
#: aleksis/apps/kort/templates/kort/card_layout/create.html:13
msgid "Create card layout"
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/create.html:23
#: aleksis/apps/kort/templates/kort/card_layout/edit.html:23
msgid "Media Files"
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/delete.html:8
msgid "Delete Card Layout"
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/delete.html:12
msgid "Do you really want to delete the following card layout?"
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/delete.html:16
msgid ""
"\n"
" Please pay attention that this also will prevent the successful finishing of all active print jobs\n"
" which use these template.\n"
" "
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/detail.html:15
msgid "Back to all layouts"
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/detail_content.html:6
msgid "Layout details"
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/detail_content.html:17
msgid "Size (w × h)"
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/detail_content.html:24
msgid "Media files"
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/detail_content.html:31
msgid "No media files uploaded."
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/edit.html:12
#: aleksis/apps/kort/templates/kort/card_layout/edit.html:13
msgid "Edit card layout"
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/instructions.html:4
msgid "Instructions on templating the card"
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/instructions.html:5
msgid ""
"\n"
" You will be able to use the following data in your individual template. The template has to been written in the\n"
" Django template language.\n"
" "
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/instructions.html:11
msgid "The chip number as string"
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/instructions.html:15
msgid "This will give you access to any attributes of the person object like name, personal data or contact data."
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/instructions.html:19
msgid "The date until when the card is valid"
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/instructions.html:24
msgid "This will give you access to the uploaded media files. Replace 0 by the number of your media file (starting with 0)."
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/list.html:8
#: aleksis/apps/kort/templates/kort/card_layout/list.html:9
msgid "Card layouts"
msgstr ""
#: aleksis/apps/kort/templates/kort/card_layout/list.html:17
msgid "Create new card layout"
msgstr ""
#: aleksis/apps/kort/templates/kort/person_status.html:5
#, python-format
msgid "%(count)s missing data fields"
msgstr ""
#: aleksis/apps/kort/templates/kort/person_status.html:10
msgid "Data complete"
msgstr ""
#: aleksis/apps/kort/templates/kort/picture.html:4
msgid "Person picture"
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/create.html:12
#: aleksis/apps/kort/templates/kort/printer/create.html:13
msgid "Create card"
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/delete.html:8
msgid "Delete Card Printer"
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/delete.html:12
msgid "Do you really want to delete the following card printer?"
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/delete.html:16
msgid ""
"\n"
" Please pay attention that this also will deactivate the access for the print client and you would have to\n"
" reconfigure the client if you want to use it further.\n"
" "
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/detail.html:15
msgid "Back to all printers"
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:6
msgid "Printer details"
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:33
msgid "never seen yet"
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:60
msgid "Setup printer client"
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:62
msgid ""
"\n"
" To enable printing, you have to register the print client on the device\n"
" which the printer is connected to.\n"
" "
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:67
msgid "1. Download print client"
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:68
msgid "2. Download configuration file"
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:71
msgid "Download configuration"
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:73
msgid "3. Setup client"
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:80
msgid "Print jobs"
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/detail_content.html:87
msgid "Created at"
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/edit.html:12
#: aleksis/apps/kort/templates/kort/printer/edit.html:13
msgid "Edit card printer"
msgstr ""
#: aleksis/apps/kort/templates/kort/printer/list.html:17
msgid "Register new card printer"
msgstr ""
#: aleksis/apps/kort/views.py:69
msgid "The cards have been created successfully."
msgstr ""
#: aleksis/apps/kort/views.py:137 aleksis/apps/kort/views.py:193
msgid "The print job #{} for the card {} on the printer {} has been created successfully."
msgstr ""
#: aleksis/apps/kort/views.py:145 aleksis/apps/kort/views.py:200
msgid "The print job couldn't be started because of the following error: {}"
msgstr ""
#: aleksis/apps/kort/views.py:158
msgid "The card has been deleted successfully."
msgstr ""
#: aleksis/apps/kort/views.py:171
msgid "The card has been deactivated successfully."
msgstr ""
#: aleksis/apps/kort/views.py:220
msgid "The chip number is missing."
msgstr ""
#: aleksis/apps/kort/views.py:232
msgid "Progress: Generate card layout as PDF file"
msgstr ""
#: aleksis/apps/kort/views.py:233
msgid "Generating PDF file …"
msgstr ""
#: aleksis/apps/kort/views.py:234
msgid "The PDF file with the card layout has been generated successfully."
msgstr ""
#: aleksis/apps/kort/views.py:235
msgid "There was a problem while generating the PDF file."
msgstr ""
#: aleksis/apps/kort/views.py:237
msgid "Show card"
msgstr ""
#: aleksis/apps/kort/views.py:275
msgid "The card printer has been created successfully."
msgstr ""
#: aleksis/apps/kort/views.py:288
msgid "The card printer has been changed successfully."
msgstr ""
#: aleksis/apps/kort/views.py:301
msgid "The card printer has been deleted successfully."
msgstr ""
#: aleksis/apps/kort/views.py:364
msgid "The card layout has been created successfully."
msgstr ""
#: aleksis/apps/kort/views.py:382
msgid "The card layout has been changed successfully."
msgstr ""
#: aleksis/apps/kort/views.py:395
msgid "The card layout has been deleted successfully."
msgstr ""
from django.utils.translation import ugettext_lazy as _
MENUS = {
"NAV_MENU_CORE": [
{
"name": _("Student ID Cards"),
"url": "#",
"root": True,
"svg_icon": "mdi:card-account-details-outline",
"validators": [
"menu_generator.validators.is_authenticated",
"aleksis.core.util.core_helpers.has_person",
],
"submenu": [
{
"name": _("All Cards"),
"url": "cards",
"svg_icon": "mdi:card-multiple-outline",
"validators": [
(
"aleksis.core.util.predicates.permission_validator",
"core.view_cards_rule",
)
],
},
{
"name": _("Card Printers"),
"url": "card_printers",
"svg_icon": "mdi:printer-outline",
"validators": [
(
"aleksis.core.util.predicates.permission_validator",
"core.view_cardprinters_rule",
)
],
},
{
"name": _("Card Layouts"),
"url": "card_layouts",
"svg_icon": "mdi:card-account-details-star-outline",
"validators": [
(
"aleksis.core.util.predicates.permission_validator",
"core.view_cardlayouts_rule",
)
],
},
],
}
]
}
from django.db import migrations
def _migrate_scopes(apps, schema_editor):
CardPrinter = apps.get_model("kort", "CardPrinter")
for printer in CardPrinter.objects.all():
application = printer.oauth2_application
application.allowed_scopes = [f"card_printer_{printer.id}"]
application.authorization_grant_type = "client-credentials"
application.save()
class Migration(migrations.Migration):
dependencies = [
('kort', '0014_auto_20220803_0025'),
]
operations = [
migrations.RunPython(_migrate_scopes)
]
......@@ -94,9 +94,10 @@ class CardPrinter(ExtensibleModel):
if not self.oauth2_application:
application = OAuthApplication(
client_type=OAuthApplication.CLIENT_CONFIDENTIAL,
authorization_grant_type=OAuthApplication.GRANT_AUTHORIZATION_CODE,
authorization_grant_type=OAuthApplication.GRANT_CLIENT_CREDENTIALS,
name=f"Card printer: {self.name}",
redirect_uris="urn:ietf:wg:oauth:2.0:oob",
allowed_scopes=[self.scope],
)
application.save()
self.oauth2_application = application
......@@ -171,6 +172,11 @@ class CardPrinter(ExtensibleModel):
return jobs.first()
return None
@property
def scope(self) -> str:
"""Return OAuth2 scope name to access PDF file via API."""
return f"{self.SCOPE_PREFIX}_{self.id}"
class Meta:
verbose_name = _("Card printer")
verbose_name_plural = _("Card printers")
......@@ -270,7 +276,7 @@ class Card(ExtensibleModel):
@property
def is_valid(self):
return (
self.valid_until <= timezone.now().date() and not self.deactivated and self.chip_number
self.valid_until >= timezone.now().date() and not self.deactivated and self.chip_number
)
def deactivate(self):
......
from rules import add_rule
from rules import add_perm
from aleksis.core.util.predicates import (
has_any_object,
......@@ -12,76 +12,81 @@ from .models import Card, CardLayout, CardPrinter
view_card_printers_predicate = has_person & (
has_global_perm("kort.view_cardprinter") | has_any_object("kort.view_cardprinter", CardPrinter)
)
add_rule("kort.view_cardprinters_rule", view_card_printers_predicate)
add_perm("kort.view_cardprinters_rule", view_card_printers_predicate)
view_card_printer_predicate = has_person & (
has_global_perm("kort.view_cardprinter") | has_object_perm("kort.view_cardprinter")
)
add_rule("kort.view_cardprinter_rule", view_card_printer_predicate)
add_perm("kort.view_cardprinter_rule", view_card_printer_predicate)
create_card_printer_predicate = view_card_printers_predicate & has_global_perm(
"kort.add_cardprinter"
)
add_rule("kort.create_cardprinter_rule", create_card_printer_predicate)
add_perm("kort.create_cardprinter_rule", create_card_printer_predicate)
edit_card_printer_predicate = view_card_printer_predicate & (
has_global_perm("kort.change_cardprinter") | has_object_perm("kort.change_cardprinter")
)
add_rule("kort.edit_cardprinter_rule", edit_card_printer_predicate)
add_perm("kort.edit_cardprinter_rule", edit_card_printer_predicate)
delete_card_printer_predicate = view_card_printer_predicate & (
has_global_perm("kort.delete_cardprinter") | has_object_perm("kort.delete_cardprinter")
)
add_rule("kort.delete_cardprinter_rule", delete_card_printer_predicate)
add_perm("kort.delete_cardprinter_rule", delete_card_printer_predicate)
view_card_layouts_predicate = has_person & (
has_global_perm("kort.view_cardlayout") | has_any_object("kort.view_cardlayout", CardLayout)
)
add_rule("kort.view_cardlayouts_rule", view_card_layouts_predicate)
add_perm("kort.view_cardlayouts_rule", view_card_layouts_predicate)
view_card_layout_predicate = has_person & (
has_global_perm("kort.view_cardlayout") | has_object_perm("kort.view_cardlayout")
)
add_rule("kort.view_cardlayout_rule", view_card_layout_predicate)
add_perm("kort.view_cardlayout_rule", view_card_layout_predicate)
create_card_layout_predicate = view_card_layouts_predicate & has_global_perm("kort.add_cardlayout")
add_rule("kort.create_cardlayout_rule", create_card_layout_predicate)
add_perm("kort.create_cardlayout_rule", create_card_layout_predicate)
edit_card_layout_predicate = view_card_layout_predicate & (
has_global_perm("kort.change_cardlayout") | has_object_perm("kort.change_cardlayout")
)
add_rule("kort.edit_cardlayout_rule", edit_card_layout_predicate)
add_perm("kort.edit_cardlayout_rule", edit_card_layout_predicate)
delete_card_layout_predicate = view_card_layout_predicate & (
has_global_perm("kort.delete_cardlayout") | has_object_perm("kort.delete_cardlayout")
)
add_rule("kort.delete_cardlayout_rule", delete_card_layout_predicate)
add_perm("kort.delete_cardlayout_rule", delete_card_layout_predicate)
view_cards_predicate = has_person & (
has_global_perm("kort.view_card") | has_any_object("kort.view_card", Card)
)
add_rule("kort.view_cards_rule", view_cards_predicate)
add_perm("kort.view_cards_rule", view_cards_predicate)
view_card_predicate = has_person & (
has_global_perm("kort.view_card") | has_object_perm("kort.view_card")
)
add_rule("kort.view_card_rule", view_card_predicate)
add_perm("kort.view_card_rule", view_card_predicate)
create_card_predicate = view_cards_predicate & has_global_perm("kort.add_card")
add_rule("kort.create_card_rule", create_card_predicate)
add_perm("kort.create_card_rule", create_card_predicate)
edit_card_predicate = view_card_predicate & (
has_global_perm("kort.change_card") | has_object_perm("kort.change_card")
)
add_rule("kort.edit_card_rule", edit_card_predicate)
add_perm("kort.edit_card_rule", edit_card_predicate)
delete_card_predicate = view_card_predicate & (
has_global_perm("kort.delete_card") | has_object_perm("kort.delete_card")
)
add_rule("kort.delete_card_rule", delete_card_predicate)
add_perm("kort.delete_card_rule", delete_card_predicate)
print_card_predicate = edit_card_predicate
add_rule("kort.print_card_rule", print_card_predicate)
add_perm("kort.print_card_rule", print_card_predicate)
deactivate_card_predicate = edit_card_predicate
add_rule("kort.deactivate_card_rule", deactivate_card_predicate)
add_perm("kort.deactivate_card_rule", deactivate_card_predicate)
view_menu_predicate = (
view_cards_predicate | view_card_printers_predicate | view_card_layouts_predicate
)
add_perm("kort.view_menu_rule", view_menu_predicate)
from aleksis.core.settings import JS_URL
YARN_INSTALLED_APPS = ["pdfobject"]
ANY_JS = {
"pdfobject": {"js_url": JS_URL + "/pdfobject/pdfobject.min.js"},
}
INSTALLED_APPS = ["django_ace"]
......@@ -10,6 +10,5 @@
{% block content %}
{% include_js "pdfobject" %}
{% include "kort/card/detail_content.html" with card=object %}
{% endblock %}
......@@ -30,6 +30,5 @@
{# </form>#}
{# <h2>{% trans "Selected persons" %}</h2>#}
{% include_js "pdfobject" %}
{% render_table table %}
{% endblock %}
......@@ -37,6 +37,9 @@ urlpatterns = [
views.CardLayoutDeleteView.as_view(),
name="delete_card_layout",
),
]
api_urlpatterns = [
path("api/v1/printers/", api.CardPrinterDetails.as_view(), name="api_card_printer"),
path(
"api/v1/printers/<int:pk>/status/",
......
[tool.poetry]
name = "AlekSIS-App-Kort"
version = "0.1"
version = "0.1.1"
packages = [
{ include = "aleksis" }
]
......@@ -25,10 +25,10 @@ secondary = true
[tool.poetry.dependencies]
python = "^3.9"
aleksis-core = "^2.8"
aleksis-core = "^3.0b2"
python-barcode = "^0.14.0"
django-ace = "^1.0.12"
django-formtools = "^2.3"
django-ace = "^1.0.12"
[tool.poetry.dev-dependencies]
aleksis-builddeps = "*"
......
[tox]
skipsdist = True
skip_missing_interpreters = true
envlist = py37,py38,py39
envlist = py39,py310,py311
[testenv]
whitelist_externals = poetry
sudo
sh
skip_install = true
envdir = {toxworkdir}/globalenv
commands_pre =
poetry install
poetry run aleksis-admin yarn install
poetry run aleksis-admin vite build
poetry run aleksis-admin collectstatic --no-input
commands =
poetry run pytest --cov=. {posargs} aleksis/
......@@ -27,6 +28,8 @@ commands =
poetry run black --check --diff aleksis/
poetry run isort -c --diff --stdout aleksis/
poetry run flake8 {posargs} aleksis/
sh -c "aleksis-admin yarn run prettier --check --ignore-path=$(pwd)/.prettierignore $(pwd)"
sh -c "aleksis-admin yarn run eslint $(pwd)/aleksis/**/*/frontend/**/*.{js,vue} --config=$(pwd)/.eslintrc.js --resolve-plugins-relative-to=."
[testenv:security]
commands =
......@@ -46,11 +49,12 @@ commands = poetry run make -C docs/ html {posargs}
commands =
poetry run isort aleksis/
poetry run black aleksis/
sh -c "aleksis-admin yarn run prettier --write --ignore-path=$(pwd)/.prettierignore $(pwd)"
[testenv:makemessages]
commands =
poetry run aleksis-admin makemessages --no-wrap -e html,txt,py,email -i static -l ar -l de_DE -l fr -l nb_NO -l tr_TR -l la
poetry run aleksis-admin makemessages --no-wrap -d djangojs -i **/node_modules -l ar -l de_DE -l fr -l nb_NO -l tr_TR -l la
poetry run aleksis-admin makemessages --no-wrap -e html,txt,py,email -i static -l ar -l de_DE -l fr -l nb_NO -l tr_TR -l la -l uk -l ru
poetry run aleksis-admin makemessages --no-wrap -d djangojs -i **/node_modules -l ar -l de_DE -l fr -l nb_NO -l tr_TR -l la -l uk -l ru
[flake8]
max_line_length = 100
......