use of org.apache.syncope.common.lib.patch.GroupPatch in project syncope by apache.
the class GroupLogic method assign.
@PreAuthorize("hasRole('" + StandardEntitlement.GROUP_UPDATE + "')")
@Override
public ProvisioningResult<GroupTO> assign(final String key, final Collection<String> resources, final boolean changepwd, final String password, final boolean nullPriorityAsync) {
// security checks
GroupTO group = binder.getGroupTO(key);
Set<String> effectiveRealms = RealmUtils.getEffective(AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_UPDATE), group.getRealm());
securityChecks(effectiveRealms, group.getRealm(), group.getKey());
GroupPatch patch = new GroupPatch();
patch.setKey(key);
patch.getResources().addAll(resources.stream().map(resource -> new StringPatchItem.Builder().operation(PatchOperation.ADD_REPLACE).value(resource).build()).collect(Collectors.toList()));
patch.getADynMembershipConds().putAll(group.getADynMembershipConds());
patch.setUDynMembershipCond(group.getUDynMembershipCond());
return update(patch, nullPriorityAsync);
}
use of org.apache.syncope.common.lib.patch.GroupPatch in project syncope by apache.
the class GroupLogic method unlink.
@PreAuthorize("hasRole('" + StandardEntitlement.GROUP_UPDATE + "')")
@Override
public GroupTO unlink(final String key, final Collection<String> resources) {
// security checks
GroupTO group = binder.getGroupTO(key);
Set<String> effectiveRealms = RealmUtils.getEffective(AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_UPDATE), group.getRealm());
securityChecks(effectiveRealms, group.getRealm(), group.getKey());
GroupPatch patch = new GroupPatch();
patch.setKey(key);
patch.getResources().addAll(resources.stream().map(resource -> new StringPatchItem.Builder().operation(PatchOperation.DELETE).value(resource).build()).collect(Collectors.toList()));
patch.setUDynMembershipCond(group.getUDynMembershipCond());
patch.getADynMembershipConds().putAll(group.getADynMembershipConds());
return binder.getGroupTO(provisioningManager.unlink(patch));
}
use of org.apache.syncope.common.lib.patch.GroupPatch in project syncope by apache.
the class RemediationLogic method remedy.
@PreAuthorize("hasRole('" + StandardEntitlement.REMEDIATION_REMEDY + "')")
public ProvisioningResult<?> remedy(final String key, final AnyPatch anyPatch, final boolean nullPriorityAsync) {
Remediation remediation = remediationDAO.find(key);
if (remediation == null) {
LOG.error("Could not find remediation '" + key + "'");
throw new NotFoundException(key);
}
ProvisioningResult<?> result;
switch(remediation.getAnyType().getKind()) {
case USER:
default:
result = userLogic.update((UserPatch) anyPatch, nullPriorityAsync);
break;
case GROUP:
result = groupLogic.update((GroupPatch) anyPatch, nullPriorityAsync);
break;
case ANY_OBJECT:
result = anyObjectLogic.update((AnyObjectPatch) anyPatch, nullPriorityAsync);
}
remediationDAO.delete(remediation);
return result;
}
Aggregations