-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:opencb/opencga into develop
- Loading branch information
Showing
4 changed files
with
74 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
package org.opencb.opencga.catalog.managers; | ||
|
||
import com.mongodb.BasicDBObject; | ||
import org.apache.commons.collections4.CollectionUtils; | ||
import org.apache.commons.lang3.RandomStringUtils; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.junit.Ignore; | ||
|
@@ -256,6 +257,65 @@ public void testGetUserInfo() throws CatalogException { | |
studyAdminToken1); | ||
} | ||
|
||
@Test | ||
public void testGetProjectsFromUserInfo() throws CatalogException { | ||
String userId = organizationId; | ||
catalogManager.getUserManager().create(userId, "test", "[email protected]", TestParamConstants.PASSWORD, organizationId, null, | ||
opencgaToken); | ||
catalogManager.getStudyManager().updateGroup(studyFqn, ParamConstants.MEMBERS_GROUP, ParamUtils.BasicUpdateAction.ADD, | ||
new GroupUpdateParams(Collections.singletonList("test")), ownerToken); | ||
String token = catalogManager.getUserManager().login(organizationId, userId, TestParamConstants.PASSWORD).getToken(); | ||
|
||
DataResult<User> user = catalogManager.getUserManager().get(organizationId, userId, new QueryOptions(), token); | ||
assertTrue(CollectionUtils.isNotEmpty(user.first().getProjects())); | ||
System.out.println(user.first().getProjects().size()); | ||
|
||
user = catalogManager.getUserManager().get(organizationId, normalUserId3, new QueryOptions(), normalToken3); | ||
assertTrue(CollectionUtils.isNotEmpty(user.first().getProjects())); | ||
System.out.println(user.first().getProjects().size()); | ||
|
||
user = catalogManager.getUserManager().get(organizationId, orgOwnerUserId, new QueryOptions(), ownerToken); | ||
assertTrue(CollectionUtils.isNotEmpty(user.first().getProjects())); | ||
System.out.println(user.first().getProjects().size()); | ||
|
||
user = catalogManager.getUserManager().get(organizationId, orgAdminUserId1, new QueryOptions(), orgAdminToken1); | ||
assertTrue(CollectionUtils.isNotEmpty(user.first().getProjects())); | ||
System.out.println(user.first().getProjects().size()); | ||
|
||
user = catalogManager.getUserManager().get(organizationId, studyAdminUserId1, new QueryOptions(), studyAdminToken1); | ||
assertTrue(CollectionUtils.isNotEmpty(user.first().getProjects())); | ||
System.out.println(user.first().getProjects().size()); | ||
|
||
user = catalogManager.getUserManager().get(organizationId, normalUserId1, new QueryOptions(), orgAdminToken1); | ||
assertTrue(CollectionUtils.isNotEmpty(user.first().getProjects())); | ||
System.out.println(user.first().getProjects().size()); | ||
|
||
|
||
user = catalogManager.getUserManager().get(null, normalUserId1, new QueryOptions(), normalToken1); | ||
assertTrue(CollectionUtils.isNotEmpty(user.first().getProjects())); | ||
System.out.println(user.first().getProjects().size()); | ||
|
||
user = catalogManager.getUserManager().get(null, normalUserId3, new QueryOptions(), normalToken3); | ||
assertTrue(CollectionUtils.isNotEmpty(user.first().getProjects())); | ||
System.out.println(user.first().getProjects().size()); | ||
|
||
user = catalogManager.getUserManager().get(null, orgOwnerUserId, new QueryOptions(), ownerToken); | ||
assertTrue(CollectionUtils.isNotEmpty(user.first().getProjects())); | ||
System.out.println(user.first().getProjects().size()); | ||
|
||
user = catalogManager.getUserManager().get(null, orgAdminUserId1, new QueryOptions(), orgAdminToken1); | ||
assertTrue(CollectionUtils.isNotEmpty(user.first().getProjects())); | ||
System.out.println(user.first().getProjects().size()); | ||
|
||
user = catalogManager.getUserManager().get(null, studyAdminUserId1, new QueryOptions(), studyAdminToken1); | ||
assertTrue(CollectionUtils.isNotEmpty(user.first().getProjects())); | ||
System.out.println(user.first().getProjects().size()); | ||
|
||
user = catalogManager.getUserManager().get(null, normalUserId1, new QueryOptions(), orgAdminToken1); | ||
assertTrue(CollectionUtils.isNotEmpty(user.first().getProjects())); | ||
System.out.println(user.first().getProjects().size()); | ||
} | ||
|
||
@Test | ||
public void testModifyUser() throws CatalogException, InterruptedException, IOException { | ||
ObjectMap params = new ObjectMap(); | ||
|