use of org.apache.syncope.common.lib.to.PropagationStatus in project syncope by apache.
the class UserIssuesITCase method issue280.
@Test
public void issue280() {
UserTO userTO = UserITCase.getUniqueSampleTO("issue280@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
userTO = createUser(userTO).getEntity();
assertNotNull(userTO);
UserPatch userPatch = new UserPatch();
userPatch.setKey(userTO.getKey());
userPatch.setPassword(new PasswordPatch.Builder().onSyncope(false).resource(RESOURCE_NAME_TESTDB).value("123password").build());
userPatch.getResources().add(new StringPatchItem.Builder().operation(PatchOperation.ADD_REPLACE).value(RESOURCE_NAME_TESTDB).build());
ProvisioningResult<UserTO> result = updateUser(userPatch);
assertNotNull(result);
List<PropagationStatus> propagations = result.getPropagationStatuses();
assertNotNull(propagations);
assertEquals(1, propagations.size());
assertEquals(PropagationTaskExecStatus.SUCCESS, propagations.get(0).getStatus());
String resource = propagations.get(0).getResource();
assertEquals(RESOURCE_NAME_TESTDB, resource);
}
use of org.apache.syncope.common.lib.to.PropagationStatus in project syncope by apache.
the class UserIssuesITCase method issueSYNCOPE686.
@Test
public void issueSYNCOPE686() {
// 1. read configured cipher algorithm in order to be able to restore it at the end of test
AttrTO pwdCipherAlgo = configurationService.get("password.cipher.algorithm");
String origpwdCipherAlgo = pwdCipherAlgo.getValues().get(0);
// 2. set AES password cipher algorithm
pwdCipherAlgo.getValues().set(0, "AES");
configurationService.set(pwdCipherAlgo);
try {
// 3. create group with LDAP resource assigned
GroupTO group = GroupITCase.getBasicSampleTO("syncope686");
group.getResources().add(RESOURCE_NAME_LDAP);
group = createGroup(group).getEntity();
assertNotNull(group);
// 4. create user with no resources
UserTO userTO = UserITCase.getUniqueSampleTO("syncope686@apache.org");
userTO.getResources().clear();
userTO = createUser(userTO).getEntity();
assertNotNull(userTO);
// 5. update user with the new group, and don't provide any password
UserPatch userPatch = new UserPatch();
userPatch.setKey(userTO.getKey());
userPatch.getMemberships().add(new MembershipPatch.Builder().operation(PatchOperation.ADD_REPLACE).group(group.getKey()).build());
ProvisioningResult<UserTO> result = updateUser(userPatch);
assertNotNull(result);
// 5. verify that propagation was successful
List<PropagationStatus> props = result.getPropagationStatuses();
assertNotNull(props);
assertEquals(1, props.size());
PropagationStatus prop = props.iterator().next();
assertNotNull(prop);
assertEquals(RESOURCE_NAME_LDAP, prop.getResource());
assertEquals(PropagationTaskExecStatus.SUCCESS, prop.getStatus());
} finally {
// restore initial cipher algorithm
pwdCipherAlgo.getValues().set(0, origpwdCipherAlgo);
configurationService.set(pwdCipherAlgo);
}
}
use of org.apache.syncope.common.lib.to.PropagationStatus in project syncope by apache.
the class UserIssuesITCase method issue281.
@Test
public void issue281() {
UserTO userTO = UserITCase.getUniqueSampleTO("issue281@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
userTO.getResources().add(RESOURCE_NAME_CSV);
ProvisioningResult<UserTO> result = createUser(userTO);
assertNotNull(result);
List<PropagationStatus> propagations = result.getPropagationStatuses();
assertNotNull(propagations);
assertEquals(1, propagations.size());
assertNotEquals(PropagationTaskExecStatus.SUCCESS, propagations.get(0).getStatus());
String resource = propagations.get(0).getResource();
assertEquals(RESOURCE_NAME_CSV, resource);
}
use of org.apache.syncope.common.lib.to.PropagationStatus in project syncope by apache.
the class UserIssuesITCase method issueSYNCOPE136Random.
@Test
public void issueSYNCOPE136Random() {
// 1. create user with no resources
UserTO userTO = UserITCase.getUniqueSampleTO("syncope136_Random@apache.org");
userTO.getResources().clear();
userTO = createUser(userTO).getEntity();
assertNotNull(userTO);
// 2. update user, assign a propagation priority resource but don't provide any password
UserPatch userPatch = new UserPatch();
userPatch.setKey(userTO.getKey());
userPatch.getResources().add(new StringPatchItem.Builder().operation(PatchOperation.ADD_REPLACE).value(RESOURCE_NAME_LDAP).build());
userPatch.setPassword(new PasswordPatch.Builder().onSyncope(false).resource(RESOURCE_NAME_LDAP).build());
ProvisioningResult<UserTO> result = updateUser(userPatch);
assertNotNull(result);
// 3. verify that propagation was successful
List<PropagationStatus> props = result.getPropagationStatuses();
assertNotNull(props);
assertEquals(1, props.size());
PropagationStatus prop = props.iterator().next();
assertNotNull(prop);
assertEquals(RESOURCE_NAME_LDAP, prop.getResource());
assertEquals(PropagationTaskExecStatus.SUCCESS, prop.getStatus());
}
use of org.apache.syncope.common.lib.to.PropagationStatus in project syncope by apache.
the class AnyObjectLogic method deprovision.
@Override
public ProvisioningResult<AnyObjectTO> deprovision(final String key, final Collection<String> resources, final boolean nullPriorityAsync) {
// security checks
AnyObjectTO anyObjectTO = binder.getAnyObjectTO(key);
Set<String> effectiveRealms = RealmUtils.getEffective(AuthContextUtils.getAuthorizations().get(AnyEntitlement.UPDATE.getFor(anyObjectTO.getType())), anyObjectTO.getRealm());
securityChecks(effectiveRealms, anyObjectTO.getRealm(), anyObjectTO.getKey());
List<PropagationStatus> statuses = provisioningManager.deprovision(key, resources, nullPriorityAsync);
ProvisioningResult<AnyObjectTO> result = new ProvisioningResult<>();
result.setEntity(binder.getAnyObjectTO(key));
result.getPropagationStatuses().addAll(statuses);
return result;
}
Aggregations