[midPoint] Assistance with Resource/Account provisioning operations using Webservice client

dharmendra parakh dharm.parakh at gmail.com
Mon Dec 29 12:30:43 CET 2014


Hi

Hope you all had a nice Christmas, I wish you all a very Happy new year
2015 ahead.

I have a requirement where i have to provision account/resource to a
role/user in midpoint using model web service. I was able to create and
search account using web service client (model-client-sample)

- I need some pointers on how to update the account. I tried few things
some didn't work and some worked partially. can you help me providing the
right way or a code snippet to do it.

I have attached a code snippet which replaces the role assignment and it
works if i remove the attribute itself from construction but when i try to
remove some values of a multi-valued attribute instead of removing those
values it tries to add other value which are already present


- One more thing there is a method in web service to get the owner of
shadow account but that can be a user only, how we can get the owner of a
shadow if that owner is a role.

following is the method:

*findShadowOwner(shadowOid, user, result);*



Thanks & regards
Dharmendra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20141229/8ebfb4e3/attachment.htm>
-------------- next part --------------
		ObjectDeltaType shadowDelta = new ObjectDeltaType();
		shadowDelta.setOid(role.getOid());
		shadowDelta.setObjectType(ModelClientUtil.getTypeQName(RoleType.class));
		shadowDelta.setChangeType(ChangeTypeType.MODIFY);
		
		List<AssignmentType> assignmentList = role.getAssignment();
		AssignmentType tempAssignment = null;
		for(AssignmentType assignment : assignmentList){
			tempAssignment = assignment;
			List<ResourceAttributeDefinitionType> attrs = new ArrayList<ResourceAttributeDefinitionType>(assignment.getConstruction().getAttribute()); 
			List<ResourceAttributeDefinitionType> exAttrs = assignment.getConstruction().getAttribute();
			
			for(ResourceAttributeDefinitionType attr: attrs){
				String attrName = attr.getRef().getLocalPart();
				if(attrName.equals("ldapGroups")){
//					exAttrs.remove(attr);
					ResourceAttributeDefinitionType attr1 = exAttrs.get(exAttrs.indexOf(attr));
					attr1.getOutbound().getExpression().getExpressionEvaluator().remove(0);
				}
			}
			
			break;
		}
		

		ItemDeltaType itemDelta = new ItemDeltaType();
		itemDelta.setModificationType(ModificationTypeType.REPLACE);
		itemDelta.setPath(ModelClientUtil.createItemPathType("assignment"));
		itemDelta.getValue().add(tempAssignment);

		
		
		shadowDelta.getItemDelta().add(itemDelta);

		ObjectDeltaListType deltaList = new ObjectDeltaListType();
		deltaList.getDelta().add(shadowDelta);
		modelPort.executeChanges(deltaList, null);


More information about the midPoint mailing list