Ignore:
Timestamp:
1 Jul 2025, 12:45:55 (3 days ago)
Author:
Henrik Bettermann
Message:

Transcript officers see original transcript without watermark.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/browser/pdf.py

    r17520 r18103  
    2323import grok
    2424from waeup.kofa.browser.pdf import PDFCreator, LandscapePDFCreator
     25from waeup.kofa.utils.helpers import get_user_account
    2526
    2627class CustomPDFCreator(PDFCreator):
     
    3637    @property
    3738    def watermark_path(self):
     39        self.watermark_pos = [-25, 100]
    3840        if self.view and self.view.__name__ == 'transcript.pdf':
    39             if self.view.request.principal.id not in ('xyz',):
    40                 self.watermark_pos = [95, 190]
    41                 return os.path.join(
    42                     os.path.dirname(__file__), 'static', 'pdf_stud_only.jpg')
    43             #usertype = getattr(self.view.request.principal, 'user_type', None)
    44             #if usertype and usertype == 'student':
     41            account = get_user_account(self.view.request)
     42            if account:
     43                site_roles = get_user_account(self.view.request).roles
     44                if 'waeup.TranscriptOfficer' in site_roles:
     45                    return os.path.join(
     46                        os.path.dirname(__file__), 'static', 'pdf_watermark.jpg')
     47            self.watermark_pos = [95, 190]
     48            return os.path.join(
     49                os.path.dirname(__file__), 'static', 'pdf_stud_only.jpg')
    4550        return os.path.join(
    4651            os.path.dirname(__file__), 'static', 'pdf_watermark.jpg')
Note: See TracChangeset for help on using the changeset viewer.