diff --git a/client/src/locale/en.js b/client/src/locale/en.js index 0487f9f5..5b00ac7a 100644 --- a/client/src/locale/en.js +++ b/client/src/locale/en.js @@ -390,6 +390,7 @@ const en = { secretTooltip: "The value to use in the X-API-TOKEN header", description: "Description", superUserToken: "Super User token", + organizationGUID: "Organization GUID", descriptionPlaceHolder: "Description for this API token", descriptionTooltip: "A description explaining the use of this API token", deleteFlash: "API token has been deleted", diff --git a/client/src/locale/nl.js b/client/src/locale/nl.js index b69930f6..7dcf9f56 100644 --- a/client/src/locale/nl.js +++ b/client/src/locale/nl.js @@ -389,6 +389,7 @@ const nl = { secretTooltip: "De waarde die je gebruikt in de X-API-TOKEN header", description: "Omschrijving", superUserToken: "Super User token", + organizationGUID: "Organization GUID", descriptionPlaceHolder: "Omschrijving voor dit API-token", descriptionTooltip: "Een omschrijving die de reden voor dit API-token omschrijft", deleteFlash: "API-token is verwijderd", diff --git a/client/src/tabs/Tokens.js b/client/src/tabs/Tokens.js index 38d7fe90..8ce02c4e 100644 --- a/client/src/tabs/Tokens.js +++ b/client/src/tabs/Tokens.js @@ -155,6 +155,11 @@ export const Tokens = () => { header: I18n.t("tokens.createdAt"), mapper: token => dateFromEpoch(token.createdAt) }, + { + key: "organizationGUID", + header: I18n.t("tokens.organizationGUID"), + mapper: token => token.organizationGUID + }, { nonSortable: true, key: "trash", diff --git a/client/src/tabs/Tokens.scss b/client/src/tabs/Tokens.scss index 5679fe85..fd59fca8 100644 --- a/client/src/tabs/Tokens.scss +++ b/client/src/tabs/Tokens.scss @@ -11,7 +11,7 @@ div.mod-tokens { } &.description { - width: 50%; + width: 35%; &.small { width: 25%; @@ -19,14 +19,18 @@ div.mod-tokens { } &.superUserToken { - width: 25%; + width: 15%; text-align: center; } - &.created_at { + &.organizationGUID { width: 25%; } + &.created_at { + width: 15%; + } + &.trash { width: 40px; } @@ -44,6 +48,9 @@ div.mod-tokens { } } } + td.trash { + text-align: center; + } } diff --git a/server/src/main/java/access/model/APIToken.java b/server/src/main/java/access/model/APIToken.java index d668db42..90021e2c 100644 --- a/server/src/main/java/access/model/APIToken.java +++ b/server/src/main/java/access/model/APIToken.java @@ -21,7 +21,6 @@ public class APIToken implements Serializable { private Long id; @Column(name = "organization_guid") - @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) private String organizationGUID; @Column(name = "hashed_value") diff --git a/server/src/test/java/access/api/APITokenControllerTest.java b/server/src/test/java/access/api/APITokenControllerTest.java index d611d749..3beafa43 100644 --- a/server/src/test/java/access/api/APITokenControllerTest.java +++ b/server/src/test/java/access/api/APITokenControllerTest.java @@ -62,7 +62,7 @@ void create() throws Exception { .as(new TypeRef<>() { }); assertNull(apiToken.getHashedValue()); - assertNull(apiToken.getOrganizationGUID()); + assertEquals(ORGANISATION_GUID, apiToken.getOrganizationGUID()); assertEquals("test", apiToken.getDescription()); APIToken apiTokenFromDB = apiTokenRepository.findById(apiToken.getId()).get(); @@ -160,8 +160,10 @@ void apiTokensBySuperAdmin() throws Exception { .get("/api/v1/tokens") .as(new TypeRef<>() { }); - assertEquals(1, tokens.size()); - assertTrue(tokens.get(0).isSuperUserToken()); + + assertEquals(2, tokens.size()); + assertEquals(1L, tokens.stream().filter(token -> token.isSuperUserToken()).count()); + assertEquals(1L, tokens.stream().filter(token -> token.getOrganizationGUID() != null).count()); } @Test