@Override public RaptureEntitlement getEntitlement(String entitlementName) { RaptureEntitlement ret = api.getEntitlement(callingCtx, entitlementName); return ret; }
Boolean canAddGroupToEntitlement(CallingContext context, String entitlementName, String groupName) { // When creating an entitlement, null can be passed for the initial group, and if so, this // does not create lockout even if there are no other groups assigned. if (giveFreePass(context) || !isEntitlementSensitive(entitlementName) || groupName == null) { return true; } // If this user is in the group, it's cool. No lockout. RaptureEntitlementGroup group = api.getEntitlementGroup(ContextFactory.getKernelUser(), groupName); if (group != null && group.getUsers().contains(context.getUser())) { return true; } // If this sensitive entitlement doesn't exist officially yet, then adding a group // that this user is not in will create lockout. RaptureEntitlement entitlement = api.getEntitlement(ContextFactory.getKernelUser(), entitlementName); if (entitlement == null) { logLockoutProhibited(entitlementName, context.getUser()); return false; } return userHasAlternateAccess(context.getUser(), groupName, entitlement); }
Boolean canRemoveGroupFromEntitlement(CallingContext context, String entitlementName, String groupName) { if (giveFreePass(context) || !isEntitlementSensitive(entitlementName)) { return true; } RaptureEntitlement entitlement = api.getEntitlement(ContextFactory.getKernelUser(), entitlementName); return isOnlyGroupForEntitlement(groupName, entitlement) || userHasAlternateAccess(context.getUser(), groupName, entitlement); }