コード例 #1
0
ファイル: Program.cs プロジェクト: rohitpatil32/syzygy
        private static void modifyRoleAssignment(modelPortType modelPort, String userOid, bool isAdd, String[] roleOids)
        {
            ItemDeltaType assignmentDelta = new ItemDeltaType();

            if (isAdd)
            {
                assignmentDelta.modificationType = ModificationTypeType.add;
            }
            else
            {
                assignmentDelta.modificationType = ModificationTypeType.delete;
            }
            assignmentDelta.path = createItemPathType("assignment");
            List <object> assignments = new List <object>();

            foreach (String roleOid in roleOids)
            {
                assignments.Add(createRoleAssignment(roleOid));
            }
            assignmentDelta.value = assignments.ToArray();

            ObjectDeltaType objectDelta = new ObjectDeltaType();

            objectDelta.objectType = USER_TYPE;
            objectDelta.changeType = ChangeTypeType.modify;
            objectDelta.oid        = userOid;
            objectDelta.itemDelta  = new ItemDeltaType[] { assignmentDelta };

            executeChanges         request  = new executeChanges(new ObjectDeltaType[] { objectDelta }, null);
            executeChangesResponse response = modelPort.executeChanges(request);

            check(response);
        }
コード例 #2
0
        /// <summary>
        /// Creates a new userDelta with the new password for the given user, then uses
        /// the given model port to transmit userDelta to Midpoint.
        /// </summary>
        /// <param name="modelPort">The model port to transmit new userDelta back to Midpoint.</param>
        /// <param name="oid">The user ID.</param>
        /// <param name="newPassword">The new password value.</param>
        public static void changeUserPassword(modelPortType modelPort, string oid, string newPassword)
        {
            XmlDocument doc = new XmlDocument();

            ObjectModificationType userDelta = new ObjectModificationType();
            userDelta.oid = oid;

            ItemDeltaType passwordDelta = new ItemDeltaType();
            passwordDelta.modificationType = ModificationTypeType.replace;
            // Set path value - webservices name is apparently 'Any'?
            passwordDelta.Any = createPathElement("credentials/password", doc);
            ItemDeltaTypeValue passwordValue = new ItemDeltaTypeValue();
            // New passwordValue object so add at first index?
            passwordValue.Any = new XmlElement[1];
            passwordValue.Any.SetValue(toPasswordElement(NS_COMMON, createProtectedString(newPassword), doc), 0);
            passwordDelta.value = passwordValue;
            // New userDelta object so add at first index?
            userDelta.modification = new ItemDeltaType[1];
            userDelta.modification.SetValue(passwordDelta, 0);

            modifyObject request = new modifyObject(getTypeUri(new UserType()), userDelta);
            modifyObjectResponse response = modelPort.modifyObject(request);

            System.Console.WriteLine("Result: '" + response.result.status.ToString() + "' for user oid: '" + oid + "'");
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: rohitpatil32/syzygy
        private static void changeUserGivenName(modelPortType modelPort, String oid, String newValue)
        {
            ItemDeltaType itemDelta = new ItemDeltaType();

            itemDelta.modificationType = ModificationTypeType.replace;
            itemDelta.path             = createItemPathType("givenName");
            itemDelta.value            = new object[] { createPolyStringType(newValue) };

            ObjectDeltaType objectDelta = new ObjectDeltaType();

            objectDelta.objectType = USER_TYPE;
            objectDelta.changeType = ChangeTypeType.modify;
            objectDelta.oid        = oid;
            objectDelta.itemDelta  = new ItemDeltaType[] { itemDelta };

            executeChanges         request  = new executeChanges(new ObjectDeltaType[] { objectDelta }, null);
            executeChangesResponse response = modelPort.executeChanges(request);

            check(response);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: rohitpatil32/syzygy
        private static void changeUserPassword(modelPortType modelPort, String oid, String newPassword)
        {
            ItemDeltaType passwordDelta = new ItemDeltaType();

            passwordDelta.modificationType = ModificationTypeType.replace;
            passwordDelta.path             = createItemPathType("credentials/password/value");
            passwordDelta.value            = new object[] { createProtectedStringType(newPassword) };

            ObjectDeltaType deltaType = new ObjectDeltaType();

            deltaType.objectType = USER_TYPE;
            deltaType.changeType = ChangeTypeType.modify;
            deltaType.oid        = oid;
            deltaType.itemDelta  = new ItemDeltaType[] { passwordDelta };

            executeChanges         request  = new executeChanges(new ObjectDeltaType[] { deltaType }, null);
            executeChangesResponse response = modelPort.executeChanges(request);

            check(response);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: Rijndaal/midpoint
	    private static void modifyRoleAssignment(modelPortType modelPort, String userOid, bool isAdd, String[] roleOids) 
        {
		    ItemDeltaType assignmentDelta = new ItemDeltaType();
		    if (isAdd) 
            {
			    assignmentDelta.modificationType = ModificationTypeType.add;
		    } 
            else 
            {
			    assignmentDelta.modificationType = ModificationTypeType.delete;
		    }
            assignmentDelta.path = createItemPathType("assignment");
            List<object> assignments = new List<object>();
		    foreach (String roleOid in roleOids) 
            {
                assignments.Add(createRoleAssignment(roleOid));
		    }
            assignmentDelta.value = assignments.ToArray();

            ObjectDeltaType objectDelta = new ObjectDeltaType();
            objectDelta.objectType = USER_TYPE;
            objectDelta.changeType = ChangeTypeType.modify;
            objectDelta.oid = userOid;
            objectDelta.itemDelta = new ItemDeltaType[] { assignmentDelta };

            executeChanges request = new executeChanges(new ObjectDeltaType[] { objectDelta }, null);
            executeChangesResponse response = modelPort.executeChanges(request);
            check(response);
    	}
コード例 #6
0
ファイル: Program.cs プロジェクト: Rijndaal/midpoint
        private static void changeUserGivenName(modelPortType modelPort, String oid, String newValue) 
        {
   		    ItemDeltaType itemDelta = new ItemDeltaType();
		    itemDelta.modificationType = ModificationTypeType.replace;
		    itemDelta.path = createItemPathType("givenName");
            itemDelta.value = new object[] { createPolyStringType(newValue) };

            ObjectDeltaType objectDelta = new ObjectDeltaType();
            objectDelta.objectType = USER_TYPE;
            objectDelta.changeType = ChangeTypeType.modify;
            objectDelta.oid = oid;
            objectDelta.itemDelta = new ItemDeltaType[] { itemDelta };

            executeChanges request = new executeChanges(new ObjectDeltaType[] { objectDelta }, null);
            executeChangesResponse response = modelPort.executeChanges(request);
            check(response);
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: Rijndaal/midpoint
	    private static void changeUserPassword(modelPortType modelPort, String oid, String newPassword) 
        {
		    ItemDeltaType passwordDelta = new ItemDeltaType();
		    passwordDelta.modificationType = ModificationTypeType.replace;
		    passwordDelta.path = createItemPathType("credentials/password/value");
            passwordDelta.value = new object[] { createProtectedStringType(newPassword) };

            ObjectDeltaType deltaType = new ObjectDeltaType();
            deltaType.objectType = USER_TYPE;
            deltaType.changeType = ChangeTypeType.modify;
            deltaType.oid = oid;
            deltaType.itemDelta = new ItemDeltaType[] { passwordDelta };

            executeChanges request = new executeChanges(new ObjectDeltaType[] { deltaType }, null);
            executeChangesResponse response = modelPort.executeChanges(request);
            check(response);
    	}