airavata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AIRAVATA-2725) GroupManagerService: add list of admins to GroupModel
Date Tue, 17 Jul 2018 20:52:00 GMT

    [ https://issues.apache.org/jira/browse/AIRAVATA-2725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16547090#comment-16547090
] 

ASF GitHub Bot commented on AIRAVATA-2725:
------------------------------------------

machristie closed pull request #198: [AIRAVATA-2725] : GroupManagerService - add list of admins
to GroupModel
URL: https://github.com/apache/airavata/pull/198
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/entities/GroupAdminEntity.java
b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/entities/GroupAdminEntity.java
index 26851b34e1..1a86837514 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/entities/GroupAdminEntity.java
+++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/entities/GroupAdminEntity.java
@@ -13,6 +13,7 @@
     private String groupId;
     private String domainId;
     private String adminId;
+    private UserGroupEntity userGroup;
 
     @Id
     @Column(name = "GROUP_ID")
@@ -44,6 +45,19 @@ public void setAdminId(String adminId) {
         this.adminId = adminId;
     }
 
+    @ManyToOne(targetEntity = UserGroupEntity.class, cascade = CascadeType.MERGE)
+    @JoinColumns({
+            @JoinColumn(name="GROUP_ID", referencedColumnName="GROUP_ID"),
+            @JoinColumn(name="DOMAIN_ID", referencedColumnName="DOMAIN_ID")
+    })
+    public UserGroupEntity getUserGroup() {
+        return userGroup;
+    }
+
+    public void setUserGroup(UserGroupEntity userGroup) {
+        this.userGroup = userGroup;
+    }
+
     @Override
     public boolean equals(Object o) {
         if (this == o) return true;
diff --git a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/entities/UserGroupEntity.java
b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/entities/UserGroupEntity.java
index 1168ff8014..4b2393465c 100644
--- a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/entities/UserGroupEntity.java
+++ b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/entities/UserGroupEntity.java
@@ -23,6 +23,7 @@
 import org.slf4j.LoggerFactory;
 
 import javax.persistence.*;
+import java.util.List;
 
 @Entity
 @Table(name = "USER_GROUP", schema = "")
@@ -38,6 +39,7 @@
     private String groupCardinality;
     private Long createdTime;
     private Long updatedTime;
+    private List<GroupAdminEntity> groupAdmins;
 
     @Id
     @Column(name = "GROUP_ID")
@@ -129,6 +131,16 @@ public void setUpdatedTime(Long updatedTime) {
         this.updatedTime = updatedTime;
     }
 
+    @OneToMany(targetEntity = GroupAdminEntity.class, cascade = CascadeType.ALL,
+            mappedBy = "userGroup", fetch = FetchType.EAGER)
+    public List<GroupAdminEntity> getGroupAdmins() {
+        return groupAdmins;
+    }
+
+    public void setGroupAdmins(List<GroupAdminEntity> groupAdmins) {
+        this.groupAdmins = groupAdmins;
+    }
+
     @Override
     public boolean equals(Object o) {
         if (this == o) return true;
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 d5c82677cd..f596f58435 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
@@ -276,6 +276,8 @@ public String createGroup(UserGroup group) throws SharingRegistryException,
TExc
             group.setGroupCardinality(GroupCardinality.MULTI_USER);
             group.setCreatedTime(System.currentTimeMillis());
             group.setUpdatedTime(System.currentTimeMillis());
+            //Add group admins once the group is created
+            group.unsetGroupAdmins();
             (new UserGroupRepository()).create(group);
 
             addUsersToGroup(group.domainId, Arrays.asList(group.ownerId), group.groupId);
@@ -464,7 +466,12 @@ private boolean isUserBelongsToGroup(List<User> groupUser, String
newOwnerId) {
     @Override
     public boolean addGroupAdmins(String domainId, String groupId, List<String> adminIds)
throws SharingRegistryException, TException {
         try{
+            List<User> groupUser = getGroupMembersOfTypeUser(domainId, groupId, 0,
-1);
+
             for (String adminId: adminIds) {
+                if (! isUserBelongsToGroup(groupUser, adminId)) {
+                    throw new SharingRegistryException("Admin not the user of the group.
GroupId : "+ groupId + ", AdminId : "+ adminId);
+                }
                 GroupAdminPK groupAdminPK = new GroupAdminPK();
                 groupAdminPK.setGroupId(groupId);
                 groupAdminPK.setAdminId(adminId);
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 2959d988fe..72e1f5a284 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
@@ -93,6 +93,17 @@ public void test() throws TException, ApplicationSettingsException {
 
         Assert.assertNotNull(sharingRegistryServerHandler.createUser(user3));
 
+        User user7 = new User();
+        String userName7 = "test-user-7." + System.currentTimeMillis();
+        String userId7 = domainId + ":" + userName7;
+        user7.setUserId(userId7);
+        user7.setUserName(userName7);
+        user7.setDomainId(domainId);
+        user7.setCreatedTime(System.currentTimeMillis());
+        user7.setUpdatedTime(System.currentTimeMillis());
+
+        Assert.assertNotNull(sharingRegistryServerHandler.createUser(user7));
+
         Assert.assertTrue(sharingRegistryServerHandler.getUsers(domainId, 0, 10).size() >
0);
 
         // Creating user groups
@@ -128,6 +139,7 @@ public void test() throws TException, ApplicationSettingsException {
         Assert.assertNotNull(sharingRegistryServerHandler.createGroup(userGroup2));
 
         sharingRegistryServerHandler.addUsersToGroup(domainId, Arrays.asList(userId1), groupId1);
+        sharingRegistryServerHandler.addUsersToGroup(domainId, Arrays.asList(userId7), groupId1);
 
         sharingRegistryServerHandler.addUsersToGroup(domainId, Arrays.asList(userId2, userId3),
groupId2);
         Assert.assertEquals(1, sharingRegistryServerHandler.getAllMemberGroupsForUser(domainId,
userId3).size());
@@ -143,10 +155,10 @@ public void test() throws TException, ApplicationSettingsException {
         Assert.assertTrue(sharingRegistryServerHandler.hasOwnerAccess(domainId, groupId1,
userId1));
 
         // user has admin access
-        Assert.assertTrue(sharingRegistryServerHandler.addGroupAdmins(domainId, groupId1,
Arrays.asList(userId2)));
-        Assert.assertTrue(sharingRegistryServerHandler.hasAdminAccess(domainId, groupId1,
userId2));
-        Assert.assertTrue(sharingRegistryServerHandler.removeGroupAdmins(domainId, groupId1,
Arrays.asList(userId2)));
-        Assert.assertFalse(sharingRegistryServerHandler.hasAdminAccess(domainId, groupId1,
userId2));
+        Assert.assertTrue(sharingRegistryServerHandler.addGroupAdmins(domainId, groupId1,
Arrays.asList(userId7)));
+        Assert.assertTrue(sharingRegistryServerHandler.hasAdminAccess(domainId, groupId1,
userId7));
+        Assert.assertTrue(sharingRegistryServerHandler.removeGroupAdmins(domainId, groupId1,
Arrays.asList(userId7)));
+        Assert.assertFalse(sharingRegistryServerHandler.hasAdminAccess(domainId, groupId1,
userId7));
 
         // transfer group ownership
         sharingRegistryServerHandler.addUsersToGroup(domainId, Arrays.asList(userId2), groupId1);
diff --git a/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
b/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
index bc6671b8ce..8192378386 100644
--- a/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
+++ b/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
@@ -139,6 +139,25 @@ public void test() throws TException, InterruptedException, ApplicationSettingsE
 
         sharingServiceClient.createUser(user3);
 
+        User user7 = new User();
+        //required
+        user7.setUserId("test-user-7");
+        //required
+        user7.setUserName("test-user-7");
+        //required
+        user7.setDomainId(domainId);
+        //required
+        user7.setFirstName("John");
+        //required
+        user7.setLastName("Doe");
+        //required
+        user7.setEmail("john.doe@abc.com");
+        //optional - this should be bytes of the users image icon
+        //byte[] icon3 = new byte[10];
+        //user3.setIcon(icon3);
+
+        sharingServiceClient.createUser(user7);
+
         UserGroup userGroup1 = new UserGroup();
         //required
         userGroup1.setGroupId("test-group-1");
@@ -177,16 +196,22 @@ public void test() throws TException, InterruptedException, ApplicationSettingsE
 
         sharingServiceClient.addUsersToGroup(domainId, Arrays.asList("test-user-3"), "test-group-2");
 
+        sharingServiceClient.addUsersToGroup(domainId, Arrays.asList("test-user-7"), "test-group-1");
+
         sharingServiceClient.addChildGroupsToParentGroup(domainId, Arrays.asList("test-group-2"),
"test-group-1");
 
         //Group roles
         Assert.assertTrue(sharingServiceClient.hasOwnerAccess(domainId, "test-group-1", "test-user-1"));
 
         // user has admin access
-        Assert.assertTrue(sharingServiceClient.addGroupAdmins(domainId, "test-group-1", Arrays.asList("test-user-2")));
-        Assert.assertTrue(sharingServiceClient.hasAdminAccess(domainId, "test-group-1", "test-user-2"));
-        Assert.assertTrue(sharingServiceClient.removeGroupAdmins(domainId, "test-group-1",
Arrays.asList("test-user-2")));
-        Assert.assertFalse(sharingServiceClient.hasAdminAccess(domainId, "test-group-1",
"test-user-2"));
+        Assert.assertTrue(sharingServiceClient.addGroupAdmins(domainId, "test-group-1", Arrays.asList("test-user-7")));
+        Assert.assertTrue(sharingServiceClient.hasAdminAccess(domainId, "test-group-1", "test-user-7"));
+
+        UserGroup getGroup = sharingServiceClient.getGroup(domainId, "test-group-1");
+        Assert.assertTrue(getGroup.getGroupAdmins().size() == 1);
+
+        Assert.assertTrue(sharingServiceClient.removeGroupAdmins(domainId, "test-group-1",
Arrays.asList("test-user-7")));
+        Assert.assertFalse(sharingServiceClient.hasAdminAccess(domainId, "test-group-1",
"test-user-7"));
 
         // transfer group ownership
         sharingServiceClient.addUsersToGroup(domainId, Arrays.asList("test-user-2"), "test-group-1");
diff --git a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/UserGroup.java
b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/UserGroup.java
index 0beebfe474..dc9d8e77ee 100644
--- a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/UserGroup.java
+++ b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/UserGroup.java
@@ -18,6 +18,7 @@
  *  <li><b>groupCardinality</b> : Group cardinality (SINGLE_USER, MULTI_USER)</li>
  *  <li>createdTime : Will be set by the system</li>
  *  <li>updatedTime : Will be set by the system</li>
+ *  <li>groupAdmins : Admins for the group</li>
  *  
  */
 @javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)")
@@ -33,6 +34,7 @@
   private static final org.apache.thrift.protocol.TField GROUP_CARDINALITY_FIELD_DESC = new
org.apache.thrift.protocol.TField("groupCardinality", org.apache.thrift.protocol.TType.I32,
(short)7);
   private static final org.apache.thrift.protocol.TField CREATED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createdTime",
org.apache.thrift.protocol.TType.I64, (short)8);
   private static final org.apache.thrift.protocol.TField UPDATED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("updatedTime",
org.apache.thrift.protocol.TType.I64, (short)9);
+  private static final org.apache.thrift.protocol.TField GROUP_ADMINS_FIELD_DESC = new org.apache.thrift.protocol.TField("groupAdmins",
org.apache.thrift.protocol.TType.LIST, (short)10);
 
   private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new
UserGroupStandardSchemeFactory();
   private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new
UserGroupTupleSchemeFactory();
@@ -54,6 +56,7 @@
   public GroupCardinality groupCardinality; // optional
   public long createdTime; // optional
   public long updatedTime; // optional
+  public java.util.List<GroupAdmin> groupAdmins; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding
and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -73,7 +76,8 @@
      */
     GROUP_CARDINALITY((short)7, "groupCardinality"),
     CREATED_TIME((short)8, "createdTime"),
-    UPDATED_TIME((short)9, "updatedTime");
+    UPDATED_TIME((short)9, "updatedTime"),
+    GROUP_ADMINS((short)10, "groupAdmins");
 
     private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String,
_Fields>();
 
@@ -106,6 +110,8 @@ public static _Fields findByThriftId(int fieldId) {
           return CREATED_TIME;
         case 9: // UPDATED_TIME
           return UPDATED_TIME;
+        case 10: // GROUP_ADMINS
+          return GROUP_ADMINS;
         default:
           return null;
       }
@@ -149,7 +155,7 @@ public short getThriftFieldId() {
   private static final int __CREATEDTIME_ISSET_ID = 0;
   private static final int __UPDATEDTIME_ISSET_ID = 1;
   private byte __isset_bitfield = 0;
-  private static final _Fields optionals[] = {_Fields.GROUP_ID,_Fields.DOMAIN_ID,_Fields.NAME,_Fields.DESCRIPTION,_Fields.OWNER_ID,_Fields.GROUP_TYPE,_Fields.GROUP_CARDINALITY,_Fields.CREATED_TIME,_Fields.UPDATED_TIME};
+  private static final _Fields optionals[] = {_Fields.GROUP_ID,_Fields.DOMAIN_ID,_Fields.NAME,_Fields.DESCRIPTION,_Fields.OWNER_ID,_Fields.GROUP_TYPE,_Fields.GROUP_CARDINALITY,_Fields.CREATED_TIME,_Fields.UPDATED_TIME,_Fields.GROUP_ADMINS};
   public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData>
metaDataMap;
   static {
     java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new
java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -171,6 +177,9 @@ public short getThriftFieldId() {
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
     tmpMap.put(_Fields.UPDATED_TIME, new org.apache.thrift.meta_data.FieldMetaData("updatedTime",
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.GROUP_ADMINS, new org.apache.thrift.meta_data.FieldMetaData("groupAdmins",
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,

+            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
GroupAdmin.class))));
     metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserGroup.class, metaDataMap);
   }
@@ -206,6 +215,13 @@ public UserGroup(UserGroup other) {
     }
     this.createdTime = other.createdTime;
     this.updatedTime = other.updatedTime;
+    if (other.isSetGroupAdmins()) {
+      java.util.List<GroupAdmin> __this__groupAdmins = new java.util.ArrayList<GroupAdmin>(other.groupAdmins.size());
+      for (GroupAdmin other_element : other.groupAdmins) {
+        __this__groupAdmins.add(new GroupAdmin(other_element));
+      }
+      this.groupAdmins = __this__groupAdmins;
+    }
   }
 
   public UserGroup deepCopy() {
@@ -225,6 +241,7 @@ public void clear() {
     this.createdTime = 0;
     setUpdatedTimeIsSet(false);
     this.updatedTime = 0;
+    this.groupAdmins = null;
   }
 
   public java.lang.String getGroupId() {
@@ -457,6 +474,45 @@ public void setUpdatedTimeIsSet(boolean value) {
     __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __UPDATEDTIME_ISSET_ID,
value);
   }
 
+  public int getGroupAdminsSize() {
+    return (this.groupAdmins == null) ? 0 : this.groupAdmins.size();
+  }
+
+  public java.util.Iterator<GroupAdmin> getGroupAdminsIterator() {
+    return (this.groupAdmins == null) ? null : this.groupAdmins.iterator();
+  }
+
+  public void addToGroupAdmins(GroupAdmin elem) {
+    if (this.groupAdmins == null) {
+      this.groupAdmins = new java.util.ArrayList<GroupAdmin>();
+    }
+    this.groupAdmins.add(elem);
+  }
+
+  public java.util.List<GroupAdmin> getGroupAdmins() {
+    return this.groupAdmins;
+  }
+
+  public UserGroup setGroupAdmins(java.util.List<GroupAdmin> groupAdmins) {
+    this.groupAdmins = groupAdmins;
+    return this;
+  }
+
+  public void unsetGroupAdmins() {
+    this.groupAdmins = null;
+  }
+
+  /** Returns true if field groupAdmins is set (has been assigned a value) and false otherwise
*/
+  public boolean isSetGroupAdmins() {
+    return this.groupAdmins != null;
+  }
+
+  public void setGroupAdminsIsSet(boolean value) {
+    if (!value) {
+      this.groupAdmins = null;
+    }
+  }
+
   public void setFieldValue(_Fields field, java.lang.Object value) {
     switch (field) {
     case GROUP_ID:
@@ -531,6 +587,14 @@ public void setFieldValue(_Fields field, java.lang.Object value) {
       }
       break;
 
+    case GROUP_ADMINS:
+      if (value == null) {
+        unsetGroupAdmins();
+      } else {
+        setGroupAdmins((java.util.List<GroupAdmin>)value);
+      }
+      break;
+
     }
   }
 
@@ -563,6 +627,9 @@ public void setFieldValue(_Fields field, java.lang.Object value) {
     case UPDATED_TIME:
       return getUpdatedTime();
 
+    case GROUP_ADMINS:
+      return getGroupAdmins();
+
     }
     throw new java.lang.IllegalStateException();
   }
@@ -592,6 +659,8 @@ public boolean isSet(_Fields field) {
       return isSetCreatedTime();
     case UPDATED_TIME:
       return isSetUpdatedTime();
+    case GROUP_ADMINS:
+      return isSetGroupAdmins();
     }
     throw new java.lang.IllegalStateException();
   }
@@ -692,6 +761,15 @@ public boolean equals(UserGroup that) {
         return false;
     }
 
+    boolean this_present_groupAdmins = true && this.isSetGroupAdmins();
+    boolean that_present_groupAdmins = true && that.isSetGroupAdmins();
+    if (this_present_groupAdmins || that_present_groupAdmins) {
+      if (!(this_present_groupAdmins && that_present_groupAdmins))
+        return false;
+      if (!this.groupAdmins.equals(that.groupAdmins))
+        return false;
+    }
+
     return true;
   }
 
@@ -735,6 +813,10 @@ public int hashCode() {
     if (isSetUpdatedTime())
       hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(updatedTime);
 
+    hashCode = hashCode * 8191 + ((isSetGroupAdmins()) ? 131071 : 524287);
+    if (isSetGroupAdmins())
+      hashCode = hashCode * 8191 + groupAdmins.hashCode();
+
     return hashCode;
   }
 
@@ -836,6 +918,16 @@ public int compareTo(UserGroup other) {
         return lastComparison;
       }
     }
+    lastComparison = java.lang.Boolean.valueOf(isSetGroupAdmins()).compareTo(other.isSetGroupAdmins());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetGroupAdmins()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groupAdmins, other.groupAdmins);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     return 0;
   }
 
@@ -937,6 +1029,16 @@ public void write(org.apache.thrift.protocol.TProtocol oprot) throws
org.apache.
       sb.append(this.updatedTime);
       first = false;
     }
+    if (isSetGroupAdmins()) {
+      if (!first) sb.append(", ");
+      sb.append("groupAdmins:");
+      if (this.groupAdmins == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.groupAdmins);
+      }
+      first = false;
+    }
     sb.append(")");
     return sb.toString();
   }
@@ -1054,6 +1156,25 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, UserGroup
struct) t
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
+          case 10: // GROUP_ADMINS
+            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+              {
+                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
+                struct.groupAdmins = new java.util.ArrayList<GroupAdmin>(_list0.size);
+                GroupAdmin _elem1;
+                for (int _i2 = 0; _i2 < _list0.size; ++_i2)
+                {
+                  _elem1 = new GroupAdmin();
+                  _elem1.read(iprot);
+                  struct.groupAdmins.add(_elem1);
+                }
+                iprot.readListEnd();
+              }
+              struct.setGroupAdminsIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
           default:
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
@@ -1128,6 +1249,20 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, UserGroup
struct)
         oprot.writeI64(struct.updatedTime);
         oprot.writeFieldEnd();
       }
+      if (struct.groupAdmins != null) {
+        if (struct.isSetGroupAdmins()) {
+          oprot.writeFieldBegin(GROUP_ADMINS_FIELD_DESC);
+          {
+            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT,
struct.groupAdmins.size()));
+            for (GroupAdmin _iter3 : struct.groupAdmins)
+            {
+              _iter3.write(oprot);
+            }
+            oprot.writeListEnd();
+          }
+          oprot.writeFieldEnd();
+        }
+      }
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
@@ -1173,7 +1308,10 @@ public void write(org.apache.thrift.protocol.TProtocol prot, UserGroup
struct) t
       if (struct.isSetUpdatedTime()) {
         optionals.set(8);
       }
-      oprot.writeBitSet(optionals, 9);
+      if (struct.isSetGroupAdmins()) {
+        optionals.set(9);
+      }
+      oprot.writeBitSet(optionals, 10);
       if (struct.isSetGroupId()) {
         oprot.writeString(struct.groupId);
       }
@@ -1201,12 +1339,21 @@ public void write(org.apache.thrift.protocol.TProtocol prot, UserGroup
struct) t
       if (struct.isSetUpdatedTime()) {
         oprot.writeI64(struct.updatedTime);
       }
+      if (struct.isSetGroupAdmins()) {
+        {
+          oprot.writeI32(struct.groupAdmins.size());
+          for (GroupAdmin _iter4 : struct.groupAdmins)
+          {
+            _iter4.write(oprot);
+          }
+        }
+      }
     }
 
     @Override
     public void read(org.apache.thrift.protocol.TProtocol prot, UserGroup struct) throws
org.apache.thrift.TException {
       org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol)
prot;
-      java.util.BitSet incoming = iprot.readBitSet(9);
+      java.util.BitSet incoming = iprot.readBitSet(10);
       if (incoming.get(0)) {
         struct.groupId = iprot.readString();
         struct.setGroupIdIsSet(true);
@@ -1243,6 +1390,20 @@ public void read(org.apache.thrift.protocol.TProtocol prot, UserGroup
struct) th
         struct.updatedTime = iprot.readI64();
         struct.setUpdatedTimeIsSet(true);
       }
