private Map<String, Long> performRun(Check c) { // Perform the operation across all groups. Map<String, Long> counts = null; Map<String, String> grpCtx = new HashMap<String, String>(); grpCtx.put("omero.group", "-1"); try { ctx.publishMessage(new ContextMessage.Push(this, grpCtx)); try { counts = c.run(osf.getSession(), em); } finally { ctx.publishMessage(new ContextMessage.Pop(this, grpCtx)); } } catch (Throwable t) { log.error("Could not perform check!", t); throw new InternalException("Could not perform check! See server logs"); } return counts; }
@SuppressWarnings({ "unchecked", "rawtypes" }) public Object[] getChecks(IObject obj, String permissions) { ExperimenterGroup trusted = load(obj); if (!voter.allowChmod(trusted)) { throw new SecurityViolation("chmod not permitted"); } PermDrop drop = new PermDrop(trusted, permissions); if (!drop.found()) { return new Object[0]; // none needed. } List<Object> checks = new ArrayList<Object>(); Collection<String> classeNames = em.getClasses(); for (String className : classeNames) { Class k = em.getHibernateClass(className); if (voter.sysTypes.isSystemType(k)) { continue; // Skip experimenters, etc. } String[][] lockChecks = em.getLockChecks(k); checks.add(new Check(trusted.getId(), permissions, k, lockChecks, drop)); } return checks.toArray(new Object[checks.size()]); }