/** * @return the current event context */ public EventContext getCurrentEventContext() { return current(); }
/** * It suffices to set the {@link Details} to a new instance to make this * context unusable. {@link #isReady()} will return false. */ public void invalidateCurrentEventContext() { BasicEventContext c = current(); c.invalidate(); if (log.isDebugEnabled()) { log.debug("Invalidated login: " + c); } }
/** * Replaces all the simple-valued fields in the {@link BasicEventContext}. * This method */ void checkAndInitialize(EventContext ec, LocalAdmin admin, ShareStore store) { current().checkAndInitialize(ec, admin, store); }
public boolean removeDisabled(String id) { Set<String> s = current().getDisabledSubsystems(); if (s != null && id != null) { return s.remove(id); } return false; }
public List<EventLog> getLogs() { // TODO defensive copy List<EventLog> logs = current().getLogs(); return logs == null ? new ArrayList<EventLog>() : logs; }
/** * Allows for updating the {@link Event} if the session is not readOnly. */ void updateEvent(Event event) { current().setEvent(event); }
public boolean removeAllDisabled(String... ids) { Set<String> s = current().getDisabledSubsystems(); if (s != null && ids != null) { boolean changed = false; for (String string : ids) { changed |= s.remove(string); } } return false; }
/** * Add a {@link RegisterServiceCleanupMessage} to the current thread for * cleanup by the {@link ServiceHandler} on exit. */ public void addCleanup(RegisterServiceCleanupMessage cleanup) { Set<RegisterServiceCleanupMessage> cleanups = current() .getServiceCleanups(); if (cleanups == null) { cleanups = new HashSet<RegisterServiceCleanupMessage>(); current().setServiceCleanups(cleanups); } cleanups.add(cleanup); }
public boolean allowAnnotate(IObject iObject, Details trustedDetails) { BasicEventContext c = currentUser.current(); return 1 == allowUpdateOrDelete(c, iObject, trustedDetails, Scope.ANNOTATE); }
public boolean allowDelete(IObject iObject, Details trustedDetails) { BasicEventContext c = currentUser.current(); return 1 == allowUpdateOrDelete(c, iObject, trustedDetails, Scope.DELETE); }
/** * Checks the "groupPermissions" map in {@link BasicEventContext} which has * been filled up by calls to {@link BasicEventContext#setPermissionsForGroup(Long, Permissions)} * during {@link BasicACLVoter#allowLoad(org.hibernate.Session, Class, Details, long)}. * @param session the Hibernate session */ public void loadPermissions(org.hibernate.Session session) { current().loadPermissions(session); }
public ExperimenterGroup getGroup() { return current().getGroup(); }
public void clearDisabled() { current().setDisabledSubsystems(null); }
public Experimenter getOwner() { return current().getOwner(); }
public Set<AdminPrivilege> getAdminPrivileges() { return current().getAdminPrivileges(); }
/** * @return if the current user is the system's <q>guest</q> user */ public boolean isCurrentUserGuest() { return current().getCurrentUserId() == roles.getGuestId(); }
/** * Checks if the current {@link Thread} has non-null {@link Experimenter}, * {@link Event}, and {@link ExperimenterGroup}, required for proper * functioning of the security system. */ public boolean isReady() { BasicEventContext c = current(); if (c.getEvent() != null && c.getGroup() != null && c.getOwner() != null) { return true; } return false; }
public void postFlush(Iterator entities) throws CallbackException { debug("Intercepted postFlush."); if (TransactionSynchronizationManager.isCurrentTransactionReadOnly()) { debug("detected read-only transaction"); } else if (sqlAction != null) { /* read-write transactions may trigger checks */ debug("updating current light administrator privileges"); final Set<AdminPrivilege> privileges = currentUser.current().getCurrentAdminPrivileges(); sqlAction.deleteCurrentAdminPrivileges(); if (CollectionUtils.isNotEmpty(privileges)) { sqlAction.insertCurrentAdminPrivileges(privileges); } } }