diff --git a/src/intTest/java/com/box/sdk/BoxFolderIT.java b/src/intTest/java/com/box/sdk/BoxFolderIT.java index f3327eac8..130a870b7 100644 --- a/src/intTest/java/com/box/sdk/BoxFolderIT.java +++ b/src/intTest/java/com/box/sdk/BoxFolderIT.java @@ -262,6 +262,32 @@ public void updateFolderInfoSucceeds() { } } + @Test + public void updateCanNonOwnersViewCollaboratorsSucceeds() { + BoxAPIConnection api = jwtApiForServiceAccount(); + BoxFolder rootFolder = getUniqueFolder(api); + final String name = "[updateCanNonOwnersViewCollaboratorsSucceeds] Child Folder"; + BoxFolder childFolder = null; + + try { + BoxFolder.Info info = rootFolder.createFolder(name); + childFolder = info.getResource(); + boolean getCanNonOwnersViewCollaborators = childFolder.getInfo("can_non_owners_view_collaborators") + .getCanNonOwnersViewCollaborators(); + // need to set both + info.setCanNonOwnersViewCollaborators(!getCanNonOwnersViewCollaborators); + info.setCanNonOwnersInvite(!getCanNonOwnersViewCollaborators); + childFolder.updateInfo(info); + + assertThat(info.getCanNonOwnersViewCollaborators(), equalTo(!getCanNonOwnersViewCollaborators)); + assertThat(info.getCanNonOwnersInvite(), equalTo(!getCanNonOwnersViewCollaborators)); + } finally { + this.deleteFolder(childFolder); + assertThat(rootFolder, + not(hasItem(Matchers.hasProperty("ID", equalTo(childFolder.getID()))))); + } + } + @Test public void copyFolderToSameDestinationWithNewNameSucceeds() { BoxAPIConnection api = jwtApiForServiceAccount(); diff --git a/src/main/java/com/box/sdk/BoxFolder.java b/src/main/java/com/box/sdk/BoxFolder.java index 799fbbff9..971977acb 100644 --- a/src/main/java/com/box/sdk/BoxFolder.java +++ b/src/main/java/com/box/sdk/BoxFolder.java @@ -43,7 +43,7 @@ public class BoxFolder extends BoxItem implements Iterable { "item_status", "item_collection", "sync_state", "has_collaborations", "permissions", "tags", "can_non_owners_invite", "collections", "watermark_info", "metadata", "is_externally_owned", "is_collaboration_restricted_to_enterprise", "allowed_shared_link_access_levels", "allowed_invitee_roles", - "is_accessible_via_shared_link" + "is_accessible_via_shared_link", "can_non_owners_view_collaborators" }; /** * Create Folder URL Template. @@ -1467,6 +1467,7 @@ public class Info extends BoxItem.Info { private BoxClassification classification; private boolean isAccessibleViaSharedLink; + private boolean canNonOwnersViewCollaborators; /** * Constructs an empty Info object. @@ -1668,6 +1669,29 @@ public boolean getIsAccessibleViaSharedLink() { return this.isAccessibleViaSharedLink; } + /** + * Returns the flag indicating if collaborators who are not owners of this folder + * are restricted from viewing other collaborations on this folder. + * + * @return boolean flag indicating if collaborators who are not owners of this folder + * are restricted from viewing other collaborations on this folder. + */ + public boolean getCanNonOwnersViewCollaborators() { + return this.canNonOwnersViewCollaborators; + } + + /** + * Sets whether collaborators who are not owners of this folder + * are restricted from viewing other collaborations on this folder. + * + * @param canNonOwnersViewCollaborators indicates if collaborators who are not owners of this folder + * are restricted from viewing other collaborations on this folderr. + */ + public void setCanNonOwnersViewCollaborators(boolean canNonOwnersViewCollaborators) { + this.canNonOwnersViewCollaborators = canNonOwnersViewCollaborators; + this.addPendingChange("can_non_owners_view_collaborators", canNonOwnersViewCollaborators); + } + @Override public BoxFolder getResource() { @@ -1729,6 +1753,9 @@ protected void parseJSONMember(JsonObject.Member member) { case "is_accessible_via_shared_link": this.isAccessibleViaSharedLink = value.asBoolean(); break; + case "can_non_owners_view_collaborators": + this.canNonOwnersViewCollaborators = value.asBoolean(); + break; default: break; } diff --git a/src/test/Fixtures/BoxFolder/GetFolderInfo200.json b/src/test/Fixtures/BoxFolder/GetFolderInfo200.json index 4a633a99a..3bb8b5703 100644 --- a/src/test/Fixtures/BoxFolder/GetFolderInfo200.json +++ b/src/test/Fixtures/BoxFolder/GetFolderInfo200.json @@ -116,5 +116,6 @@ "can_set_share_access": true, "can_share": true, "can_upload": true - } + }, + "can_non_owners_view_collaborators": true } diff --git a/src/test/java/com/box/sdk/BoxFolderTest.java b/src/test/java/com/box/sdk/BoxFolderTest.java index d2ebbcbeb..af297dffa 100644 --- a/src/test/java/com/box/sdk/BoxFolderTest.java +++ b/src/test/java/com/box/sdk/BoxFolderTest.java @@ -553,6 +553,7 @@ public void testGetFolderInfoSucceeds() { assertEquals(classificationDefinition, info.getClassification().getDefinition()); assertEquals(classificationName, info.getClassification().getName()); assertTrue(info.getIsAccessibleViaSharedLink()); + assertTrue(info.getCanNonOwnersViewCollaborators()); } @Test