Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ page language="java"%>
- <%@ page contentType="text/html; charset=utf-8" %>
- <%@ page import="com.businessobjects.rebean.wi.ReportEngine" %>
- <%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>
- <%@ page import="com.crystaldecisions.sdk.exception.SDKServerException" %>
- <%@ page import="com.crystaldecisions.sdk.framework.CrystalEnterprise" %>
- <%@ page import="com.crystaldecisions.sdk.framework.IEnterpriseSession" %>
- <%@ page import="com.crystaldecisions.sdk.framework.ISessionMgr" %>
- <%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoStore" %>
- <%@ page import="com.crystaldecisions.sdk.occa.security.IUserInfo" %>
- <%@ page import="com.crystaldecisions.sdk.occa.infostore.CeSecurityID" %>
- <%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObjects" %>
- <%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObject" %>
- <%@ page import="com.crystaldecisions.sdk.plugin.desktop.server.IServer"%>
- <%@ page import="com.crystaldecisions.sdk.plugin.CeKind" %>
- <%@ page import="com.crystaldecisions.sdk.occa.enadmin.*" %>
- <%@ page import="com.businessobjects.sdk.plugin.desktop.webintelligence.CeWebIntelligenceRightID" %>
- <%@ page import="java.io.IOException" %>
- <%@ page import="java.util.Hashtable" %>
- <%@ page import = "com.crystaldecisions.sdk.exception.SDKException,
- com.crystaldecisions.sdk.framework.*,
- com.crystaldecisions.sdk.occa.infostore.*,
- com.crystaldecisions.sdk.occa.report.*,
- com.crystaldecisions.sdk.properties.*,
- com.crystaldecisions.sdk.plugin.desktop.user.*,
- com.crystaldecisions.sdk.plugin.desktop.usergroup.*,
- java.util.*"
- %>
- <%
- // User Credentials
- //administrator user
- String username = "Administrator";
- //administrator password
- String password = "Admin2008";
- //CMS name where you want to make the change
- String cmsname = "CMS:6400";
- //type of authentification
- String authType = "secEnterprise";
- IEnterpriseSession enterpriseSession = null;
- IInfoStore infoStore;
- IInfoObjects boInfoObjects;
- // Log on to Enterprise
- enterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cmsname, authType);
- infoStore = (IInfoStore)enterpriseSession.getService("", "InfoStore");
- //this is the query which finds all the users with Copy in the name; it's good to check the script in querybuilder: http://IP:8080/AdminTools/querybuilder/ie.jsp
- boInfoObjects = (IInfoObjects)infoStore.query("Select * FROM CI_SYSTEMOBJECTS WHERE SI_Kind='User' AND SI_NAME!= 'Administrator' AND SI_NAME !='Guest' AND SI_NAME like '%- Copy%' ORDER BY SI_ID ASC");
- //Loop thru all the users and change their name
- for(Iterator boCount = boInfoObjects.iterator() ; boCount.hasNext() ; ) {
- IInfoObject boObject = (IInfoObject)boCount.next();
- // Here is where you would do all the needed work / modifications
- out.println("Current name = " + boObject.getTitle());
- String oldtitle = boObject.getTitle();
- //find the position of - in the name (account name is in the format username - Copy())
- int toPos = oldtitle.indexOf("-");
- //set the new title
- String newtitle = oldtitle.substring(0, toPos);
- boObject.setTitle(newtitle);
- }
- //save the changes
- infoStore.commit(boInfoObjects);
- out.println("Completed</br>");
- %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement