Example #1
0
  /**
   * Adds the required criteria for authorization to the query for sites and series security groups
   *
   * @param query
   */
  public void authorizeSitesAndSSGs(DICOMQuery query) {
    AuthorizationCriteria auth = query.getAuthorizationCriteria();

    if (auth == null) {
      // Add authorization criteria if it does not
      // already exist
      auth = new AuthorizationCriteria();
      query.setCriteria(auth);
    }

    auth.setSeriesSecurityGroups(getAuthorizedSeriesSecurityGroups());
    auth.setSites(getAuthorizedSites());
  }
  private static AuthorizationCriteria createAuthorizationCriteria() throws Exception {
    AuthorizationManager am = new AuthorizationManager("kascice");
    List<SiteData> authorizedSites = am.getAuthorizedSites(RoleType.READ);
    List<String> authorizedCollections = am.getAuthorizedCollections(RoleType.READ);
    List<String> authorizedSeriesSecurityGroups =
        am.getAuthorizedSeriesSecurityGroups(RoleType.READ);

    AuthorizationCriteria authorizationCriteria = new AuthorizationCriteria();
    authorizationCriteria.setCollections(authorizedCollections);
    authorizationCriteria.setSites(authorizedSites);
    authorizationCriteria.setSeriesSecurityGroups(authorizedSeriesSecurityGroups);

    return authorizationCriteria;
  }