public class UserMagic
extends Object
implements RemoteAccess
| Modifier and Type | Field and Description |
|---|---|
static String |
HTTPGWHOSTNAME |
static int |
MAJOR |
static int |
MINOR |
static String |
RMIHOSTNAME |
static boolean |
SERVER |
static boolean |
VERBOSE |
static String |
WEBAPPNAME |
static String |
WTHOME |
| Constructor and Description |
|---|
UserMagic() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
askUserYesNo(String questionTxt) |
static void |
changeDN(String curDN,
String newDN,
boolean updateGroups) |
static boolean |
checkRemoteObjectID(WTUser wtu,
String userDN,
boolean update) |
static void |
cmdAddWTPrincipalsToContainerRoles(Map params) |
static void |
cmdAddWTPrincipalToContainerRole(Map params) |
static void |
cmdCreateUserCSV(String csvFilename) |
static void |
cmdDeleteUser(boolean force,
String uid)
delete or disable a user within windchill/ldap
|
static void |
cmdDeleteUserCSV(boolean force,
String csvFilename) |
static void |
cmdExportUserCSV(Map exportParams) |
static void |
cmdRemoveAllFromContainerRoles(Map params) |
static void |
cmdRemoveWTPrincipalFromContainerRole(Map params) |
static void |
cmdRemoveWTPrincipalsFromContainerRoles(Map params) |
static void |
cmdReportContainerRoleMembers(Map params) |
static void |
cmdUpdateUserGroups(String csvFilename,
String mode) |
static HashMap<String,Object> |
convertLDAPEntryTopLDAPUserData(LDAPEntry user)
add the data from a ldapentry object (should be a user...) to a hashmap.
|
static WTGroup |
createGroup(String grpName,
String orgDN) |
static void |
createLDAPGroup(String grpName,
String groupDN) |
static void |
createLDAPUser(HashMap<String,Object> userData) |
static void |
createMissingLDAPUser(WTUser user,
String dn) |
static void |
createUser(Map data,
String dn) |
static WTUser |
createWTUser(String username,
String dn) |
static boolean |
deleteUser(String username) |
static boolean |
deleteUser(WTUser user2delete,
boolean delLDAP) |
static void |
deleteUsers(Vector<String> usernames) |
static void |
delLDAPEntry(String entryDN) |
static void |
delLDAPUser(String userDN) |
static boolean |
disableWTUser(WTUser wtUser) |
static void |
exportUserCSV(Map exportParams) |
static void |
findDoppelgaenger(boolean tryToFix) |
static List<WTUser> |
findUsers(String userNameRegex) |
static void |
fixRemoteObjectID(WTUser wtu)
use before changeDN.
|
static Vector<String> |
getAllLDAPGroups() |
static HashMap<String,Object> |
getLDAPUserByUID(String uid)
search ldap for a given uid
|
static Map<String,HashMap> |
getLDAPUsers(String baseDN)
query ldap db for all users
|
static Vector<String> |
getOrganizations() |
static Vector<String> |
getPeopleDNs()
queries for all available ou=people trees in ldap.
|
static String |
getPeopleTreeDN(String csvDirectory) |
static String |
getUIDFromDN(String dn)
extract the uid part from the dn string
|
static Vector<String> |
getUserLDAPGroups(String fqUserDN) |
static List |
getUserRoleReport(WTUser u,
Map listOfContainers,
Map<String,HashMap<String,HashMap<String,String>>> userAndRoles) |
static WTUser |
getWTUser(String uid)
get a wtuser obj by given uid.
|
static Map<String,WTUser> |
getWTUsers()
query windchill db for wtusers
|
static void |
main(String[] args) |
static void |
modifyLDAPUser(HashMap<String,Object> userData) |
static void |
moveWTPrincipalRole(String containerName,
String oldRoleName,
String newRoleName,
String principalName,
boolean cleanCache) |
static void |
printLDAPSettings()
print ldap settings.
|
static void |
printUsage()
print usage.
|
static void |
printUserData(Map<String,Object> userData)
print ldapuserdata.
|
static List<Map> |
readCSV(File aCSVFile,
boolean hasHeader,
String fieldDelim,
boolean hasQuotes,
String recordDelim)
read a csv file into a vector of maps.
|
static Properties |
readLDAPSettings() |
static boolean |
removeUser(WTUser wtUser)
removes a wtuser object from database.
|
static String |
selectPeopleTree()
display list of available ou=people trees in ldap.
|
static void |
setPassword(String userDN,
String newPassword) |
static void |
updateUser(Map data,
HashMap<String,Object> existingLDAPData) |
static void |
updateUserGroups(List<Map> csvData,
boolean createMissing) |
static void |
validateUsers(boolean tryToFix)
validate plausibility of all users - check if all ldap users have a corresponding wtuser obj - check if all wtuser objs have a corresponding ldap entry
|
public static final int MAJOR
public static final int MINOR
public static final boolean SERVER
public static final String RMIHOSTNAME
public static final String HTTPGWHOSTNAME
public static final String WEBAPPNAME
public static final String WTHOME
public static final boolean VERBOSE
public static boolean askUserYesNo(String questionTxt)
public static Properties readLDAPSettings()
public static void delLDAPEntry(String entryDN)
public static void delLDAPUser(String userDN)
public static void createLDAPUser(HashMap<String,Object> userData)
public static void modifyLDAPUser(HashMap<String,Object> userData)
public static void createMissingLDAPUser(WTUser user,
String dn)
throws Exception
Exceptionpublic static WTUser createWTUser(String username,
String dn)
throws WTException
WTExceptionpublic static boolean deleteUser(WTUser user2delete,
boolean delLDAP)
throws WTException
WTExceptionpublic static boolean deleteUser(String username)
throws Exception
Exceptionpublic static boolean disableWTUser(WTUser wtUser)
throws Exception
Exceptionpublic static boolean removeUser(WTUser wtUser)
throws Exception
wtUser - Exceptionpublic static void deleteUsers(Vector<String> usernames)
throws Exception
Exceptionpublic static List<Map> readCSV(File aCSVFile,
boolean hasHeader,
String fieldDelim,
boolean hasQuotes,
String recordDelim)
throws Exception
aCSVFile - hasHeader - fieldDelim - hasQuotes - recordDelim - Exceptionpublic static WTUser getWTUser(String uid)
throws Exception
uid - Exceptionpublic static Map<String,WTUser> getWTUsers()
throws WTException
WTExceptionpublic static Vector<String> getUserLDAPGroups(String fqUserDN)
public static Vector<String> getOrganizations()
public static Vector<String> getAllLDAPGroups()
public static Vector<String> getPeopleDNs()
public static HashMap<String,Object> convertLDAPEntryTopLDAPUserData(LDAPEntry user)
user - public static HashMap<String,Object> getLDAPUserByUID(String uid)
throws WTException
uid - WTExceptionpublic static Map<String,HashMap> getLDAPUsers(String baseDN)
public static void printUserData(Map<String,Object> userData)
userData - public static void validateUsers(boolean tryToFix)
throws Exception
WTExceptionExceptionpublic static String selectPeopleTree()
public static void printLDAPSettings()
public static void printUsage()
public static void main(String[] args)
throws Exception
args - Exceptionpublic static List<WTUser> findUsers(String userNameRegex)
public static void exportUserCSV(Map exportParams)
throws Exception
Exceptionpublic static void cmdExportUserCSV(Map exportParams)
throws Exception
Exceptionpublic static List getUserRoleReport(WTUser u,
Map listOfContainers,
Map<String,HashMap<String,HashMap<String,String>>> userAndRoles)
throws WTException
WTExceptionpublic static void updateUserGroups(List<Map> csvData,
boolean createMissing)
throws Exception
Exceptionpublic static WTGroup createGroup(String grpName,
String orgDN)
throws WTException
WTExceptionpublic static void createLDAPGroup(String grpName,
String groupDN)
public static void cmdUpdateUserGroups(String csvFilename,
String mode)
throws Exception
Exceptionpublic static void createUser(Map data,
String dn)
throws Exception
Exceptionpublic static void updateUser(Map data,
HashMap<String,Object> existingLDAPData)
throws Exception
Exceptionpublic static void setPassword(String userDN,
String newPassword)
throws Exception
Exceptionpublic static String getPeopleTreeDN(String csvDirectory)
public static void cmdCreateUserCSV(String csvFilename)
throws Exception
Exceptionpublic static void fixRemoteObjectID(WTUser wtu)
throws Exception
wtu - Exceptionpublic static boolean checkRemoteObjectID(WTUser wtu,
String userDN,
boolean update)
throws Exception
Exceptionpublic static void changeDN(String curDN,
String newDN,
boolean updateGroups)
throws Exception
Exceptionpublic static void cmdDeleteUserCSV(boolean force,
String csvFilename)
throws Exception
Exceptionpublic static void cmdDeleteUser(boolean force,
String uid)
throws Exception
force - : if true, the wtuser object and the ldap entry WILL BE DELETED. HANDLE WITH CARE!uid - Exceptionpublic static String getUIDFromDN(String dn)
dn - public static void findDoppelgaenger(boolean tryToFix)
throws Exception
Exceptionpublic static void moveWTPrincipalRole(String containerName,
String oldRoleName,
String newRoleName,
String principalName,
boolean cleanCache)
public static void cmdAddWTPrincipalToContainerRole(Map params)
throws Exception
Exceptionpublic static void cmdRemoveWTPrincipalFromContainerRole(Map params)
throws Exception
Exceptionpublic static void cmdAddWTPrincipalsToContainerRoles(Map params)
throws Exception
Exceptionpublic static void cmdRemoveWTPrincipalsFromContainerRoles(Map params)
throws Exception
Exceptionpublic static void cmdRemoveAllFromContainerRoles(Map params)
throws Exception
Exceptionpublic static void cmdReportContainerRoleMembers(Map params)
throws Exception
Exception