Interface VendorVisibilityManager
- All Known Implementing Classes:
DefaultVendorVisibilityManager
Ultimately, the purpose of this component is to inject all VendorVisibilityHandler
beans,
and then delegate to the one that supports performing a given operation on a particular entity.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncreateVendorNarrowingFilter
(Class<?> persistedDomainEntityTypeBeingRead, Set<String> restrictedVendorRefs, ContextInfo contextInfo) Given apersistedDomainEntityTypeBeingRead
that is being read in a query, return aNode
filter string for it that restricts results to only include data from therestrictedVendorRefs
.getAssociatedVendorRef
(Object persistedDomainEntity, ContextInfo contextInfo) Given apersistedDomainEntity
, determine what vendor it is associated to (if any).boolean
isEntityMutableByVendorRestrictions
(Object persistedDomainEntity, Set<String> restrictedVendorRefs, ContextInfo contextInfo) Given apersistedDomainEntity
, report whether that entity is mutable by the given vendor restrictions.boolean
supportsVendorDiscrimination
(Class<?> persistedDomainEntityType) Ultimately reports whether this manager has aVendorVisibilityHandler
which can support the providedpersistedDomainEntityType
.
-
Method Details
-
supportsVendorDiscrimination
Ultimately reports whether this manager has aVendorVisibilityHandler
which can support the providedpersistedDomainEntityType
.This can be useful to determine whether an entity should participate in vendor-discrimination behavior.
- Parameters:
persistedDomainEntityType
- the persisted-domain entity type for which to check vendor-handling support- Returns:
true
if there is aVendorVisibilityHandler
which can handle the entity,false
otherwise
-
isEntityMutableByVendorRestrictions
boolean isEntityMutableByVendorRestrictions(Object persistedDomainEntity, Set<String> restrictedVendorRefs, @Nullable ContextInfo contextInfo) Given apersistedDomainEntity
, report whether that entity is mutable by the given vendor restrictions.This is particularly useful to validate whether an entity can be inserted or updated by a vendor-restricted authentication.
If no
VendorVisibilityHandler
supports this operation for the givenpersistedDomainEntity
,true
will be returned with the assumption that there is no visibility check that needs to be performed.- Parameters:
persistedDomainEntity
- the persisted-domain entity to validate visibility forrestrictedVendorRefs
- the "vendorRef" (typically a vendor ID or code) of all vendors that visibility should be restricted to. Cannot be empty.contextInfo
- context information surrounding sandboxing/multitenant state- Returns:
- true if the entity is visible by the given vendor restrictions, false otherwise
- See Also:
-
createVendorNarrowingFilter
@Nullable String createVendorNarrowingFilter(Class<?> persistedDomainEntityTypeBeingRead, Set<String> restrictedVendorRefs, @Nullable ContextInfo contextInfo) Given apersistedDomainEntityTypeBeingRead
that is being read in a query, return aNode
filter string for it that restricts results to only include data from therestrictedVendorRefs
.This is particularly useful to prevent vendor-restricted authentications from accessing data outside of their allowed vendors.
If no
VendorVisibilityHandler
supports this operation for the givenpersistedDomainEntityTypeBeingRead
,null
will be returned with the assumption that there is no filtration that needs to be performed for that entity.- Parameters:
persistedDomainEntityTypeBeingRead
- the persisted-domain entity type for which to produce a vendor-narrowing filterrestrictedVendorRefs
- the "vendorRef" (typically a vendor ID or code) of all vendors that the results need to be restricted to. Cannot be empty.contextInfo
- context information surrounding sandboxing/multitenant state. Some implementations may inform their filtration decisions with this.- Returns:
- a
Node
filter string that can be used to restrict results to only include data from therestrictedVendorRefs
. Alternatively, returnnull
if the handlers shouldn't/can't produce a filter for the given inputs. - See Also:
-
getAssociatedVendorRef
@Nullable String getAssociatedVendorRef(Object persistedDomainEntity, @Nullable ContextInfo contextInfo) Given apersistedDomainEntity
, determine what vendor it is associated to (if any).If no
VendorVisibilityHandler
supports this operation for the givenpersistedDomainEntity
,null
will be returned with the assumption that there is no associated vendor.- Parameters:
persistedDomainEntity
- the persisted-domain entity to determine the vendor association forcontextInfo
- context information surrounding multitenant state- Returns:
- the vendorRef that the given entity is associated to, or
null
if not associated to a vendor - See Also:
-