Alberto Ruiz

Impossible to delete instructor's course memberships

Discussion created by Alberto Ruiz on Jul 22, 2019

Hello,

 

We've been struggling with the entitlements in order to clean enrollments in courses used as template by copying an existing courses.

 

Finally, using a debugger and a decompiler we have found that it is impossible to delete an instructor membership, (unless you're using a system admin for your integration). This is the Blackboard code that controls the entitlement for course memberships:

    public static boolean loggedOnUserHasEntitlementToDeleteMembership(Course course, CourseMembership courseMembership) {
        boolean hasEntitlement = false;
        if (course.isOrganization()) {
            hasEntitlement = SecurityUtil.userHasAnyEntitlements(new String[]{CourseEntitlement.SYSTEM_ENROLLMENT_DELETE.getEntitlementUid(), CourseEntitlement.ORG_ENROLLMENT_DELETE.getEntitlementUid()});
        } else {
            hasEntitlement = SecurityUtil.userHasAnyEntitlements(new String[]{CourseEntitlement.SYSTEM_ENROLLMENT_DELETE.getEntitlementUid(), CourseEntitlement.COURSE_USER_DELETE.getEntitlementUid()});
        }

        if (RoleUtil.isInstructorRole(courseMembership.getRole())) {
            hasEntitlement = false;
        }

        return SystemRole.SYSTEM_ADMIN.equals(ContextManagerFactory.getInstance().getContext().getUser().getSystemRole()) || hasEntitlement;
    }

 

I really can't see the point of this restriction and, most important, why it is not documented.

 

We can change the membership role and delete it after that, but it require a pointless complication and more api calls than necessary.

Outcomes