+      if (incoming.get(9)) {
+        {
+          org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT,
iprot.readI32());
+          struct.groupAdmins = new java.util.ArrayList<GroupAdmin>(_list5.size);
+          GroupAdmin _elem6;
+          for (int _i7 = 0; _i7 < _list5.size; ++_i7)
+          {
+            _elem6 = new GroupAdmin();
+            _elem6.read(iprot);
+            struct.groupAdmins.add(_elem6);
+          }
+        }
+        struct.setGroupAdminsIsSet(true);
+      }
     }
   }
 
diff --git a/modules/sharing-registry/sharing-service-docs/api-docs/sharing_models.html b/modules/sharing-registry/sharing-service-docs/api-docs/sharing_models.html
index 37a9d4dacd..3707f44425 100644
--- a/modules/sharing-registry/sharing-service-docs/api-docs/sharing_models.html
+++ b/modules/sharing-registry/sharing-service-docs/api-docs/sharing_models.html
@@ -185,6 +185,7 @@ <h1>Thrift module: sharing_models</h1>
 <tr><td>7</td><td>groupCardinality</td><td><code><a
href="#Enum_GroupCardinality">GroupCardinality</a></code></td><td></td><td>optional</td><td></td></tr>
 <tr><td>8</td><td>createdTime</td><td><code>i64</code></td><td></td><td>optional</td><td></td></tr>
 <tr><td>9</td><td>updatedTime</td><td><code>i64</code></td><td></td><td>optional</td><td></td></tr>
