use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class Main method searchRoleByName.
private static RoleType searchRoleByName(ModelPortType modelPort, String roleName) throws SAXException, IOException, FaultMessage, JAXBException {
// WARNING: in a real case make sure that the role name is properly escaped before putting it in XML
SearchFilterType filter = ModelClientUtil.parseSearchFilterType("<equal xmlns='http://prism.evolveum.com/xml/ns/public/query-3' xmlns:c='http://midpoint.evolveum.com/xml/ns/public/common/common-3' >" + "<path>c:name</path>" + "<value>" + roleName + "</value>" + "</equal>");
QueryType query = new QueryType();
query.setFilter(filter);
SelectorQualifiedGetOptionsType options = new SelectorQualifiedGetOptionsType();
Holder<ObjectListType> objectListHolder = new Holder<ObjectListType>();
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
modelPort.searchObjects(ModelClientUtil.getTypeQName(RoleType.class), query, options, objectListHolder, resultHolder);
ObjectListType objectList = objectListHolder.value;
List<ObjectType> objects = objectList.getObject();
if (objects.isEmpty()) {
return null;
}
if (objects.size() == 1) {
return (RoleType) objects.get(0);
}
throw new IllegalStateException("Expected to find a single role with name '" + roleName + "' but found " + objects.size() + " users instead");
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class AbstractTestForExchangeConnector method createUserGuybrush.
protected String createUserGuybrush(RoleType role) throws FaultMessage {
Document doc = ModelClientUtil.getDocumnent();
UserType user = new UserType();
user.setName(ModelClientUtil.createPolyStringType("guybrush", doc));
user.setFullName(ModelClientUtil.createPolyStringType("Guybrush Threepwood", doc));
user.setGivenName(ModelClientUtil.createPolyStringType("Guybrush", doc));
user.setFamilyName(ModelClientUtil.createPolyStringType("Threepwood", doc));
user.setEmailAddress("guybrush@meleeisland.net");
user.getOrganization().add(ModelClientUtil.createPolyStringType("Pirate Brethren International", doc));
user.getOrganizationalUnit().add(ModelClientUtil.createPolyStringType("Pirate Wannabes", doc));
user.setCredentials(ModelClientUtil.createPasswordCredentials("IwannaBEaPIRATE"));
if (role != null) {
// create user with a role assignment
AssignmentType roleAssignment = createRoleAssignment(role.getOid());
user.getAssignment().add(roleAssignment);
}
return createUser(user);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class PageRole method prepareObjectForAdd.
@Override
protected void prepareObjectForAdd(PrismObject<RoleType> focus) throws SchemaException {
// TODO policyConstraints
super.prepareObjectForAdd(focus);
getObjectWrapper().getObjectOld().findOrCreateContainer(RoleType.F_POLICY_CONSTRAINTS);
ObjectDelta<RoleType> delta = getObjectWrapper().getObjectOld().diff(getObjectWrapper().getObject());
ContainerDelta<PolicyConstraintsType> policyConstraintsDelta = delta.findContainerDelta(new ItemPath(RoleType.F_POLICY_CONSTRAINTS));
if (policyConstraintsDelta != null) {
policyConstraintsDelta.applyTo(focus);
return;
}
ContainerDelta maxAssignes = delta.findContainerDelta(new ItemPath(RoleType.F_POLICY_CONSTRAINTS, PolicyConstraintsType.F_MAX_ASSIGNEES));
if (maxAssignes != null) {
maxAssignes.applyTo(focus);
}
ContainerDelta minAssignes = delta.findContainerDelta(new ItemPath(RoleType.F_POLICY_CONSTRAINTS, PolicyConstraintsType.F_MIN_ASSIGNEES));
if (minAssignes != null) {
minAssignes.applyTo(focus);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class PageRole method prepareObjectDeltaForModify.
@Override
protected void prepareObjectDeltaForModify(ObjectDelta<RoleType> focusDelta) throws SchemaException {
super.prepareObjectDeltaForModify(focusDelta);
ObjectDelta<RoleType> delta = getObjectWrapper().getObjectOld().diff(getObjectWrapper().getObject());
ContainerDelta<PolicyConstraintsType> policyConstraintsDelta = delta.findContainerDelta(new ItemPath(RoleType.F_POLICY_CONSTRAINTS));
if (policyConstraintsDelta != null) {
focusDelta.addModification(policyConstraintsDelta);
return;
}
ContainerDelta maxAssignes = delta.findContainerDelta(new ItemPath(RoleType.F_POLICY_CONSTRAINTS, PolicyConstraintsType.F_MAX_ASSIGNEES));
if (maxAssignes != null) {
focusDelta.addModification(maxAssignes);
}
ContainerDelta minAssignes = delta.findContainerDelta(new ItemPath(RoleType.F_POLICY_CONSTRAINTS, PolicyConstraintsType.F_MIN_ASSIGNEES));
if (minAssignes != null) {
focusDelta.addModification(minAssignes);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class PageRoles method initColumns.
private List<IColumn<SelectableBean<RoleType>, String>> initColumns() {
List<IColumn<SelectableBean<RoleType>, String>> columns = new ArrayList<>();
IColumn column = new PropertyColumn(createStringResource("OrgType.displayName"), "value.displayName");
columns.add(column);
column = new PropertyColumn(createStringResource("OrgType.identifier"), "value.identifier");
columns.add(column);
column = new PropertyColumn(createStringResource("ObjectType.description"), "value.description");
columns.add(column);
return columns;
}
Aggregations