public Collection<InternalSession> filterPermissionToAccess(final SessionID actorsSessionID,final Collection<InternalSession> sessionsActedUpon) throws SessionException {
  Collection<InternalSession> toReturn=new ArrayList<>();
  try {
    if (hasTopLevelAdminRole(actorsSessionID)) {
      toReturn.addAll(sessionsActedUpon);
      return toReturn;
    }
    AMIdentity user=getUser(actorsSessionID);
    Set orgList=user.getAttribute("iplanet-am-session-get-valid-sessions");
    if (orgList == null) {
      return Collections.emptySet();
    }
    for (    InternalSession session : sessionsActedUpon) {
      if (orgList.contains(session.getClientDomain())) {
        toReturn.add(session);
      }
    }
  }
 catch (  SSOException|IdRepoException e) {
    throw new SessionException(e);
  }
  return toReturn;
}

public Collection < InternalSession > filterPermissionToAccess ( final SessionID actorsSessionID , final Collection < InternalSession > sessionsActedUpon ) throws SessionException { Collection < InternalSession > toReturn = new ArrayList < > ( ) ; try { if ( hasTopLevelAdminRole ( actorsSessionID ) ) { toReturn . addAll ( sessionsActedUpon ) ; return toReturn ; } AMIdentity user = getUser ( actorsSessionID ) ; Set orgList = user . getAttribute ( "iplanet-am-session-get-valid-sessions" ) ; if ( orgList == null ) { return Collections . emptySet ( ) ; } for ( InternalSession session : sessionsActedUpon ) { if ( orgList . contains ( session . getClientDomain ( ) ) ) { toReturn . add ( session ) ; } } } catch ( SSOException | IdRepoException e ) { throw new SessionException ( e ) ; } return toReturn ; }
filter out any sessions from the collection that the actor does not have permission to access .
