public static void verifyAuthorization(AlertDefinitionEntity entity,
                                         Set<RoleAuthorization> clusterLevelAuthorizations,
                                         Set<RoleAuthorization> serviceLevelAuthorizations,
                                         String operation) throws AuthorizationException {
    ClusterEntity clusterEntity = (null == entity) ? null : entity.getCluster();
    ResourceEntity resourceEntity = (null == clusterEntity) ? null : clusterEntity.getResource();
    Long resourceId = (null == resourceEntity) ? null : resourceEntity.getId();

    verifyAuthorization((null == entity) ? null : entity.getServiceName(), resourceId,
        clusterLevelAuthorizations, serviceLevelAuthorizations, operation);
  }
Tests if the authenticated user is authorized to for either service- or cluster-level access to
alert data. An authorization failure results in a thrown {@link AuthorizationException}.
<p/>
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.

@param entity                     an AlertDefinitionEntity
@param clusterLevelAuthorizations the set of cluster-level authorizations to check for
@param serviceLevelAuthorizations the set of service-level authorizations to check for
@param operation                  the name of the operation being tested for (used in error and logging messages)
@throws AuthorizationException if the authenticated user is not authorized
@see #verifyAuthorization(String, Long, Set, Set, String)
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertResourceProviderUtils.java