Ignore:
Timestamp:
11 Feb 2014, 07:49:25 (11 years ago)
Author:
Henrik Bettermann
Message:

Do not show public user name in history when activating or deactivating students.

Location:
main/waeup.uniben/trunk/src/waeup/uniben
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/locales/en/LC_MESSAGES/waeup.kofa.po

    r10391 r11069  
    11msgid ""
    22msgstr ""
    3 "<strong>WARNING: </strong> Do not use these exporters between 8 am and 8 pm. Uniben student data exports take longer than 30 minutes. During exports applicants or students won't be able to register.\n"
    43"Project-Id-Version: \n"
    54"POT-Creation-Date: \n"
  • main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py

    r10481 r11069  
    2121from zope.component import getUtility
    2222from hurry.workflow.interfaces import IWorkflowInfo
    23 from waeup.kofa.interfaces import REQUESTED, IExtFileStore, IKofaUtils
     23from waeup.kofa.interfaces import (
     24    REQUESTED, IExtFileStore, IKofaUtils, IObjectHistory)
    2425from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
    25 from waeup.kofa.browser.layout import KofaEditFormPage
    26 from waeup.kofa.browser.layout import action, jsaction
     26from waeup.kofa.browser.layout import action, jsaction, KofaEditFormPage
    2727from waeup.kofa.students.browser import (
    2828    StudyLevelEditFormPage, StudyLevelDisplayFormPage,
    2929    StudentBasePDFFormPage, ExportPDFCourseRegistrationSlipPage,
    3030    CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage,
    31     msave, emit_lock_message)
     31    msave, emit_lock_message,
     32    StudentActivatePage, StudentDeactivatePage)
    3233from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket
    3334from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS
     
    278279    """
    279280    form_fields = grok.AutoFields(ICourseTicket).omit('score')
     281
     282class CustomStudentActivatePage(StudentActivatePage):
     283    """ Activate student account
     284    """
     285
     286    def update(self):
     287        self.context.suspended = False
     288        self.context.writeLogMessage(self, 'account activated')
     289        history = IObjectHistory(self.context)
     290        history.addMessage('Student account activated', user='undisclosed')
     291        self.flash(_('Student account has been activated.'))
     292        self.redirect(self.url(self.context))
     293        return
     294
     295class CustomStudentDeactivatePage(StudentDeactivatePage):
     296    """ Deactivate student account
     297    """
     298    def update(self):
     299        self.context.suspended = True
     300        self.context.writeLogMessage(self, 'account deactivated')
     301        history = IObjectHistory(self.context)
     302        history.addMessage('Student account deactivated', user='undisclosed')
     303        self.flash(_('Student account has been deactivated.'))
     304        self.redirect(self.url(self.context))
     305        return
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r10902 r11069  
    711711            self.browser.contents)
    712712        self.student.suspended = False
     713
     714    def test_activate_deactivate_buttons(self):
     715        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     716        self.browser.open(self.student_path)
     717        self.browser.getLink("Deactivate").click()
     718        self.assertTrue(
     719            'Student account has been deactivated.' in self.browser.contents)
     720        self.assertTrue(
     721            'Base Data (account deactivated)' in self.browser.contents)
     722        self.assertTrue(self.student.suspended)
     723        self.browser.getLink("Activate").click()
     724        self.assertTrue(
     725            'Student account has been activated.' in self.browser.contents)
     726        self.assertFalse(
     727            'Base Data (account deactivated)' in self.browser.contents)
     728        self.assertFalse(self.student.suspended)
     729        # History messages have been added ...
     730        self.browser.getLink("History").click()
     731        # User is undisclosed
     732        self.assertTrue(
     733            'Student account deactivated<br />' in self.browser.contents)
     734        self.assertTrue(
     735            'Student account activated<br />' in self.browser.contents)
     736        # ... and actions have been logged.
     737        logfile = os.path.join(
     738            self.app['datacenter'].storage, 'logs', 'students.log')
     739        logcontent = open(logfile).read()
     740        self.assertTrue('zope.mgr - waeup.uniben.students.browser.CustomStudentDeactivatePage - '
     741                        'B1000000 - account deactivated' in logcontent)
     742        self.assertTrue('zope.mgr - waeup.uniben.students.browser.CustomStudentActivatePage - '
     743                        'B1000000 - account activated' in logcontent)
Note: See TracChangeset for help on using the changeset viewer.