use of org.apache.syncope.common.lib.to.RealmTO in project syncope by apache.
the class DefaultRealmPushResultHandler method link.
private void link(final Realm realm, final boolean unlink, final ProvisioningReport result) {
RealmTO realmTO = binder.getRealmTO(realm, true);
if (unlink) {
realmTO.getResources().remove(profile.getTask().getResource().getKey());
} else {
realmTO.getResources().add(profile.getTask().getResource().getKey());
}
update(realmTO, result);
}
use of org.apache.syncope.common.lib.to.RealmTO in project syncope by apache.
the class DefaultRealmPushResultHandler method unassign.
private void unassign(final Realm realm, final ProvisioningReport result) {
RealmTO realmTO = binder.getRealmTO(realm, true);
realmTO.getResources().remove(profile.getTask().getResource().getKey());
deprovision(update(realmTO, result), result);
}
use of org.apache.syncope.common.lib.to.RealmTO in project syncope by apache.
the class DefaultRealmPushResultHandler method assign.
private void assign(final Realm realm, final ProvisioningReport result) {
RealmTO realmTO = binder.getRealmTO(realm, true);
realmTO.getResources().add(profile.getTask().getResource().getKey());
provision(update(realmTO, result), result);
}
use of org.apache.syncope.common.lib.to.RealmTO in project syncope by apache.
the class ConnObjectUtils method getRealmTO.
public RealmTO getRealmTO(final ConnectorObject obj, final PullTask task, final OrgUnit orgUnit) {
RealmTO realmTO = new RealmTO();
MappingUtils.getPullItems(orgUnit.getItems()).forEach(item -> {
mappingManager.setIntValues(item, obj.getAttributeByName(item.getExtAttrName()), realmTO);
});
return realmTO;
}
use of org.apache.syncope.common.lib.to.RealmTO in project syncope by apache.
the class UserIssuesITCase method issueSYNCOPE420.
@Test
public void issueSYNCOPE420() throws IOException {
ImplementationTO logicActions = new ImplementationTO();
logicActions.setKey("DoubleValueLogicActions");
logicActions.setEngine(ImplementationEngine.GROOVY);
logicActions.setType(ImplementationType.LOGIC_ACTIONS);
logicActions.setBody(org.apache.commons.io.IOUtils.toString(getClass().getResourceAsStream("/DoubleValueLogicActions.groovy"), StandardCharsets.UTF_8));
Response response = implementationService.create(logicActions);
logicActions = implementationService.read(logicActions.getType(), response.getHeaderString(RESTHeaders.RESOURCE_KEY));
assertNotNull(logicActions);
RealmTO realm = realmService.list("/even/two").iterator().next();
assertNotNull(realm);
realm.getActions().add(logicActions.getKey());
realmService.update(realm);
UserTO userTO = UserITCase.getUniqueSampleTO("syncope420@syncope.apache.org");
userTO.setRealm(realm.getFullPath());
userTO.getPlainAttrs().add(attrTO("makeItDouble", "3"));
userTO = createUser(userTO).getEntity();
assertEquals("6", userTO.getPlainAttr("makeItDouble").get().getValues().get(0));
UserPatch userPatch = new UserPatch();
userPatch.setKey(userTO.getKey());
userPatch.getPlainAttrs().add(attrAddReplacePatch("makeItDouble", "7"));
userTO = updateUser(userPatch).getEntity();
assertEquals("14", userTO.getPlainAttr("makeItDouble").get().getValues().get(0));
}
Aggregations