public interface TrackablePolicyUtils extends PolicyUtils
Modifier and Type | Field and Description |
---|---|
static String |
AUTH_DETAILS_ADMIN_USER_ID_KEY |
static String |
AUTH_DETAILS_APPLICATION_ACCESS_KEY |
static String |
AUTH_DETAILS_APPLICATIONS_KEY |
static String |
AUTH_DETAILS_CUSTOMER_CONTEXT_IDS |
static String |
AUTH_DETAILS_GLOBAL_KEY |
static String |
AUTH_DETAILS_TENANT_ACCESS_KEY |
static String |
AUTH_DETAILS_TENANT_KEY |
DEFAULT_AUTH_DETAILS_OWNER_ID, log, ROLE_ANONYMOUS
Modifier and Type | Method and Description |
---|---|
boolean |
isAnonymous()
Determine whether or not a user is an anonymous user.
|
boolean |
isCatalogMutable(Application application,
Catalog catalog)
Check if a catalog is mutable, given an application.
|
boolean |
isCatalogVisible(Application application,
Catalog catalog)
Check if a catalog is visible, given an application.
|
boolean |
isGlobalTenantUser()
Whether or not the current user is a global user.
|
boolean |
isMutationPossibleForContext(ContextInfo contextInfo)
Return whether or not the currently identified user has the necessary assigned tenant
relationships to make a mutating operation possible given the requested application, and/or
catalog, and/or lack thereof.
|
boolean |
isOwnerUser(String ownerIdentifier)
Detect whether or not the currently logged in user (if applicable) is a user capable of
operating as a
IdentityType.OWNER . |
boolean |
isUserApplicationLevelAccess()
Whether or not the current user has access to the application level context.
|
boolean |
isUserApplicationRestricted()
Whether or not the current user has any application restrictions.
|
boolean |
isUserTenantLevelAccess()
Whether or not the current user has access to the tenant level context.
|
boolean |
isValidApplicationUser(Application application)
Check if the user described by the current
Authentication is a member of the
application instance provided. |
boolean |
isValidApplicationUser(Application application,
boolean isTenantChange)
Check if the user described by the current
Authentication is a member of the
application instance provided. |
boolean |
isValidApplicationUser(String applicationId)
Version of
isValidApplicationUser(Application) that takes just he application's ID. |
boolean |
isValidApplicationUser(String applicationId,
boolean isTenantChange)
Version of
isValidApplicationUser(Application, boolean) that takes just he
application's ID. |
boolean |
isValidSandboxUser()
Return whether or not the currently identified user is capable of viewing a sandbox context.
|
boolean |
isValidTenantUser(String tenantId,
boolean isTenantLevelContext,
boolean isGlobalChange)
Check if the user described by the current
Authentication is a member of the tenant
instance provided. |
PolicyResponse |
validateContext(ContextInfo contextInfo)
Review the
ContextInfo parameter for valid tenant user membership and valid catalog
visibility based on the current Authentication and requested tenant information in
the contextInfo. |
PolicyResponse |
validateContext(ContextInfo contextInfo,
String[] requiredPermissionRoots,
PermissionMatchingStrategy permissionMatchingStrategy,
OperationType operationType)
Review the
ContextInfo parameter for valid tenant user membership and valid catalog
visibility based on the current Authentication and requested tenant information in
the contextInfo. |
PolicyResponse |
validateDelete(Trackable entity,
ContextInfo contextInfo,
String[] permissionRoots,
PermissionMatchingStrategy strategy)
Validate that before deleting (if the catalog discrimination is in play) that the item's
catalog is both visible to the current application, and mutable.
|
PolicyResponse |
validateInsert(Trackable entity,
ContextInfo contextInfo,
String[] permissionRoots,
PermissionMatchingStrategy strategy)
Validate that before inserting (if catalog discrimination is in play and the current entity
is catalog discriminatable) that the current catalog target for insertion is mutable.
|
PolicyResponse |
validateOther(ContextInfo contextInfo,
String[] permissionRoots,
PermissionMatchingStrategy strategy)
Validate that before misc operation, the required permission is available
|
PolicyResponse |
validateOwner(Object test,
IdentityType[] identityTypes,
String ownerIdentifier)
Validate the object against the currently logged in user.
|
PolicyResponse |
validatePermission(ContextInfo contextInfo,
String[] permissionRoots,
PermissionMatchingStrategy strategy)
Validate the permission against the granted authorities of the current
Authentication . |
PolicyResponse |
validatePermission(String[] permissionRoots,
PermissionMatchingStrategy strategy,
OperationType operationType,
ContextInfo contextInfo)
Validate the permission against the granted authorities of the current
Authentication . |
PolicyResponse |
validateRead(ContextInfo contextInfo,
String[] permissionRoots,
PermissionMatchingStrategy strategy)
Validate that before reading, the required permission is available.
|
PolicyResponse |
validateUpdate(Trackable entity,
ContextInfo contextInfo,
String[] permissionRoots,
PermissionMatchingStrategy strategy)
Validate that before updating (if the catalog discrimination is in play) that the item's
catalog is both visible to the current application, and mutable.
|
getAuthDetailsOwnerIdentifier, getAuthentication, getAuthenticationAttributes, validatePermissions
static final String AUTH_DETAILS_TENANT_ACCESS_KEY
static final String AUTH_DETAILS_APPLICATION_ACCESS_KEY
static final String AUTH_DETAILS_APPLICATIONS_KEY
static final String AUTH_DETAILS_TENANT_KEY
static final String AUTH_DETAILS_CUSTOMER_CONTEXT_IDS
static final String AUTH_DETAILS_GLOBAL_KEY
static final String AUTH_DETAILS_ADMIN_USER_ID_KEY
PolicyResponse validateContext(@Nullable ContextInfo contextInfo)
ContextInfo
parameter for valid tenant user membership and valid catalog
visibility based on the current Authentication
and requested tenant information in
the contextInfo.contextInfo
- the context containing multitenant application, tenant and catalog
informationPolicyResponse validateContext(@Nullable ContextInfo contextInfo, @Nullable String[] requiredPermissionRoots, @Nullable PermissionMatchingStrategy permissionMatchingStrategy, @Nullable OperationType operationType)
ContextInfo
parameter for valid tenant user membership and valid catalog
visibility based on the current Authentication
and requested tenant information in
the contextInfo.
Additionally allows supplying policy requirements to inform validation decisions.
contextInfo
- the context containing multitenant application, tenant and catalog
informationrequiredPermissionRoots
- the permission roots required by the policypermissionMatchingStrategy
- how to validate multiple permissionsoperationType
- the operation type required by the policyboolean isValidSandboxUser()
boolean isMutationPossibleForContext(@Nullable ContextInfo contextInfo)
contextInfo
- The requested contextboolean isValidTenantUser(@Nullable String tenantId, boolean isTenantLevelContext, boolean isGlobalChange)
Authentication
is a member of the tenant
instance provided. This is generally determined by looking at
PolicyUtils.getAuthenticationAttributes()
.tenantId
- The ID of the tenant instance with which to check user membershipisTenantLevelContext
- Whether or not the current context is for the tenant level itselfisGlobalChange
- Whether or not the current change is mutating a "global" resource,
belonging to no particular tenantboolean isUserTenantLevelAccess()
PolicyUtils.getAuthenticationAttributes()
.boolean isValidApplicationUser(Application application)
Authentication
is a member of the
application instance provided. This is generally determined by looking at
PolicyUtils.getAuthenticationAttributes()
.application
- The application instance with which to check user membershipboolean isValidApplicationUser(@NonNull String applicationId)
isValidApplicationUser(Application)
that takes just he application's ID.
If null, that means this is the global application.applicationId
- The ID of the application instance with which to check user membershipboolean isValidApplicationUser(Application application, boolean isTenantChange)
Authentication
is a member of the
application instance provided. This is generally determined by looking at
PolicyUtils.getAuthenticationAttributes()
.application
- The application instance with which to check user membershipisTenantChange
- Whether or not the current mutating change is against a "tenant"
resource, belonging to a tenant but not particular applicationboolean isValidApplicationUser(@Nullable String applicationId, boolean isTenantChange)
isValidApplicationUser(Application, boolean)
that takes just he
application's ID. If null, that means this is the global application.applicationId
- The ID of the application instance with which to check user membershipisTenantChange
- Whether or not the current mutating change is against a "tenant"
resource, belonging to a tenant but not particular applicationboolean isUserApplicationLevelAccess()
PolicyUtils.getAuthenticationAttributes()
.boolean isUserApplicationRestricted()
PolicyUtils.getAuthenticationAttributes()
.boolean isGlobalTenantUser()
PolicyUtils.getAuthenticationAttributes()
.boolean isOwnerUser(@Nullable String ownerIdentifier)
IdentityType.OWNER
. If so, the user may participate in validation for
owned entities. See Policy.identityTypes()
.ownerIdentifier
- The identifier key to use when verifying ownership.IdentityType.OWNER
.DefaultTrackablePolicyUtils.getAuthDetailsOwnerIdentifier()
,
Policy.ownerIdentifier()
,
Owned
boolean isAnonymous()
boolean isCatalogVisible(Application application, Catalog catalog)
Authentication
, especially details *
regarding application membership.application
- The application instance with which to weigh catalog visibility againstcatalog
- The catalog for which visibility status is being checkedboolean isCatalogMutable(Application application, Catalog catalog)
Authentication
, especially details
regarding application membership.application
- The application instance with which to weigh catalog mutability againstcatalog
- The catalog for which mutability status is being checkedPolicyResponse validateInsert(@Nullable Trackable entity, @Nullable ContextInfo contextInfo, @Nullable String[] permissionRoots, @Nullable PermissionMatchingStrategy strategy)
entity
- The item being insertedcontextInfo
- the context containing multitenant application and catalog informationpermissionRoots
- The permission roots to validate. If not specified, then permission
validation will not be performed.strategy
- how to treat multiple permissionsPolicyResponse validateRead(@Nullable ContextInfo contextInfo, @Nullable String[] permissionRoots, @Nullable PermissionMatchingStrategy strategy)
contextInfo
- the context containing multitenant application and catalog informationpermissionRoots
- The permission roots to validate. If not specified, then permission
validation will not be performed.strategy
- how to treat multiple permissionsPolicyResponse validateUpdate(@Nullable Trackable entity, @Nullable ContextInfo contextInfo, @Nullable String[] permissionRoots, @Nullable PermissionMatchingStrategy strategy)
entity
- The item being updatedcontextInfo
- the context containing multitenant application and catalog informationpermissionRoots
- The permission to validate. If not specified, then permission
validation will not be performed.strategy
- how to treat multiple permissionsPolicyResponse validateDelete(@Nullable Trackable entity, @Nullable ContextInfo contextInfo, @Nullable String[] permissionRoots, @Nullable PermissionMatchingStrategy strategy)
entity
- The item being deletedcontextInfo
- the context containing multitenant application and catalog informationpermissionRoots
- The permission roots to validate. If not specified, then permission
validation will not be performed.strategy
- how to treat multiple permissionsPolicyResponse validateOther(@Nullable ContextInfo contextInfo, @Nullable String[] permissionRoots, @Nullable PermissionMatchingStrategy strategy)
contextInfo
- the context containing multitenant application and catalog informationpermissionRoots
- The permission roots to validate. If not specified, then permission
validation will not be performed.strategy
- how to treat multiple permissionsPolicyResponse validatePermission(@Nullable ContextInfo contextInfo, @Nullable String[] permissionRoots, @Nullable PermissionMatchingStrategy strategy)
Authentication
. If not defined, the response will be PolicyResponse.VALID
.contextInfo
- the context containing multitenant application and catalog informationpermissionRoots
- the permission roots requestedstrategy
- how to treat multiple permissionsPolicyResponse validatePermission(@Nullable String[] permissionRoots, @Nullable PermissionMatchingStrategy strategy, OperationType operationType, @Nullable ContextInfo contextInfo)
Authentication
. If neither parameter is defined, the response will be
PolicyResponse.VALID
.permissionRoots
- the permission roots requestedoperationType
- the explicit type of operation to validatecontextInfo
- the context containing multitenant application, tenant and catalog
information. Not used in the default implementation, though custom implementations may
use this for validation purposes.PolicyResponse validateOwner(@Nullable Object test, @Nullable IdentityType[] identityTypes, @Nullable String ownerIdentifier)
PolicyResponse.VALID
. If the test object is provided, but no
identityTypes are provided, the response will be PolicyResponse.NOT_PERMITTED
.
Furthermore, if the identityTypes are provided, and none are of the type
IdentityType.OWNER
, then the response will be PolicyResponse.VALID
.
Otherwise, the identifier from the authenticated user (if applicable) will be compared
against the identifier of the Owned
entity for validation.test
- The entity object to test for ownership agains the currently logged in useridentityTypes
- The type of identities requested for the policy call. Validating
ownership is only applicable against IdentityType.OWNER
.ownerIdentifier
- The identifier key to use when verifying ownership.Owned
,
Policy.ownerIdentifier()
Copyright © 2021. All rights reserved.