public class AlertResourceProviderUtils extends Object
Constructor and Description |
---|
AlertResourceProviderUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
hasAuthorization(String serviceName,
Long clusterResourceId,
Set<RoleAuthorization> clusterLevelAuthorizations,
Set<RoleAuthorization> serviceLevelAuthorizations)
Tests if the authenticated user is authorized to for either service- or cluster-level access to
alert data.
|
static boolean |
hasViewAuthorization(AlertGroupEntity entity,
Long clusterResourceId)
Tests if the authenticated user is authorized to view the requested alert data
|
static boolean |
hasViewAuthorization(String serviceName,
Long clusterResourceId)
Tests if the authenticated user is authorized to view service- or cluster-level alert data
|
static void |
verifyAuthorization(AlertDefinitionEntity entity,
Set<RoleAuthorization> clusterLevelAuthorizations,
Set<RoleAuthorization> serviceLevelAuthorizations,
String operation)
Tests if the authenticated user is authorized to for either service- or cluster-level access to
alert data.
|
static void |
verifyAuthorization(String serviceName,
Long clusterResourceId,
Set<RoleAuthorization> clusterLevelAuthorizations,
Set<RoleAuthorization> serviceLevelAuthorizations,
String operation)
Tests if the authenticated user is authorized to for either service- or cluster-level access to
alert data.
|
static void |
verifyExecuteAuthorization(AlertDefinitionEntity entity)
Tests if the authenticated user is authorized to execute service- or cluster-level alert data.
|
static void |
verifyExecuteAuthorization(String serviceName,
Long clusterResourceId)
Tests if the authenticated user is authorized to execute service- or cluster-level alert data.
|
static void |
verifyManageAuthorization(AlertDefinitionEntity entity)
Tests if the authenticated user is authorized to manage service- or cluster-level alert data.
|
static void |
verifyManageAuthorization(AlertGroupEntity entity,
Long clusterResourceId)
Tests if the authenticated user is authorized to manage service- or cluster-level alert data.
|
static void |
verifyManageAuthorization(String serviceName,
Long clusterResourceId)
Tests if the authenticated user is authorized to manage service- or cluster-level alert data.
|
static void |
verifyToggleAuthorization(AlertDefinitionEntity entity)
Tests if the authenticated user is authorized to toggle service- or cluster-level alert data.
|
static void |
verifyToggleAuthorization(String serviceName,
Long clusterResourceId)
Tests if the authenticated user is authorized to toggle service- or cluster-level alert data.
|
static void |
verifyViewAuthorization(AlertCurrentEntity entity)
Tests if the authenticated user is authorized to view service- or cluster-level alert data.
|
static void |
verifyViewAuthorization(AlertDefinitionEntity entity)
Tests if the authenticated user is authorized to view service- or cluster-level alert data.
|
static void |
verifyViewAuthorization(AlertGroupEntity entity,
Long clusterResourceId)
Tests if the authenticated user is authorized to view service- or cluster-level alert data.
|
static void |
verifyViewAuthorization(AlertHistoryEntity entity)
Tests if the authenticated user is authorized to view service- or cluster-level alert data.
|
static void |
verifyViewAuthorization(String serviceName,
Long clusterResourceId)
Tests if the authenticated user is authorized to view service- or cluster-level alert data.
|
public static boolean hasViewAuthorization(AlertGroupEntity entity, Long clusterResourceId)
entity
- an AlertGroupEntityclusterResourceId
- the resource id of the relevant clusterpublic static boolean hasViewAuthorization(String serviceName, Long clusterResourceId)
serviceName
- the name of the relevant service - null or empty indicates a cluster-level alertclusterResourceId
- the resource id of the relevant clusterpublic static void verifyViewAuthorization(AlertCurrentEntity entity) throws AuthorizationException
AuthorizationException
.entity
- an AlertCurrentEntityAuthorizationException
- if the authenticated user is not authorizedpublic static void verifyViewAuthorization(AlertHistoryEntity entity) throws AuthorizationException
AuthorizationException
.entity
- an AlertHistoryEntityAuthorizationException
- if the authenticated user is not authorizedpublic static void verifyViewAuthorization(AlertGroupEntity entity, Long clusterResourceId) throws AuthorizationException
AuthorizationException
.entity
- an AlertGroupEntityclusterResourceId
- the resource id of the relevant clusterAuthorizationException
- if the authenticated user is not authorizedpublic static void verifyViewAuthorization(AlertDefinitionEntity entity) throws AuthorizationException
AuthorizationException
.entity
- an AlertDefinitionEntityAuthorizationException
- if the authenticated user is not authorizedpublic static void verifyViewAuthorization(String serviceName, Long clusterResourceId) throws AuthorizationException
AuthorizationException
.serviceName
- the name of the relevant service - null or empty indicates a cluster-level alertclusterResourceId
- the resource id of the relevant clusterAuthorizationException
- if the authenticated user is not authorizedpublic static void verifyExecuteAuthorization(AlertDefinitionEntity entity) throws AuthorizationException
AuthorizationException
.entity
- an AlertDefinitionEntityAuthorizationException
- if the authenticated user is not authorizedpublic static void verifyExecuteAuthorization(String serviceName, Long clusterResourceId) throws AuthorizationException
AuthorizationException
.serviceName
- the name of the relevant service - null or empty indicates a cluster-level alertclusterResourceId
- the resource id of the relevant clusterAuthorizationException
- if the authenticated user is not authorizedpublic static void verifyToggleAuthorization(AlertDefinitionEntity entity) throws AuthorizationException
AuthorizationException
.entity
- an AlertDefinitionEntityAuthorizationException
- if the authenticated user is not authorizedpublic static void verifyToggleAuthorization(String serviceName, Long clusterResourceId) throws AuthorizationException
AuthorizationException
.serviceName
- the name of the relevant service - null or empty indicates a cluster-level alertclusterResourceId
- the resource id of the relevant clusterAuthorizationException
- if the authenticated user is not authorizedpublic static void verifyManageAuthorization(AlertGroupEntity entity, Long clusterResourceId) throws AuthorizationException
AuthorizationException
.entity
- an AlertGroupEntityclusterResourceId
- the resource id of the relevant clusterAuthorizationException
- if the authenticated user is not authorizedpublic static void verifyManageAuthorization(AlertDefinitionEntity entity) throws AuthorizationException
AuthorizationException
.entity
- an AlertDefinitionEntityAuthorizationException
- if the authenticated user is not authorizedpublic static void verifyManageAuthorization(String serviceName, Long clusterResourceId) throws AuthorizationException
AuthorizationException
.serviceName
- the name of the relevant service - null or empty indicates a cluster-level alertclusterResourceId
- the resource id of the relevant clusterAuthorizationException
- if the authenticated user is not authorizedpublic static boolean hasAuthorization(String serviceName, Long clusterResourceId, Set<RoleAuthorization> clusterLevelAuthorizations, Set<RoleAuthorization> serviceLevelAuthorizations)
serviceName
- the name of the relevant service - null or empty indicates a cluster-level alertclusterResourceId
- the resource id of the relevant clusterclusterLevelAuthorizations
- the set of cluster-level authorizations to check forserviceLevelAuthorizations
- the set of service-level authorizations to check forpublic static void verifyAuthorization(AlertDefinitionEntity entity, Set<RoleAuthorization> clusterLevelAuthorizations, Set<RoleAuthorization> serviceLevelAuthorizations, String operation) throws AuthorizationException
AuthorizationException
.
If the service name from the AlertDefinitionEntity is null or empty, the alert is considered to
be a cluster-level alert, else it is considered to be a service-level alert.entity
- an AlertDefinitionEntityclusterLevelAuthorizations
- the set of cluster-level authorizations to check forserviceLevelAuthorizations
- the set of service-level authorizations to check foroperation
- the name of the operation being tested for (used in error and logging messages)AuthorizationException
- if the authenticated user is not authorizedverifyAuthorization(String, Long, Set, Set, String)
public static void verifyAuthorization(String serviceName, Long clusterResourceId, Set<RoleAuthorization> clusterLevelAuthorizations, Set<RoleAuthorization> serviceLevelAuthorizations, String operation) throws AuthorizationException
AuthorizationException
.
If the service name from the AlertDefinitionEntity is null or empty, the alert is considered to
be a cluster-level alert, else it is considered to be a service-level alert.serviceName
- the name of the relevant service - null or empty indicates a cluster-level alertclusterResourceId
- the resource id of the relevant clusterclusterLevelAuthorizations
- the set of cluster-level authorizations to check forserviceLevelAuthorizations
- the set of service-level authorizations to check foroperation
- the name of the operation being tested for (used in error and logging messages)AuthorizationException
- if the authenticated user is not authorizedCopyright © 2022 Apache Software Foundation. All rights reserved.