private static string dumpSystemConfiguration(SystemConfigurationType configurationType) { StringBuilder sb = new StringBuilder(); sb.Append("System configuration object:"); sb.Append("\n- name = ").Append(configurationType.name); sb.Append("\n- oid = ").Append(configurationType.oid); return(sb.ToString()); }
private static string dumpSystemConfiguration(SystemConfigurationType configurationType) { StringBuilder sb = new StringBuilder(); sb.Append("System configuration object:"); sb.Append("\n- name = ").Append(configurationType.name); sb.Append("\n- oid = ").Append(configurationType.oid); return sb.ToString(); }
static void Main1(string[] args) { modelPortType modelPort = openConnection(); Console.WriteLine("Getting system configuration..."); SystemConfigurationType configurationType = getConfiguration(modelPort); Console.WriteLine(dumpSystemConfiguration(configurationType)); Console.WriteLine("========================================================="); Console.WriteLine("Getting administrator user..."); UserType userAdministrator = searchUserByName(modelPort, "administrator"); Console.WriteLine(dumpUser(userAdministrator)); Console.WriteLine("========================================================="); Console.WriteLine("Getting Sailor role..."); RoleType sailorRole = searchRoleByName(modelPort, "Sailor"); if (sailorRole != null) { Console.WriteLine(dumpRole(sailorRole)); } else { Console.WriteLine("No Sailor role in the system."); } Console.WriteLine("========================================================="); Console.WriteLine("Getting resources..."); // please note: ObjectType is ObjectType in prism module, ObjectType1 is ObjectType in schema module (i.e. the "real" c:ObjectType) ObjectType1[] resources = listObjects(modelPort, RESOURCE_TYPE); Console.WriteLine(dump(resources)); Console.WriteLine("========================================================="); Console.WriteLine("Getting users..."); ObjectType1[] users = listObjects(modelPort, USER_TYPE); Console.WriteLine(dump(users)); Console.WriteLine("========================================================="); Console.WriteLine("Getting users (first three, sorted by name)..."); ObjectType1[] users2 = listObjectsRestrictedAndSorted(modelPort, USER_TYPE); Console.WriteLine(dump(users2)); Console.WriteLine("========================================================="); Console.WriteLine("Getting tasks..."); TaskType[] tasks = listTasks(modelPort); Console.WriteLine(dump(tasks)); Console.WriteLine("Next scheduled times: "); foreach (TaskType taskType in tasks) { Console.WriteLine(" - " + getOrig(taskType.name) + ": " + taskType.nextRunStartTimestamp); } Console.WriteLine("========================================================="); Console.WriteLine("Creating user guybrush..."); String userGuybrushoid = createUserGuybrush(modelPort, sailorRole); Console.WriteLine("Created with OID: " + userGuybrushoid); Console.WriteLine("========================================================="); Console.WriteLine("Creating user lechuck..."); //String userLeChuckOid = createUserFromFile(modelPort, USER_LECHUCK_FILE); deserializing from file doesn't work for unknown reason String userLeChuckOid = createUserLechuck(modelPort); Console.WriteLine("Created with OID: " + userLeChuckOid); Console.WriteLine("========================================================="); Console.WriteLine("Changing password for guybrush..."); changeUserPassword(modelPort, userGuybrushoid, "MIGHTYpirate"); Console.WriteLine("Done."); Console.WriteLine("========================================================="); Console.WriteLine("Changing given name for lechuck..."); changeUserGivenName(modelPort, userLeChuckOid, "CHUCK"); Console.WriteLine("Done."); Console.WriteLine("========================================================="); Console.WriteLine("Assigning roles to guybrush..."); assignRoles(modelPort, userGuybrushoid, new string[] { ROLE_PIRATE_OID, ROLE_CAPTAIN_OID }); Console.WriteLine("Done."); Console.WriteLine("========================================================="); Console.WriteLine("Unassigning a role from guybrush..."); unAssignRoles(modelPort, userGuybrushoid, new string[] { ROLE_CAPTAIN_OID }); Console.WriteLine("Done."); Console.WriteLine("========================================================="); Console.WriteLine("Getting requestable roles..."); ObjectType1[] roles = listRequestableRoles(modelPort); Console.WriteLine(dump(roles)); // Comment-out the following lines if you want to see what midPoint really did // ... because deleting the user will delete also all the traces (except logs and audit of course). Console.WriteLine("========================================================="); Console.WriteLine("Deleting users guybrush and lechuck..."); deleteUser(modelPort, userGuybrushoid); deleteUser(modelPort, userLeChuckOid); Console.WriteLine("Done."); }