From fb87a4386543de5d7cd9fd2b25894465e2eadfb0 Mon Sep 17 00:00:00 2001 From: Patrick Dowler Date: Tue, 15 Oct 2024 13:43:20 -0700 Subject: [PATCH 1/3] cadc-tap-schema: fix output of owner from permission endpoint youcat: fix readOnly mode availability output --- cadc-tap-schema/build.gradle | 2 +- .../nrc/cadc/vosi/actions/GetPermissionsAction.java | 8 ++++---- .../java/org/opencadc/youcat/CatalogTapService.java | 11 +++++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/cadc-tap-schema/build.gradle b/cadc-tap-schema/build.gradle index 5b941c81..8f669c24 100644 --- a/cadc-tap-schema/build.gradle +++ b/cadc-tap-schema/build.gradle @@ -16,7 +16,7 @@ sourceCompatibility = 1.8 group = 'org.opencadc' -version = '1.2.1' +version = '1.2.2' description = 'OpenCADC TAP-1.1 tap schema server library' def git_url = 'https://github.com/opencadc/tap' diff --git a/cadc-tap-schema/src/main/java/ca/nrc/cadc/vosi/actions/GetPermissionsAction.java b/cadc-tap-schema/src/main/java/ca/nrc/cadc/vosi/actions/GetPermissionsAction.java index 6a461693..88ecfc2e 100644 --- a/cadc-tap-schema/src/main/java/ca/nrc/cadc/vosi/actions/GetPermissionsAction.java +++ b/cadc-tap-schema/src/main/java/ca/nrc/cadc/vosi/actions/GetPermissionsAction.java @@ -67,6 +67,8 @@ package ca.nrc.cadc.vosi.actions; +import ca.nrc.cadc.auth.AuthenticationUtil; +import ca.nrc.cadc.auth.IdentityManager; import ca.nrc.cadc.rest.InlineContentHandler; import ca.nrc.cadc.tap.schema.TapPermissions; import ca.nrc.cadc.tap.schema.TapSchemaDAO; @@ -137,10 +139,8 @@ private String getOwnerString(Subject s) { if (s == null) { return ""; } - if (s.getPrincipals(X500Principal.class).size() > 0) { - return s.getPrincipals(X500Principal.class).iterator().next().getName(); - } - return ""; + IdentityManager im = AuthenticationUtil.getIdentityManager(); + return im.toDisplayString(s); } private String getGroupString(GroupURI group) { diff --git a/youcat/src/main/java/org/opencadc/youcat/CatalogTapService.java b/youcat/src/main/java/org/opencadc/youcat/CatalogTapService.java index 2c15432f..0abaed40 100644 --- a/youcat/src/main/java/org/opencadc/youcat/CatalogTapService.java +++ b/youcat/src/main/java/org/opencadc/youcat/CatalogTapService.java @@ -127,13 +127,11 @@ public Availability getStatus() { boolean isGood = true; String note = "service is accepting queries"; try { - String state = getState(); + final String state = getState(); if (RestAction.STATE_OFFLINE.equals(state)) { + // no further checks needed return new Availability(false, RestAction.STATE_OFFLINE_MSG); } - if (RestAction.STATE_READ_ONLY.equals(state)) { - return new Availability(false, RestAction.STATE_READ_ONLY_MSG); - } // ReadWrite: proceed with live checks CheckResource cr; @@ -220,6 +218,11 @@ public Availability getStatus() { } catch (Exception ex) { throw new CheckException("cadc-tap-tmp check: " + ex, ex); } + + if (RestAction.STATE_READ_ONLY.equals(state)) { + isGood = false; + note = RestAction.STATE_READ_ONLY_MSG; + } } catch (CheckException ce) { // tests determined that the resource is not working From a0e1bdc6ce231db0546bbfa89788b29b80739710 Mon Sep 17 00:00:00 2001 From: Patrick Dowler Date: Wed, 16 Oct 2024 10:32:34 -0700 Subject: [PATCH 2/3] fix read-only mode in get permissions action --- .../java/ca/nrc/cadc/vosi/actions/GetPermissionsAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cadc-tap-schema/src/main/java/ca/nrc/cadc/vosi/actions/GetPermissionsAction.java b/cadc-tap-schema/src/main/java/ca/nrc/cadc/vosi/actions/GetPermissionsAction.java index 88ecfc2e..d1c65e8a 100644 --- a/cadc-tap-schema/src/main/java/ca/nrc/cadc/vosi/actions/GetPermissionsAction.java +++ b/cadc-tap-schema/src/main/java/ca/nrc/cadc/vosi/actions/GetPermissionsAction.java @@ -101,7 +101,7 @@ public void doAction() throws Exception { } log.debug("name: " + name); - checkWritable(); + checkReadable(); TapSchemaDAO dao = getTapSchemaDAO(); TapPermissions permissions = null; From 4343ec65e70139ea2a71e39114169c6e3afd948b Mon Sep 17 00:00:00 2001 From: Patrick Dowler Date: Wed, 16 Oct 2024 10:39:08 -0700 Subject: [PATCH 3/3] youcat version 0.7.1 --- youcat/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youcat/VERSION b/youcat/VERSION index 31a7822c..e7135390 100644 --- a/youcat/VERSION +++ b/youcat/VERSION @@ -1,6 +1,6 @@ ## deployable containers have a semantic and build tag # semantic version tag: major.minor # build version tag: timestamp -VER=0.7.0 +VER=0.7.1 TAGS="${VER} ${VER}-$(date --utc +"%Y%m%dT%H%M%S")" unset VER