Search in sources :

Example 21 with RealmTO

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);
}
Also used : RealmTO(org.apache.syncope.common.lib.to.RealmTO)

Example 22 with RealmTO

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);
}
Also used : RealmTO(org.apache.syncope.common.lib.to.RealmTO)

Example 23 with RealmTO

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);
}
Also used : RealmTO(org.apache.syncope.common.lib.to.RealmTO)

Example 24 with RealmTO

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;
}
Also used : RealmTO(org.apache.syncope.common.lib.to.RealmTO)

Example 25 with 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));
}
Also used : ImplementationTO(org.apache.syncope.common.lib.to.ImplementationTO) Response(javax.ws.rs.core.Response) UserTO(org.apache.syncope.common.lib.to.UserTO) RealmTO(org.apache.syncope.common.lib.to.RealmTO) UserPatch(org.apache.syncope.common.lib.patch.UserPatch) Test(org.junit.jupiter.api.Test)

Aggregations

RealmTO (org.apache.syncope.common.lib.to.RealmTO)30 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)12 Realm (org.apache.syncope.core.persistence.api.entity.Realm)10 ArrayList (java.util.ArrayList)7 Response (javax.ws.rs.core.Response)7 PropagationByResource (org.apache.syncope.core.provisioning.api.PropagationByResource)7 PullActions (org.apache.syncope.core.provisioning.api.pushpull.PullActions)7 Test (org.junit.jupiter.api.Test)7 PropagationTaskTO (org.apache.syncope.common.lib.to.PropagationTaskTO)6 ProvisioningReport (org.apache.syncope.core.provisioning.api.pushpull.ProvisioningReport)6 ImplementationTO (org.apache.syncope.common.lib.to.ImplementationTO)4 ProvisioningResult (org.apache.syncope.common.lib.to.ProvisioningResult)4 Result (org.apache.syncope.common.lib.types.AuditElements.Result)4 PropagationException (org.apache.syncope.core.provisioning.api.propagation.PropagationException)4 IgnoreProvisionException (org.apache.syncope.core.provisioning.api.pushpull.IgnoreProvisionException)4 DelegatedAdministrationException (org.apache.syncope.core.spring.security.DelegatedAdministrationException)4 JobExecutionException (org.quartz.JobExecutionException)4 UserTO (org.apache.syncope.common.lib.to.UserTO)3 NotFoundException (org.apache.syncope.core.persistence.api.dao.NotFoundException)3 PropagationReporter (org.apache.syncope.core.provisioning.api.propagation.PropagationReporter)3