# Reset users Start Centers # Object: MAXGROUP # Resets the Start Centers for all users assigned to the selected Security Group # Should be called when all users are logged off so the start center is reloaded after the login # See: http://maximodev.blogspot.com/2012/11/how-to-reset-users-start-centers.html from psdi.server import MXServer from psdi.mbo import MboConstants from psdi.util.logging import MXLoggerFactory def deleteSc(objectName, where): scSet = MXServer.getMXServer().getMboSet(objectName, mbo.getUserInfo()) scSet.setWhere(where) logger.debug("Deleting rows from " + objectName) # disable logging of large fetch result set to avoid FetchResultLogLimit errors scSet.setLogLargFetchResultDisabled(True) scSet.deleteAll() scSet.save() logger = MXLoggerFactory.getLogger("maximo.maximodev") logger.debug("Entering ASSET_INIT script") logger.info("Entering ASTS_RESET_STARTCENTER") grpname = mbo.getString("GROUPNAME") where1 = "scconfigid IN (SELECT scconfigid FROM scconfig WHERE groupname='" + grpname + "')" where2 = "layoutid IN (SELECT layoutid FROM layout WHERE " +where1+ ")" deleteSc("RSCONFIG", where2) deleteSc("FACONFIG", where2) deleteSc("INBXCONFIG", where2) deleteSc("KPILCONFIG", where2) deleteSc("KPIGCONFIG", where2) deleteSc("ACTIONSCFG", where2) deleteSc("PORTLETDISPLAY", where2) deleteSc("LAYOUT", where2) deleteSc("SCCONFIG", where1)
Labels: advanced, scripting, security groups