Ignore:
Timestamp:
24 Aug 2015, 15:21:21 (9 years ago)
Author:
Henrik Bettermann
Message:

Remove global roles after deletion of applicants and students.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py

    r13216 r13224  
    391391@grok.subscribe(IApplicant, grok.IObjectRemovedEvent)
    392392def handle_applicant_removed(applicant, event):
    393     """If an applicant is removed a message is logged.
     393    """If an applicant is removed a message is logged, passport images are
     394    deleted and the global role is unset.
    394395    """
    395396    comment = 'Application record removed'
     
    402403        # an applicants subcontainer
    403404        return
    404     # Remove also any passport image.
     405    # Remove any passport image.
    405406    file_store = getUtility(IExtFileStore)
    406407    file_store.deleteFileByContext(applicant)
     408    # Remove global role
     409    role_manager = IPrincipalRoleManager(grok.getSite())
     410    role_manager.unsetRoleForPrincipal(
     411        'waeup.Applicant', applicant.applicant_id)
    407412    return
  • main/waeup.kofa/trunk/src/waeup/kofa/students/student.py

    r13103 r13224  
    486486    # update CSV files
    487487    update_student_deletion_csvs(student, del_dir)
     488
     489    # remove global role
     490    role_manager = IPrincipalRoleManager(grok.getSite())
     491    role_manager.unsetRoleForPrincipal('waeup.Student', student.student_id)
    488492    return
    489493
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r13132 r13224  
    560560            student.matric_number = matric_number
    561561        except MatNumNotInSource:
    562             return _('Matriculation number exists.'), None
     562            return _('Matriculation number %s exists.' % matric_number), None
    563563        notify(grok.ObjectModifiedEvent(student))
    564564        self.increaseMatricInteger(student)
Note: See TracChangeset for help on using the changeset viewer.