@Override public void onClick(final AjaxRequestTarget target, final GroupTO ignore) { GroupTO clone = SerializationUtils.clone(model.getObject()); clone.setKey(null); send(GroupDirectoryPanel.this, Broadcast.EXACT, new AjaxWizard.NewItemActionEvent<>(new GroupWrapper(clone), target)); }
@PreAuthorize("hasRole('" + StandardEntitlement.GROUP_DELETE + "')") @Override public ProvisioningResult<GroupTO> delete(final String key, final boolean nullPriorityAsync) { GroupTO group = binder.getGroupTO(key); Pair<GroupTO, List<LogicActions>> before = beforeDelete(group); Set<String> effectiveRealms = RealmUtils.getEffective( AuthContextUtils.getAuthorizations().get(StandardEntitlement.GROUP_DELETE), before.getLeft().getRealm()); securityChecks(effectiveRealms, before.getLeft().getRealm(), before.getLeft().getKey()); List<Group> ownedGroups = groupDAO.findOwnedByGroup(before.getLeft().getKey()); if (!ownedGroups.isEmpty()) { SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.GroupOwnership); sce.getElements().addAll(ownedGroups.stream(). map(g -> g.getKey() + " " + g.getName()).collect(Collectors.toList())); throw sce; } List<PropagationStatus> statuses = provisioningManager.delete(before.getLeft().getKey(), nullPriorityAsync); GroupTO groupTO = new GroupTO(); groupTO.setKey(before.getLeft().getKey()); return afterDelete(groupTO, statuses, before.getRight()); }
public GroupTO toGroupTO(final SCIMGroup group) { if (!GROUP_SCHEMAS.equals(group.getSchemas())) { throw new BadRequestException(ErrorType.invalidValue); } GroupTO groupTO = new GroupTO(); groupTO.setRealm(SyncopeConstants.ROOT_REALM); groupTO.setKey(group.getId()); groupTO.setName(group.getDisplayName()); return groupTO; }
@Override public Response update(final GroupTO groupTO) { groupTO.setKey(getActualKey(getAnyDAO(), groupTO.getKey())); GroupTO before = logic.read(groupTO.getKey()); checkETag(before.getETagValue()); ProvisioningResult<GroupTO> updated = logic.update(AnyOperations.diff(groupTO, before, false), isNullPriorityAsync()); return modificationResponse(updated); }
groupTO.setStatus(group.getStatus()); groupTO.setKey(group.getKey()); groupTO.setName(group.getName());