@Override public List<String> getValues(final Any<?> any, final VirSchema schema) { if (!anyUtilsFactory.getInstance(any).dao(). findAllowedSchemas(any, VirSchema.class).forSelfContains(schema)) { LOG.debug("{} not allowed for {}", schema, any); return Collections.emptyList(); } List<String> result = getValues(any, Collections.singleton(schema)).get(schema); return result == null ? Collections.emptyList() : result; }
@Override public List<String> getValues(final Any<?> any, final Membership<?> membership, final VirSchema schema) { if (!anyUtilsFactory.getInstance(any).dao(). findAllowedSchemas(any, VirSchema.class).getForMembership(membership.getRightEnd()).contains(schema)) { LOG.debug("{} not allowed for {}", schema, any); return Collections.emptyList(); } List<String> result = getValues(any, Collections.singleton(schema)).get(schema); return result == null ? Collections.emptyList() : result; }
@Override public String getValue(final Any<?> any, final DerSchema schema) { if (!anyUtilsFactory.getInstance(any).dao(). findAllowedSchemas(any, DerSchema.class).forSelfContains(schema)) { LOG.debug("{} not allowed for {}", schema, any); return null; } return getValues(any, Collections.singleton(schema)).get(schema); }
@Override public String getValue(final Any<?> any, final Membership<?> membership, final DerSchema schema) { if (!anyUtilsFactory.getInstance(any).dao(). findAllowedSchemas(any, DerSchema.class).getForMembership(membership.getRightEnd()).contains(schema)) { LOG.debug("{} not allowed for {}", schema, any); return null; } return getValues(any, Collections.singleton(schema)).get(schema); }
@Override public ReconStatus status(final AnyTypeKind anyTypeKind, final String anyKey, final String resourceKey) { return logic.status( anyTypeKind, getActualKey(anyUtilsFactory.getInstance(anyTypeKind).dao(), anyKey), resourceKey); }
@Override public void push( final AnyTypeKind anyTypeKind, final String anyKey, final String resourceKey, final PushTaskTO pushTask) { logic.push( anyTypeKind, getActualKey(anyUtilsFactory.getInstance(anyTypeKind).dao(), anyKey), resourceKey, pushTask); }
@Override public void pull( final AnyTypeKind anyTypeKind, final String anyKey, final String resourceKey, final PullTaskTO pullTask) { logic.pull( anyTypeKind, getActualKey(anyUtilsFactory.getInstance(anyTypeKind).dao(), anyKey), resourceKey, pullTask); } }
@Override public Map<VirSchema, List<String>> getValues(final Any<?> any) { return getValues( any, anyUtilsFactory.getInstance(any).dao().findAllowedSchemas(any, VirSchema.class).getForSelf()); }
@Override public Map<DerSchema, String> getValues(final Any<?> any) { return getValues( any, anyUtilsFactory.getInstance(any).dao().findAllowedSchemas(any, DerSchema.class).getForSelf()); }
private SyncopeClientException checkMandatory(final Any<?> any, final AnyUtils anyUtils) { SyncopeClientException reqValMissing = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing); // Check if there is some mandatory schema defined for which no value has been provided AllowedSchemas<PlainSchema> allowedPlainSchemas = anyUtils.dao().findAllowedSchemas(any, PlainSchema.class); allowedPlainSchemas.getForSelf().forEach(schema -> { checkMandatory(schema, any.getPlainAttr(schema.getKey()).orElse(null), any, reqValMissing); }); if (any instanceof GroupableRelatable) { allowedPlainSchemas.getForMemberships().forEach((group, schemas) -> { GroupableRelatable<?, ?, ?, ?, ?> groupable = GroupableRelatable.class.cast(any); Membership<?> membership = groupable.getMembership(group.getKey()).orElse(null); schemas.forEach(schema -> { checkMandatory(schema, groupable.getPlainAttr(schema.getKey(), membership).orElse(null), any, reqValMissing); }); }); } return reqValMissing; }
@Override public Map<VirSchema, List<String>> getValues(final Any<?> any, final Membership<?> membership) { return getValues( any, anyUtilsFactory.getInstance(any).dao().findAllowedSchemas(any, VirSchema.class). getForMembership(membership.getRightEnd())); }
@Override public Map<DerSchema, String> getValues( final GroupableRelatable<?, ?, ?, ?, ?> any, final Membership<?> membership) { return getValues( any, membership, anyUtilsFactory.getInstance(any).dao().findAllowedSchemas(any, DerSchema.class). getForMembership(membership.getRightEnd())); }
switch (intAttrName.getField()) { case "key": Any<?> any = anyUtils.dao().find(connObjectKey); if (any != null) { result.add(any.getKey()); result.addAll(anyUtils.dao().findByPlainAttrValue( intAttrName.getSchemaName(), value, provision.isIgnoreCaseMatch()). stream().map(Entity::getKey).collect(Collectors.toList())); result.addAll(anyUtils.dao().findByDerAttrValue( intAttrName.getSchemaName(), connObjectKey, provision.isIgnoreCaseMatch()). stream().map(Entity::getKey).collect(Collectors.toList()));
Any<?> any = null; try { any = getAnyUtils().dao().authFind(anyKey);
@SuppressWarnings("unchecked") private Pair<Any<?>, Provision> init(final AnyTypeKind anyTypeKind, final String anyKey, final String resourceKey) { AnyUtils anyUtils = anyUtilsFactory.getInstance(anyTypeKind); Any<?> any = anyUtils.dao().authFind(anyKey); if (any == null) { throw new NotFoundException(anyTypeKind + " '" + anyKey + "'"); } ExternalResource resource = resourceDAO.find(resourceKey); if (resource == null) { throw new NotFoundException("Resource '" + resourceKey + "'"); } Provision provision = resource.getProvision(any.getType()).orElseThrow(() -> new NotFoundException("Provision for " + any.getType() + " on Resource '" + resourceKey + "'")); if (provision.getMapping() == null) { throw new NotFoundException("Mapping for " + any.getType() + " on Resource '" + resourceKey + "'"); } return (Pair<Any<?>, Provision>) Pair.of(any, provision); }
} else if (schema.isReadonly()) { LOG.warn("Ignoring read-only {} {}", VirSchema.class.getSimpleName(), vAttr.getSchema()); } else if (anyUtilsFactory.getInstance(any).dao(). findAllowedSchemas(any, VirSchema.class).contains(schema) && virtualResources.contains(schema.getProvision().getResource().getKey())) {
status.set("Pushing " + provision.getAnyType().getKey()); AnyDAO<?> anyDAO = anyUtilsFactory.getInstance(provision.getAnyType().getKind()).dao();
AllowedSchemas<PlainSchema> allowedPlainSchemas = ApplicationContextProvider.getApplicationContext().getBean(AnyUtilsFactory.class). getInstance(any.getType().getKind()).dao().findAllowedSchemas(any, PlainSchema.class);