Hello, is there a way to log of all sessions from a specific user using the Java Business Intelligence platform API?
I have attached a snippet of code which is based on the Force Log Off script found here: https://blogs.sap.com/2013/05/13/scripts-for-user-management/.
However, the InfoStore query doesn't return any InfoObjects when using WHERE SI_KIND = 'Connection' (boInfoObjects.size() has a size of 0). Do I need to change the query string to something else, or is there another way I can log off all sessions that a user has?
Also, using the query string, "SELECT * FROM CI_SYSTEMOBJECTS WHERE SI_KIND = 'Connection'", doesn't return any InfoObjects, even though there are sessions active.
Thanks, Brendon
public static void logoffAllSessions (IEnterpriseSession enterpriseSession) throws SDKException { String username = enterpriseSession.getUserInfo().getUserName(); IInfoStore infoStore = (IInfoStore) enterpriseSession.getService("InfoStore"); String queryString = "SELECT SI_ID, SI_CREATION_TIME, SI_NAME FROM CI_SYSTEMOBJECTS WHERE SI_KIND = 'Connection' AND SI_NAME = '" + username + "' AND SI_FAILOVER_AVAILABLE_UNTIL = NULL AND SI_AUTHEN_METHOD != 'server-token' ORDER BY SI_CREATION_TIME ASC"; IInfoObjects boInfoObjects = (IInfoObjects) infoStore.query(queryString); System.out.println(boInfoObjects.size()); for(Iterator boCount = boInfoObjects.iterator(); boCount.hasNext();) { IInfoObject boObject = (IInfoObject)boCount.next(); System.out.println("Removing Session for User " + boObject.getTitle()); boInfoObjects.delete(boObject); } infoStore.commit(boInfoObjects); System.out.println("done"); }