public Map<String, String> getContext() { return list().getLast().getCallContext(); }
public void applyContext(Details details, boolean changePerms) { final BasicEventContext c = current(); details.setContexts(new Object[]{c, c.getCallContext()}); if (changePerms) { // Make the permissions match (#8277) final Permissions groupPerms = c.getCurrentGroupPermissions(); if (groupPerms != Permissions.DUMMY) { details.setPermissions(new Permissions(groupPerms)); } else { // In the case of the dummy, we will be required to have // the group id already set in the context. ExperimenterGroup group = details.getGroup(); if (group != null) { // Systypes still will have DUMMY values. Long gid = details.getGroup().getId(); Permissions p = c.getPermissionsForGroup(gid); if (p != null) { // Ticket:9505. This must be a new copy of the permissions // in order to prevent the restrictions being modified by // later objects! details.setPermissions(new Permissions(p)); } else if (gid.equals(Long.valueOf(roles.getUserGroupId()))) { details.setPermissions(new Permissions(Permissions.EMPTY)); } else { throw new InternalException("No permissions: " + details); } } } } }
/** * Creates a {@link Details} object for the current security context. * * The {@link Permissions} on the instance are calculated from the current * group as well as the user's umask. * * @return details for the current security context * @see <a href="https://trac.openmicroscopy.org/ome/ticket/1434">ticket:1434</a> */ public Details createDetails() { final BasicEventContext c = current(); final Details d = Details.create(new Object[]{c, c.getCallContext()}); d.setCreationEvent(c.getEvent()); d.setUpdateEvent(c.getEvent()); d.setOwner(c.getOwner()); d.setGroup(c.getGroup()); // ticket:1434 final Permissions groupPerms = c.getCurrentGroupPermissions(); final Permissions p = new Permissions(groupPerms); d.setPermissions(p); return d; }