void throwIfGroupsDontMatch( ExperimenterGroup changedObjectGroup, IObject changedObject, ExperimenterGroup linkedGroup, IObject linkedObject) { if (linkedGroup != null && !HibernateUtils.idEqual(linkedGroup, changedObjectGroup)) { throw new GroupSecurityViolation(String.format( "MIXED GROUP: " + "%s(group=%s) and %s(group=%s) cannot be linked.", changedObject, changedObjectGroup, linkedObject, linkedGroup)); } }
/** * @param new_d the new details * @param old_d the old details * @return if the non-permissions fields are the same */ public static boolean onlyPermissionsChanged(Details new_d, Details old_d) { if (idEqual(new_d.getOwner(), old_d.getOwner()) && idEqual(new_d.getGroup(), old_d.getGroup()) && idEqual(new_d.getCreationEvent(), old_d.getCreationEvent()) && idEqual(new_d.getUpdateEvent(), old_d.getUpdateEvent()) && idEqual(new_d.getExternalInfo(), old_d.getExternalInfo())) { return true; } return false; }
if (!HibernateUtils.idEqual(previous, current)) { throw new SecurityViolation(String.format( "Cannot update ExternalInfo for %s from %s to %s", obj,
public void addGroups(final Experimenter user, final ExperimenterGroup... groups) { final Session session = sf.getSession(); final List<String> added = new ArrayList<String>(); Experimenter foundUser = userById(user.getId(), session); for (ExperimenterGroup group : groups) { ExperimenterGroup foundGroup = groupById(group.getId(), session); boolean found = false; for (ExperimenterGroup currentGroup : foundUser .linkedExperimenterGroupList()) { found |= HibernateUtils.idEqual(foundGroup, currentGroup); } if (!found) { linkGroupAndUser(foundGroup, foundUser, false); added.add(foundGroup.getName()); } } fixDefaultGroup(foundUser, session); }
if (!HibernateUtils.idEqual(previousDetails.getOwner(), currentDetails .getOwner())) {
if (!HibernateUtils.idEqual(previousDetails.getGroup(), currentDetails .getGroup())) {