permission_required is only allowds in views with request as first argument
This commit is contained in:
parent
41fbd456d2
commit
0727b1d72a
@ -41,15 +41,18 @@ from openslides.system.api import config_get
|
|||||||
from openslides.settings import SITE_ROOT
|
from openslides.settings import SITE_ROOT
|
||||||
from openslides.utils.utils import permission_required
|
from openslides.utils.utils import permission_required
|
||||||
|
|
||||||
|
|
||||||
# register new truetype fonts
|
# register new truetype fonts
|
||||||
pdfmetrics.registerFont(TTFont('Ubuntu', os.path.join(SITE_ROOT, 'static/fonts/Ubuntu-R.ttf')))
|
pdfmetrics.registerFont(TTFont('Ubuntu', os.path.join(SITE_ROOT, 'static/fonts/Ubuntu-R.ttf')))
|
||||||
pdfmetrics.registerFont(TTFont('Ubuntu-Bold', os.path.join(SITE_ROOT, 'static/fonts/Ubuntu-B.ttf')))
|
pdfmetrics.registerFont(TTFont('Ubuntu-Bold', os.path.join(SITE_ROOT, 'static/fonts/Ubuntu-B.ttf')))
|
||||||
pdfmetrics.registerFont(TTFont('Ubuntu-Italic', os.path.join(SITE_ROOT, 'static/fonts/Ubuntu-RI.ttf')))
|
pdfmetrics.registerFont(TTFont('Ubuntu-Italic', os.path.join(SITE_ROOT, 'static/fonts/Ubuntu-RI.ttf')))
|
||||||
|
|
||||||
|
|
||||||
# set style information
|
# set style information
|
||||||
PAGE_HEIGHT=defaultPageSize[1];
|
PAGE_HEIGHT=defaultPageSize[1];
|
||||||
PAGE_WIDTH=defaultPageSize[0]
|
PAGE_WIDTH=defaultPageSize[0]
|
||||||
|
|
||||||
|
|
||||||
# set custom stylesheets
|
# set custom stylesheets
|
||||||
stylesheet = StyleSheet1()
|
stylesheet = StyleSheet1()
|
||||||
stylesheet.add(ParagraphStyle(name = 'Normal',
|
stylesheet.add(ParagraphStyle(name = 'Normal',
|
||||||
@ -193,6 +196,7 @@ def firstPage(canvas, doc):
|
|||||||
canvas.drawString(10*cm, 1*cm, _("Page")+" 1")
|
canvas.drawString(10*cm, 1*cm, _("Page")+" 1")
|
||||||
canvas.restoreState()
|
canvas.restoreState()
|
||||||
|
|
||||||
|
|
||||||
def laterPages(canvas, doc):
|
def laterPages(canvas, doc):
|
||||||
canvas.saveState()
|
canvas.saveState()
|
||||||
# footer (with page number)
|
# footer (with page number)
|
||||||
@ -201,6 +205,7 @@ def laterPages(canvas, doc):
|
|||||||
canvas.drawString(10*cm, 1*cm, _("Page")+" %s" % doc.page)
|
canvas.drawString(10*cm, 1*cm, _("Page")+" %s" % doc.page)
|
||||||
canvas.restoreState()
|
canvas.restoreState()
|
||||||
|
|
||||||
|
|
||||||
@permission_required('agenda.can_see_agenda')
|
@permission_required('agenda.can_see_agenda')
|
||||||
def print_agenda(request):
|
def print_agenda(request):
|
||||||
response = HttpResponse(mimetype='application/pdf')
|
response = HttpResponse(mimetype='application/pdf')
|
||||||
@ -226,6 +231,7 @@ def print_agenda(request):
|
|||||||
doc.build(story, onFirstPage=firstPage, onLaterPages=laterPages)
|
doc.build(story, onFirstPage=firstPage, onLaterPages=laterPages)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@permission_required('participant.can_manage_participant')
|
@permission_required('participant.can_manage_participant')
|
||||||
def print_userlist(request):
|
def print_userlist(request):
|
||||||
response = HttpResponse(mimetype='application/pdf')
|
response = HttpResponse(mimetype='application/pdf')
|
||||||
@ -267,6 +273,7 @@ def print_userlist(request):
|
|||||||
doc.build(story, onFirstPage=firstPage, onLaterPages=laterPages)
|
doc.build(story, onFirstPage=firstPage, onLaterPages=laterPages)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@permission_required('participant.can_manage_participant')
|
@permission_required('participant.can_manage_participant')
|
||||||
def print_passwords(request):
|
def print_passwords(request):
|
||||||
response = HttpResponse(mimetype='application/pdf')
|
response = HttpResponse(mimetype='application/pdf')
|
||||||
@ -310,7 +317,7 @@ def print_passwords(request):
|
|||||||
doc.build(story)
|
doc.build(story)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@permission_required('application.can_see_application')
|
|
||||||
def get_application(application, story):
|
def get_application(application, story):
|
||||||
if application.number is None:
|
if application.number is None:
|
||||||
story.append(Paragraph(_("Application")+" #[-]", stylesheet['Heading1']))
|
story.append(Paragraph(_("Application")+" #[-]", stylesheet['Heading1']))
|
||||||
@ -335,6 +342,7 @@ def get_application(application, story):
|
|||||||
story.append(Paragraph(_("Status")+": %s" % (application.get_status_display()), stylesheet['Italic']))
|
story.append(Paragraph(_("Status")+": %s" % (application.get_status_display()), stylesheet['Italic']))
|
||||||
return story
|
return story
|
||||||
|
|
||||||
|
|
||||||
@permission_required('application.can_see_application')
|
@permission_required('application.can_see_application')
|
||||||
def print_application(request, application_id=None):
|
def print_application(request, application_id=None):
|
||||||
response = HttpResponse(mimetype='application/pdf')
|
response = HttpResponse(mimetype='application/pdf')
|
||||||
@ -363,6 +371,7 @@ def print_application(request, application_id=None):
|
|||||||
doc.build(story, onFirstPage=firstPage, onLaterPages=laterPages)
|
doc.build(story, onFirstPage=firstPage, onLaterPages=laterPages)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@permission_required('application.can_manage_application')
|
@permission_required('application.can_manage_application')
|
||||||
def print_application_poll(request, poll_id=None):
|
def print_application_poll(request, poll_id=None):
|
||||||
poll = Poll.objects.get(id=poll_id)
|
poll = Poll.objects.get(id=poll_id)
|
||||||
@ -396,6 +405,7 @@ def print_application_poll(request, poll_id=None):
|
|||||||
doc.build(story)
|
doc.build(story)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
@permission_required('application.can_manage_application')
|
@permission_required('application.can_manage_application')
|
||||||
def print_assignment_poll(request, poll_id=None):
|
def print_assignment_poll(request, poll_id=None):
|
||||||
poll = Poll.objects.get(id=poll_id)
|
poll = Poll.objects.get(id=poll_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user