mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-24 20:33:11 +00:00
[Printer] Don't display 'Printer' button if not logged in
This commit is contained in:
parent
7184aa7016
commit
6fd8111a3b
5 changed files with 93 additions and 77 deletions
|
@ -0,0 +1,5 @@
|
||||||
|
"""
|
||||||
|
Printer app
|
||||||
|
"""
|
||||||
|
|
||||||
|
from .acl import *
|
21
printer/acl.py
Normal file
21
printer/acl.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
"""printer.acl
|
||||||
|
|
||||||
|
Here are defined some functions to check acl on the application.
|
||||||
|
"""
|
||||||
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
|
|
||||||
|
def can_view(user):
|
||||||
|
"""Check if an user can view the application.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
user: The user who wants to view the application.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
A couple (allowed, msg) where allowed is a boolean which is True if
|
||||||
|
viewing is granted and msg is a message (can be None).
|
||||||
|
"""
|
||||||
|
can = user.has_module_perms('printer')
|
||||||
|
return can, None if can else _("You don't have the right to view Printer"
|
||||||
|
" application.")
|
||||||
|
|
Binary file not shown.
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2018-10-27 04:34+0200\n"
|
"POT-Creation-Date: 2018-10-27 19:03+0200\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -18,227 +18,221 @@ msgstr ""
|
||||||
"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"
|
||||||
|
|
||||||
#: forms.py:33
|
#: printer/acl.py:19
|
||||||
|
msgid "You don't have the right to view Printer application."
|
||||||
|
msgstr "Vous n'avez pas le droit de voir l'application d'impression"
|
||||||
|
|
||||||
|
#: printer/forms.py:33
|
||||||
msgid "Print As"
|
msgid "Print As"
|
||||||
msgstr "Imprimer en tant que"
|
msgstr "Imprimer en tant que"
|
||||||
|
|
||||||
#: models.py:87
|
#: printer/models.py:87
|
||||||
msgid "This is not your print operation task"
|
msgid "This is not your print operation task"
|
||||||
msgstr "Ceci n'est pas votre tache"
|
msgstr "Ceci n'est pas votre tache"
|
||||||
|
|
||||||
#: models.py:124
|
#: printer/models.py:124
|
||||||
msgid "Pending"
|
msgid "Pending"
|
||||||
msgstr "En attente"
|
msgstr "En attente"
|
||||||
|
|
||||||
#: models.py:125
|
#: printer/models.py:125
|
||||||
msgid "Printable"
|
msgid "Printable"
|
||||||
msgstr "Imprimable"
|
msgstr "Imprimable"
|
||||||
|
|
||||||
#: models.py:126
|
#: printer/models.py:126
|
||||||
msgid "Running"
|
msgid "Running"
|
||||||
msgstr "En cours..."
|
msgstr "En cours..."
|
||||||
|
|
||||||
#: models.py:127
|
#: printer/models.py:127
|
||||||
msgid "Cancelled"
|
msgid "Cancelled"
|
||||||
msgstr "Annulée"
|
msgstr "Annulée"
|
||||||
|
|
||||||
#: models.py:128
|
#: printer/models.py:128
|
||||||
msgid "Finished"
|
msgid "Finished"
|
||||||
msgstr "Terminée"
|
msgstr "Terminée"
|
||||||
|
|
||||||
#: models.py:140
|
#: printer/models.py:140
|
||||||
msgid "File"
|
msgid "File"
|
||||||
msgstr "Fichier"
|
msgstr "Fichier"
|
||||||
|
|
||||||
#: models.py:145 templates/printer/aff_jobs.html:31
|
#: printer/models.py:145 printer/templates/printer/aff_jobs.html:35
|
||||||
msgid "File Name"
|
msgid "File Name"
|
||||||
msgstr "Nom du fichier"
|
msgstr "Nom du fichier"
|
||||||
|
|
||||||
#: models.py:152 templates/printer/aff_jobs.html:34
|
#: printer/models.py:152 printer/templates/printer/aff_jobs.html:38
|
||||||
msgid "Status"
|
msgid "Status"
|
||||||
msgstr "Status"
|
msgstr "Status"
|
||||||
|
|
||||||
#: models.py:161
|
#: printer/models.py:161
|
||||||
#, fuzzy
|
|
||||||
#| msgid "Print As"
|
|
||||||
msgid "Print as"
|
msgid "Print as"
|
||||||
msgstr "Imprimer en tant que"
|
msgstr "Imprimer en tant que"
|
||||||
|
|
||||||
#: models.py:166 templates/printer/aff_jobs.html:36
|
#: printer/models.py:166 printer/templates/printer/aff_jobs.html:40
|
||||||
#, fuzzy
|
|
||||||
#| msgid "price"
|
|
||||||
msgid "Price"
|
msgid "Price"
|
||||||
msgstr "Prix"
|
msgstr "Prix"
|
||||||
|
|
||||||
#: models.py:174
|
#: printer/models.py:174
|
||||||
msgid "Format"
|
msgid "Format"
|
||||||
msgstr "Format"
|
msgstr "Format"
|
||||||
|
|
||||||
#: models.py:180 settings.py:25
|
#: printer/models.py:180 printer/settings.py:25
|
||||||
msgid "Color"
|
msgid "Color"
|
||||||
msgstr "Couleur"
|
msgstr "Couleur"
|
||||||
|
|
||||||
#: models.py:186
|
#: printer/models.py:186
|
||||||
msgid "Disposition"
|
msgid "Disposition"
|
||||||
msgstr "Disposition"
|
msgstr "Disposition"
|
||||||
|
|
||||||
#: models.py:190
|
#: printer/models.py:190
|
||||||
msgid "Count"
|
msgid "Count"
|
||||||
msgstr "Nombre"
|
msgstr "Nombre"
|
||||||
|
|
||||||
#: models.py:196
|
#: printer/models.py:196
|
||||||
msgid "Stapling"
|
msgid "Stapling"
|
||||||
msgstr "Agrafage"
|
msgstr "Agrafage"
|
||||||
|
|
||||||
#: models.py:202
|
#: printer/models.py:202
|
||||||
msgid "Perforation"
|
msgid "Perforation"
|
||||||
msgstr "Perforation"
|
msgstr "Perforation"
|
||||||
|
|
||||||
#: models.py:243
|
#: printer/models.py:243
|
||||||
msgid "This is not your print job"
|
msgid "This is not your print job"
|
||||||
msgstr "Ceci n'est pas votre tache"
|
msgstr "Ceci n'est pas votre tache"
|
||||||
|
|
||||||
#: models.py:251
|
#: printer/models.py:251
|
||||||
#, fuzzy
|
|
||||||
#| msgid "This is not your print operation task"
|
|
||||||
msgid "This is not your print operation job"
|
msgid "This is not your print operation job"
|
||||||
msgstr "Ceci n'est pas votre tache"
|
msgstr "Ceci n'est pas votre tâche"
|
||||||
|
|
||||||
#: settings.py:20
|
#: printer/settings.py:20
|
||||||
msgid "A4"
|
msgid "A4"
|
||||||
msgstr "A4"
|
msgstr "A4"
|
||||||
|
|
||||||
#: settings.py:21
|
#: printer/settings.py:21
|
||||||
msgid "A3"
|
msgid "A3"
|
||||||
msgstr "A3"
|
msgstr "A3"
|
||||||
|
|
||||||
#: settings.py:24
|
#: printer/settings.py:24
|
||||||
msgid "Greyscale"
|
msgid "Greyscale"
|
||||||
msgstr "Noir et blanc"
|
msgstr "Noir et blanc"
|
||||||
|
|
||||||
#: settings.py:28
|
#: printer/settings.py:28
|
||||||
msgid "Two sided"
|
msgid "Two sided"
|
||||||
msgstr "Recto-verso"
|
msgstr "Recto-verso"
|
||||||
|
|
||||||
#: settings.py:29
|
#: printer/settings.py:29
|
||||||
msgid "One sided"
|
msgid "One sided"
|
||||||
msgstr "Recto"
|
msgstr "Recto"
|
||||||
|
|
||||||
#: settings.py:30
|
#: printer/settings.py:30
|
||||||
msgid "Booklet"
|
msgid "Booklet"
|
||||||
msgstr "Livret"
|
msgstr "Livret"
|
||||||
|
|
||||||
#: settings.py:33 settings.py:40
|
#: printer/settings.py:33 printer/settings.py:40
|
||||||
msgid "None"
|
msgid "None"
|
||||||
msgstr "Aucun"
|
msgstr "Aucun"
|
||||||
|
|
||||||
#: settings.py:34
|
#: printer/settings.py:34
|
||||||
msgid "One top left"
|
msgid "One top left"
|
||||||
msgstr "En haut à gauche"
|
msgstr "En haut à gauche"
|
||||||
|
|
||||||
#: settings.py:35
|
#: printer/settings.py:35
|
||||||
msgid "One top right"
|
msgid "One top right"
|
||||||
msgstr "En haut à droite"
|
msgstr "En haut à droite"
|
||||||
|
|
||||||
#: settings.py:36
|
#: printer/settings.py:36
|
||||||
msgid "Two left sided"
|
msgid "Two left sided"
|
||||||
msgstr "Deux à gauche"
|
msgstr "Deux à gauche"
|
||||||
|
|
||||||
#: settings.py:37
|
#: printer/settings.py:37
|
||||||
msgid "Two right sided"
|
msgid "Two right sided"
|
||||||
msgstr "Deux à droite"
|
msgstr "Deux à droite"
|
||||||
|
|
||||||
#: settings.py:41
|
#: printer/settings.py:41
|
||||||
msgid "Two left sided holes"
|
msgid "Two left sided holes"
|
||||||
msgstr "Deux trous à gauche"
|
msgstr "Deux trous à gauche"
|
||||||
|
|
||||||
#: settings.py:42
|
#: printer/settings.py:42
|
||||||
msgid "Two right sided holes"
|
msgid "Two right sided holes"
|
||||||
msgstr "Deux trous à droite"
|
msgstr "Deux trous à droite"
|
||||||
|
|
||||||
#: settings.py:43
|
#: printer/settings.py:43
|
||||||
msgid "Two top holes"
|
msgid "Two top holes"
|
||||||
msgstr "Deux trous en haut"
|
msgstr "Deux trous en haut"
|
||||||
|
|
||||||
#: settings.py:44
|
#: printer/settings.py:44
|
||||||
msgid "Two bottom holes"
|
msgid "Two bottom holes"
|
||||||
msgstr "Deux trous en bas"
|
msgstr "Deux trous en bas"
|
||||||
|
|
||||||
#: settings.py:45
|
#: printer/settings.py:45
|
||||||
msgid "Four left sided holes"
|
msgid "Four left sided holes"
|
||||||
msgstr "Quatre trous à gauche"
|
msgstr "Quatre trous à gauche"
|
||||||
|
|
||||||
#: settings.py:46
|
#: printer/settings.py:46
|
||||||
msgid "Four right sided holes"
|
msgid "Four right sided holes"
|
||||||
msgstr "Quatre trous à droite"
|
msgstr "Quatre trous à droite"
|
||||||
|
|
||||||
#: templates/printer/aff_jobs.html:32
|
#: printer/templates/printer/aff_jobs.html:36
|
||||||
msgid "By user"
|
msgid "By user"
|
||||||
msgstr "Par"
|
msgstr "Par"
|
||||||
|
|
||||||
#: templates/printer/aff_jobs.html:33
|
#: printer/templates/printer/aff_jobs.html:37
|
||||||
msgid "Start at"
|
msgid "Start at"
|
||||||
msgstr "Début"
|
msgstr "Début"
|
||||||
|
|
||||||
#: templates/printer/aff_jobs.html:35
|
#: printer/templates/printer/aff_jobs.html:39
|
||||||
msgid "Number"
|
msgid "Number"
|
||||||
msgstr "Exemplaires"
|
msgstr "Exemplaires"
|
||||||
|
|
||||||
#: templates/printer/aff_jobs.html:37
|
#: printer/templates/printer/aff_jobs.html:41
|
||||||
#, fuzzy
|
|
||||||
#| msgid "Print As"
|
|
||||||
msgid "Print again"
|
msgid "Print again"
|
||||||
msgstr "Imprimer à nouveau"
|
msgstr "Imprimer à nouveau"
|
||||||
|
|
||||||
#: templates/printer/aff_jobs.html:44
|
#: printer/templates/printer/aff_jobs.html:48
|
||||||
msgid "for"
|
msgid "for"
|
||||||
msgstr "pour"
|
msgstr "pour"
|
||||||
|
|
||||||
#: templates/printer/index_jobs.html:28
|
#: printer/templates/printer/index_jobs.html:28
|
||||||
#, fuzzy
|
|
||||||
#| msgid "Print"
|
|
||||||
msgid "Printer"
|
msgid "Printer"
|
||||||
msgstr "Imprimer"
|
msgstr "Imprimer"
|
||||||
|
|
||||||
#: templates/printer/index_jobs.html:31 templates/printer/sidebar.html:34
|
#: printer/templates/printer/index_jobs.html:31
|
||||||
|
#: printer/templates/printer/sidebar.html:34
|
||||||
msgid "List of jobs"
|
msgid "List of jobs"
|
||||||
msgstr "Liste des taches"
|
msgstr "Liste des taches"
|
||||||
|
|
||||||
#: templates/printer/newjob.html:13
|
#: printer/templates/printer/newjob.html:13
|
||||||
msgid "Printing Menu"
|
msgid "Printing Menu"
|
||||||
msgstr "Menu d'impression"
|
msgstr "Menu d'impression"
|
||||||
|
|
||||||
#: templates/printer/newjob.html:23 templates/printer/newjob.html:43
|
#: printer/templates/printer/newjob.html:23
|
||||||
|
#: printer/templates/printer/newjob.html:43
|
||||||
msgid "Delete file"
|
msgid "Delete file"
|
||||||
msgstr "Supprimer le fichier"
|
msgstr "Supprimer le fichier"
|
||||||
|
|
||||||
#: templates/printer/newjob.html:33
|
#: printer/templates/printer/newjob.html:33
|
||||||
msgid "Add a file"
|
msgid "Add a file"
|
||||||
msgstr "Fichier supplémentaire"
|
msgstr "Fichier supplémentaire"
|
||||||
|
|
||||||
#: templates/printer/print.html:13
|
#: printer/templates/printer/print.html:13
|
||||||
msgid "Confirm printing"
|
msgid "Confirm printing"
|
||||||
msgstr "Confirmer le lancement de l'impression"
|
msgstr "Confirmer le lancement de l'impression"
|
||||||
|
|
||||||
#: templates/printer/print.html:20
|
#: printer/templates/printer/print.html:20
|
||||||
#, fuzzy
|
|
||||||
#| msgid "File Name"
|
|
||||||
msgid "Filename : "
|
msgid "Filename : "
|
||||||
msgstr "Nom du fichier"
|
msgstr "Nom du fichier"
|
||||||
|
|
||||||
#: templates/printer/print.html:21
|
#: printer/templates/printer/print.html:21
|
||||||
msgid "Price for one copy : "
|
msgid "Price for one copy : "
|
||||||
msgstr "Prix d'une copie : "
|
msgstr "Prix d'une copie : "
|
||||||
|
|
||||||
#: templates/printer/print.html:22
|
#: printer/templates/printer/print.html:22
|
||||||
msgid "Number of pages : "
|
msgid "Number of pages : "
|
||||||
msgstr "Nombre de pages : "
|
msgstr "Nombre de pages : "
|
||||||
|
|
||||||
#: templates/printer/sidebar.html:30
|
#: printer/templates/printer/sidebar.html:30
|
||||||
msgid "Print document"
|
msgid "Print document"
|
||||||
msgstr "Imprimer un document"
|
msgstr "Imprimer un document"
|
||||||
|
|
||||||
#: validators.py:48
|
#: printer/validators.py:48
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"MIME type '%(type)s' is not valid. Please, use one of these types: "
|
"MIME type '%(type)s' is not valid. Please, use one of these types: "
|
||||||
|
@ -247,7 +241,7 @@ msgstr ""
|
||||||
"Le type '%(type)s' n'est pas autorisé. Merci d'utiliser un type"
|
"Le type '%(type)s' n'est pas autorisé. Merci d'utiliser un type"
|
||||||
"%(allowed_types)s."
|
"%(allowed_types)s."
|
||||||
|
|
||||||
#: validators.py:51
|
#: printer/validators.py:51
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"The current file size is %(size)s. The maximum file size is %(max_size)s."
|
"The current file size is %(size)s. The maximum file size is %(max_size)s."
|
||||||
|
@ -255,20 +249,14 @@ msgstr ""
|
||||||
"Le fichier a une taille de %(size)s. La taille maximum autorisée est "
|
"Le fichier a une taille de %(size)s. La taille maximum autorisée est "
|
||||||
"%(max_size)s."
|
"%(max_size)s."
|
||||||
|
|
||||||
#: views.py:85
|
#: printer/views.py:84
|
||||||
msgid "Next"
|
msgid "Next"
|
||||||
msgstr "Suivant"
|
msgstr "Suivant"
|
||||||
|
|
||||||
#: views.py:117 views.py:143
|
#: printer/views.py:116 printer/views.py:142
|
||||||
msgid "Print"
|
msgid "Print"
|
||||||
msgstr "Imprimer"
|
msgstr "Imprimer"
|
||||||
|
|
||||||
#: views.py:172
|
#: printer/views.py:171
|
||||||
msgid "You are not allowed to print"
|
msgid "You are not allowed to print"
|
||||||
msgstr "Vous n'êtes pas autorisé à imprimer"
|
msgstr "Vous n'êtes pas autorisé à imprimer"
|
||||||
|
|
||||||
#~ msgid "Failure"
|
|
||||||
#~ msgstr "Echec"
|
|
||||||
|
|
||||||
#~ msgid "Success"
|
|
||||||
#~ msgstr "Succès"
|
|
||||||
|
|
|
@ -101,6 +101,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
|
{% can_view_app printer %}
|
||||||
{% if printer %}
|
{% if printer %}
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="glyphicon glyphicon-print"></i> Printer<span class="caret"></span></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="glyphicon glyphicon-print"></i> Printer<span class="caret"></span></a>
|
||||||
|
@ -109,6 +110,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% acl_end %}
|
||||||
{% can_view_app logs %}
|
{% can_view_app logs %}
|
||||||
<li><a href="{% url "logs:index" %}"><i class="fa fa-area-chart"></i> {% trans "Statistics" %}</a></li>
|
<li><a href="{% url "logs:index" %}"><i class="fa fa-area-chart"></i> {% trans "Statistics" %}</a></li>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
|
|
Loading…
Reference in a new issue