Skip to content

Commit 5ae6ddd

Browse files
authored
Merge pull request #81 from ORCID/lmendoa/PD-7614-account-recovery-scope
PD-7614 add /orcid-internal/account-recovery scope
2 parents bcb083f + 995696f commit 5ae6ddd

4 files changed

Lines changed: 25 additions & 2 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>org.orcid</groupId>
66
<artifactId>orcid-model</artifactId>
7-
<version>4.0.0</version>
7+
<version>4.0.1</version>
88

99
<name>ORCID - Model</name>
1010
<description>Container for all classes that will be used to marshal and unmarshal XML/JSON from the API</description>

src/main/java/org/orcid/jaxb/model/message/ScopeConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ private ScopeConstants() {
5353
// Internal API
5454
public static final String INTERNAL = "/orcid-internal";
5555
public static final String INTERNAL_PERSON_LAST_MODIFIED = "/orcid-internal/person/last_modified";
56+
public static final String INTERNAL_ACCOUNT_RECOVERY = "/orcid-internal/account-recovery";
5657
public static final String IDENTIFIER_TYPES_CREATE = "/identifier-types/create";
5758

5859
// Salesforce access

src/main/java/org/orcid/jaxb/model/message/ScopePathType.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ public enum ScopePathType implements Serializable {
128128
// Internal scopes
129129
@XmlEnumValue(ScopeConstants.INTERNAL) INTERNAL (ScopeConstants.INTERNAL),
130130
@XmlEnumValue(ScopeConstants.INTERNAL_PERSON_LAST_MODIFIED) INTERNAL_PERSON_LAST_MODIFIED (ScopeConstants.INTERNAL_PERSON_LAST_MODIFIED),
131+
@XmlEnumValue(ScopeConstants.INTERNAL_ACCOUNT_RECOVERY) INTERNAL_ACCOUNT_RECOVERY (ScopeConstants.INTERNAL_ACCOUNT_RECOVERY),
131132

132133
@XmlEnumValue(ScopeConstants.IDENTIFIER_TYPES_CREATE) IDENTIFIER_TYPES_CREATE(ScopeConstants.IDENTIFIER_TYPES_CREATE),
133134

@@ -302,6 +303,7 @@ public boolean isUserGrantWriteScope() {
302303
public boolean isInternalScope() {
303304
switch (this) {
304305
case INTERNAL_PERSON_LAST_MODIFIED:
306+
case INTERNAL_ACCOUNT_RECOVERY:
305307
case INTERNAL:
306308
return true;
307309
default:

src/test/java/org/orcid/jaxb/model/message/ScopePathTypeTest.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,4 +307,24 @@ public void test_OPENID() {
307307
assertTrue(combined.contains(ScopePathType.AUTHENTICATE));
308308
assertTrue(combined.contains(ScopePathType.READ_PUBLIC));
309309
}
310-
}
310+
311+
@Test
312+
public void test_INTERNAL_ACCOUNT_RECOVERY() {
313+
// Test INTERNAL_ACCOUNT_RECOVERY: a leaf scope, it inherits nothing
314+
Set<ScopePathType> combined = ScopePathType.INTERNAL_ACCOUNT_RECOVERY.combined();
315+
assertEquals(1, combined.size());
316+
assertTrue(combined.contains(ScopePathType.INTERNAL_ACCOUNT_RECOVERY));
317+
assertTrue(ScopePathType.INTERNAL_ACCOUNT_RECOVERY.isInternalScope());
318+
assertEquals(ScopePathType.INTERNAL_ACCOUNT_RECOVERY, ScopePathType.fromValue(ScopeConstants.INTERNAL_ACCOUNT_RECOVERY));
319+
}
320+
321+
@Test
322+
public void test_INTERNAL_ACCOUNT_RECOVERY_isNotImpliedByInternal() {
323+
// The nested-looking path must not create inheritance in either direction:
324+
// a client holding /orcid-internal must not be able to use /orcid-internal/account-recovery.
325+
assertFalse(ScopePathType.INTERNAL.hasScope(ScopePathType.INTERNAL_ACCOUNT_RECOVERY));
326+
assertFalse(ScopePathType.INTERNAL_ACCOUNT_RECOVERY.hasScope(ScopePathType.INTERNAL));
327+
assertFalse(ScopePathType.INTERNAL_PERSON_LAST_MODIFIED.hasScope(ScopePathType.INTERNAL_ACCOUNT_RECOVERY));
328+
assertFalse(ScopePathType.INTERNAL_ACCOUNT_RECOVERY.hasScope(ScopePathType.INTERNAL_PERSON_LAST_MODIFIED));
329+
}
330+
}

0 commit comments

Comments
 (0)