airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata] branch group-based-auth updated: AIRAVATA-2774 Remove everyone group
Date Mon, 04 Jun 2018 18:36:18 GMT
This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch group-based-auth
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/group-based-auth by this push:
     new 0174bac  AIRAVATA-2774 Remove everyone group
0174bac is described below

commit 0174bac0b958855070f69c5c2cf53d14ab395c19
Author: Marcus Christie <machristie@apache.org>
AuthorDate: Mon Jun 4 14:21:03 2018 -0400

    AIRAVATA-2774 Remove everyone group
---
 .../api/server/handler/AiravataServerHandler.java     | 14 --------------
 .../registry/server/SharingRegistryServerHandler.java | 19 -------------------
 .../registry/SharingRegistryServerHandlerTest.java    | 10 +++++-----
 3 files changed, 5 insertions(+), 38 deletions(-)

diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 3ef8690..285b890 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -368,20 +368,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             permissionType.setDescription("Write permission type");
             sharingClient.createPermissionType(permissionType);
 
-            //Create an "everyone" group for the domain
-            String groupId = "everyone@" + domain.domainId;
-            UserGroup userGroup = new UserGroup();
-            userGroup.setGroupId(groupId);
-            userGroup.setDomainId(domain.domainId);
-            userGroup.setGroupCardinality(GroupCardinality.MULTI_USER);
-            userGroup.setCreatedTime(System.currentTimeMillis());
-            userGroup.setUpdatedTime(System.currentTimeMillis());
-            userGroup.setOwnerId(authzToken.getClaimsMap().get(Constants.USER_NAME) + "@"
+ domain.domainId);
-            userGroup.setName("everyone");
-            userGroup.setDescription("Default Group");
-            userGroup.setGroupType(GroupType.DOMAIN_LEVEL_GROUP);
-            sharingClient.createGroup(userGroup);
-
             registryClientPool.returnResource(registryClient);
             sharingClientPool.returnResource(sharingClient);
 
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
index 13c8191..d5c8267 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
+++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
@@ -164,25 +164,6 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
             userGroup.setGroupCardinality(GroupCardinality.SINGLE_USER);
             (new UserGroupRepository()).create(userGroup);
 
-            // Add user to the domain's "everyone" group
-            String groupId = "everyone@" + user.domainId;
-            if (isGroupExists(user.domainId, groupId)) {
-                addUsersToGroup(user.domainId, Arrays.asList(user.userId), groupId);
-            }
-            else {
-                //Create an "everyone" group for the domain
-                UserGroup everyone = new UserGroup();
-                everyone.setGroupId(groupId);
-                everyone.setDomainId(user.domainId);
-                everyone.setGroupCardinality(GroupCardinality.MULTI_USER);
-                everyone.setCreatedTime(System.currentTimeMillis());
-                everyone.setUpdatedTime(System.currentTimeMillis());
-                everyone.setOwnerId(user.userId);
-                everyone.setName("everyone");
-                everyone.setDescription("Default Group");
-                everyone.setGroupType(GroupType.DOMAIN_LEVEL_GROUP);
-                createGroup(everyone);
-            }
 
             return user.userId;
         }catch (Throwable ex) {
diff --git a/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServerHandlerTest.java
b/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServerHandlerTest.java
index c44b02f..2959d98 100644
--- a/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServerHandlerTest.java
+++ b/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServerHandlerTest.java
@@ -110,7 +110,7 @@ public class SharingRegistryServerHandlerTest {
         userGroup1.setUpdatedTime(System.currentTimeMillis());
 
         Assert.assertNotNull(sharingRegistryServerHandler.createGroup(userGroup1));
-        Assert.assertTrue(sharingRegistryServerHandler.getAllMemberGroupsForUser(domainId,
userId1).size() == 2);
+        Assert.assertEquals(1, sharingRegistryServerHandler.getAllMemberGroupsForUser(domainId,
userId1).size());
 
         UserGroup userGroup2 = new UserGroup();
         String groupName2 = "test-group-2." + System.currentTimeMillis();
@@ -130,7 +130,7 @@ public class SharingRegistryServerHandlerTest {
         sharingRegistryServerHandler.addUsersToGroup(domainId, Arrays.asList(userId1), groupId1);
 
         sharingRegistryServerHandler.addUsersToGroup(domainId, Arrays.asList(userId2, userId3),
groupId2);
-        Assert.assertTrue(sharingRegistryServerHandler.getAllMemberGroupsForUser(domainId,
userId3).size() == 2);
+        Assert.assertEquals(1, sharingRegistryServerHandler.getAllMemberGroupsForUser(domainId,
userId3).size());
 
         sharingRegistryServerHandler.addChildGroupsToParentGroup(domainId, Arrays.asList(groupId2),
groupId1);
 
@@ -306,11 +306,11 @@ public class SharingRegistryServerHandlerTest {
         Assert.assertNotNull(entityId5);
 
         sharingRegistryServerHandler.shareEntityWithUsers(domainId, entityId5, Arrays.asList(userId2),
permissionTypeId1, true);
-        sharingRegistryServerHandler.shareEntityWithGroups(domainId, entityId5, Arrays.asList(groupId2),
permissionTypeId3, true);
+        sharingRegistryServerHandler.shareEntityWithGroups(domainId, entityId5, Arrays.asList(groupId2),
permissionTypeId2, true);
 
-        Assert.assertTrue(sharingRegistryServerHandler.userHasAccess(domainId, userId3, entityId5,
permissionTypeId3));
+        Assert.assertTrue(sharingRegistryServerHandler.userHasAccess(domainId, userId3, entityId5,
permissionTypeId2));
         Assert.assertTrue(sharingRegistryServerHandler.userHasAccess(domainId, userId2, entityId5,
permissionTypeId1));
-        Assert.assertFalse(sharingRegistryServerHandler.userHasAccess(domainId, userId3,
entityId5, permissionTypeId2));
+        Assert.assertFalse(sharingRegistryServerHandler.userHasAccess(domainId, userId3,
entityId5, permissionTypeId1));
 
         ArrayList<SearchCriteria> filters = new ArrayList<>();
         SearchCriteria searchCriteria = new SearchCriteria();

-- 
To stop receiving notification emails like this one, please contact
machristie@apache.org.

Mime
View raw message