@echo off REM This sample program is provided AS IS and may be used, executed, copied and modified without royalty REM payment by customer (a) for its own instruction and study, (b) in order to develop applications REM designed to run with an IBM WebSphere product, either for customer's own internal use or for REM redistribution by customer, as part of such an application, in customer's own products. REM REM Product 5655-FLW, (C) COPYRIGHT International Business Machines Corp., 2006, 2009 REM All Rights Reserved * Licensed Materials - Property of IBM REM Make all env var settings temporary setlocal REM Customizable settings that reflect your installation REM * * * * * * * * * * * * * * * * * REM Adjust the following line to reflect WID installation directory (no quotes around the directory needed) set WID_INSTALL=C:\Program Files\IBM\WID62 REM If you do not use the integrated test environment, set the %PROFILE_HOME% directory directly here: set PROFILE_HOME=%WID_INSTALL%\pf\wps REM Adjust the following line to reflect the SOAP port (default is 8880, but may be 8881, 8882, ...) set SOAP_PORT=8880 REM Adjust the following line to reflect your admin userid, default is admin set ADMIN_UID=admin REM Adjust the following line to reflect your admin password, default is admin (hopefully changed) set ADMIN_PWD=admin REM * * * * * * * * * * * * * * * * * REM End of customizable settings REM set shortcut for the wsadmin command set wsacmd="%PROFILE_HOME%\bin\wsadmin" -conntype SOAP -port %SOAP_PORT% -user %ADMIN_UID% -password %ADMIN_PWD% REM Do some plausibility checks before continuing if NOT exist "%PROFILE_HOME%\bin\launchClient.bat" goto PROFILE_HOME_ERROR REM Make sure local version of this variable is not set set pwd= echo * * * * * * * set /p pwd="Enter password (same for all users created now): " if "" == "%pwd%" goto EMPTY_PWD REM Password not empty, erasing screen: set pwd_data=-password %pwd% -confirmPassword %pwd% cls REM Add 7 users echo Adding 7 users... set cmdu1="$AdminTask createUser {-uid sellerA %pwd_data% -cn seller -sn A -mail sel_a@mycomp}" set cmdu2="$AdminTask createUser {-uid sellerB %pwd_data% -cn seller -sn B -mail sel_b@mycomp}" set cmdu3="$AdminTask createUser {-uid approverA %pwd_data% -cn approver -sn A -mail app_a@mycomp}" set cmdu4="$AdminTask createUser {-uid approverB %pwd_data% -cn approver -sn B -mail app_b@mycomp}" set cmdu5="$AdminTask createUser {-uid approverC %pwd_data% -cn approver -sn C -mail app_c@mycomp}" set cmdu6="$AdminTask createUser {-uid supervisorA %pwd_data% -cn supervisor -sn A -mail sup_a@mycomp}" set cmdu7="$AdminTask createUser {-uid supervisorB %pwd_data% -cn supervisor -sn B -mail sup_b@mycomp}" call %wsacmd% -c %cmdu1% -c %cmdu2% -c %cmdu3% -c %cmdu4% -c %cmdu5% -c %cmdu6% -c %cmdu7% || goto WSADMIN_ERROR1 REM Add 3 groups echo Adding 3 groups and attaching users to groups... set cmdg1="$AdminTask createGroup {-cn sellers}" set cmdg2="$AdminTask createGroup {-cn approvers}" set cmdg3="$AdminTask createGroup {-cn supervisors}" set cmdg4="$AdminTask addMemberToGroup {-memberUniqueName uid=sellerA,o=defaultWIMFileBasedRealm -groupUniqueName cn=sellers,o=defaultWIMFileBasedRealm}" set cmdg5="$AdminTask addMemberToGroup {-memberUniqueName uid=sellerB,o=defaultWIMFileBasedRealm -groupUniqueName cn=sellers,o=defaultWIMFileBasedRealm}" set cmdg6="$AdminTask addMemberToGroup {-memberUniqueName uid=approverA,o=defaultWIMFileBasedRealm -groupUniqueName cn=approvers,o=defaultWIMFileBasedRealm}" set cmdg7="$AdminTask addMemberToGroup {-memberUniqueName uid=approverB,o=defaultWIMFileBasedRealm -groupUniqueName cn=approvers,o=defaultWIMFileBasedRealm}" set cmdg8="$AdminTask addMemberToGroup {-memberUniqueName uid=approverC,o=defaultWIMFileBasedRealm -groupUniqueName cn=approvers,o=defaultWIMFileBasedRealm}" set cmdg9="$AdminTask addMemberToGroup {-memberUniqueName uid=supervisorA,o=defaultWIMFileBasedRealm -groupUniqueName cn=supervisors,o=defaultWIMFileBasedRealm}" set cmdg10="$AdminTask addMemberToGroup {-memberUniqueName uid=supervisorB,o=defaultWIMFileBasedRealm -groupUniqueName cn=supervisors,o=defaultWIMFileBasedRealm}" call %wsacmd% -c %cmdg1% -c %cmdg2% -c %cmdg3% -c %cmdg4% -c %cmdg5% -c %cmdg6% -c %cmdg7% -c %cmdg8% -c %cmdg9% -c %cmdg10% REM The new users and groups will be known after the next run of the refreshStaffQuery daemon. REM For making the users and groups known immediately, we call this operation explicitly. REM The WAS_HOME directory is needed now; user can set it, otherwise we try to infer it. if NOT "%WAS_HOME%" == "" goto WAS_HOME_IS_SET REM Env var WAS_HOME not set explicitly. Try to infer from PROFILE_HOME setting: set WAS_HOME=%PROFILE_HOME%\..\..\runtimes\bi_v62 REM Now test whether this assumption is true if NOT exist "%WAS_HOME%\ProcessChoreographer\admin\refreshStaffQuery.py" goto WAS_HOME_NOT_SET :WAS_HOME_IS_SET echo "Attempting to refresh People Queries ..." call %wsacmd% -lang jython -f "%WAS_HOME%\ProcessChoreographer\admin\refreshStaffQuery.py" -server server1 goto END :PROFILE_HOME_ERROR echo %~nx0: PROFILE_HOME is set to "%PROFILE_HOME%" echo which seems not to be valid for your machine. echo Please edit the file %~dpnx0 and adjust echo either the WID_INSTALL setting or the PROFILE_HOME setting. echo (returned with no effect). goto END :EMPTY_PWD echo %~nx0: Password may not be empty - returned with no effect. goto END :WSADMIN_ERROR1 echo %~nx0: Error while adding user - abended. goto END :WAS_HOME_NOT_SET echo %~nx0: could not refresh the cache for users and groups. echo Please go to the administrative console, navigate to echo Application servers - server1 - Business Process Choreographer - Human Task Manager - Runtime Configuration echo and click "Refresh People Queries" :END PAUSE endlocal