+<tr><td>10</td><td>groupAdmins</td><td><code>list&lt;<code><a
href="#Struct_GroupAdmin">GroupAdmin</a></code>&gt;</code></td><td></td><td>optional</td><td></td></tr>
 </table><br/><p>User group is a collection of users.</p>
  <li><b>groupId</b> : Group id provided by the client</li>
  <li><b>domainId</b> : Domain id for this user group</li>
@@ -195,6 +196,7 @@ <h1>Thrift module: sharing_models</h1>
  <li><b>groupCardinality</b> : Group cardinality (SINGLE_USER, MULTI_USER)</li>
  <li>createdTime : Will be set by the system</li>
  <li>updatedTime : Will be set by the system</li>
+ <li>groupAdmins : Admins for the group</li>
  
 <br/></div><div class="definition"><h3 id="Struct_GroupMembership">Struct:
GroupMembership</h3>
 <table class="table-bordered table-striped table-condensed"><thead><th>Key</th><th>Field</th><th>Type</th><th>Description</th><th>Requiredness</th><th>Default
value</th></thead>
diff --git a/modules/sharing-registry/thrift_models/sharing_models.thrift b/modules/sharing-registry/thrift_models/sharing_models.thrift
index bd0e5fe5cd..002145cc87 100644
--- a/modules/sharing-registry/thrift_models/sharing_models.thrift
+++ b/modules/sharing-registry/thrift_models/sharing_models.thrift
@@ -105,6 +105,7 @@ enum GroupType {
 * <li><b>groupCardinality</b> : Group cardinality (SINGLE_USER, MULTI_USER)</li>
 * <li>createdTime : Will be set by the system</li>
 * <li>updatedTime : Will be set by the system</li>
+* <li>groupAdmins : Admins for the group</li>
 **/
 struct UserGroup {
  1: optional string groupId,
@@ -115,7 +116,8 @@ struct UserGroup {
  6: optional GroupType groupType,
  7: optional GroupCardinality groupCardinality,
  8: optional i64 createdTime,
- 9: optional i64 updatedTime
+ 9: optional i64 updatedTime,
+ 10: optional list<GroupAdmin> groupAdmins
 }
 
 /**


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> GroupManagerService: add list of admins to GroupModel
> -----------------------------------------------------
>
>                 Key: AIRAVATA-2725
>                 URL: https://issues.apache.org/jira/browse/AIRAVATA-2725
>             Project: Airavata
>          Issue Type: Bug
>            Reporter: Marcus Christie
>            Assignee: Sachin Kariyattin
>            Priority: Major
>
> Add a list of admins to the GroupModel, similar to how the GroupModel has a list of members.
> TODO:
> * add list of admins to GroupModel
> * addGroupAdmins: check that adminId is a member of the group before adding that user
as admin of group



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message