Index: /main/waeup.sirp/trunk/src/waeup/sirp/students/studycourse.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/students/studycourse.py	(revision 7127)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/students/studycourse.py	(revision 7128)
@@ -67,81 +67,4 @@
 StudentStudyCourse = attrs_to_fields(StudentStudyCourse)
 
-#@grok.subscribe(IStudentStudyCourse, grok.IObjectAddedEvent)
-#def handle_studycourse_added(obj, event):
-#    """When a studycourse is added, update the local roles.
-#    """
-#    cert = getattr(obj, 'certificate', None)
-#    if cert is None:
-#        # cert never set yet, no need to update local roles.
-#        return
-#    update_local_roles(obj)
-#    return
-
-@grok.subscribe(IStudentStudyCourse, grok.IObjectModifiedEvent)
-def handle_studycourse_modified(obj, event):
-    """When a studycourse is changed, also update the local roles.
-    """
-    update_local_roles(obj)
-    return
-
-def update_local_roles(studycourse):
-    """Update local roles of given studycourse.
-    """
-    student = getattr(studycourse, '__parent__', None)
-    if student is None:
-        # not part of student, no need to update local roles
-        return
-    replace_local_clearance_officers(student)
-    return
-
-def replace_local_clearance_officers(student):
-    """Set local roles of given student.
-
-    The local roles are determined by looking up desired
-    principals. Then we remove those principals from local roles that
-    are not wanted/outdated and add those wanted.
-    """
-    prm = IPrincipalRoleManager(student)
-    curr_officers = prm.getPrincipalsForRole(
-        'waeup.local.ClearanceOfficer')
-    new_officers = get_valid_clearance_officers(student)
-    #print "STUD %s, CURR: %s, NEW: %s" % (student, curr_officers,
-    #                                      new_officers)
-    for officer in curr_officers:
-        if officer in new_officers:
-            continue
-        prm.unsetRoleForPrincipal('waeup.local.ClearanceOfficer', officer)
-    for officer in new_officers:
-        if officer in curr_officers:
-            continue
-        prm.assignRoleToPrincipal('waeup.local.ClearanceOfficer', officer)
-
-    return
-
-def get_valid_clearance_officers(student):
-    """Lookup desired clearance officers for `student`.
-
-    We look up the connected certificate, then its dept. and faculty
-    to see which local roles are required: students get the clearance
-    officers assigned to their certificate.
-
-    Not sure, though, whether we really have to set the real clearance
-    officer role for the wanted principals on the dept and faculty.
-    """
-    cert = getattr(student, 'certificate', None)
-    if cert is None:
-        return []
-    dept = getattr(getattr(cert, '__parent__', None), '__parent__', None)
-    fac = getattr(dept, '__parent__', None)
-    if dept is None or fac is None:
-        # not a serious cert
-        return []
-    # get officers (principals) responsible for the dept and faculty
-    dept_officers = IPrincipalRoleManager(dept).getPrincipalsForRole(
-        'waeup.local.ClearanceOfficer')
-    fac_officers =  IPrincipalRoleManager(fac).getPrincipalsForRole(
-        'waeup.local.ClearanceOfficer')
-    return dept_officers + fac_officers
-
 class StudentStudyCourseFactory(grok.GlobalUtility):
     """A factory for students.
