Modified createUser() to add new user to everyone group
MODIFY
modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/EveryoneGroupMigrator.java
modules/sharing-registry/sharing-data-migrator/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/EveryoneGroupMigrator.java
@@ -36,6 +36,8 @@ public class EveryoneGroupMigrator {
RegistryService.Client registryClient = RegistryServiceClientFactory.createRegistryClient("149.165.169.138",8970);
SharingRegistryService.Client sharingClient = SharingRegistryServiceClientFactory.createSharingRegistryClient("149.165.169.138", 7878);
+ String groupOwner = args[0];
+
List<Domain> domainList = sharingClient.getDomains(-1, 0);
for (Domain domain : domainList) {
String groupId = "everyone@" + domain.domainId;
@@ -48,6 +50,7 @@ public class EveryoneGroupMigrator {
userGroup.setUpdatedTime(System.currentTimeMillis());
userGroup.setName("everyone");
userGroup.setDescription("Default Group");
+ userGroup.setOwnerId(groupOwner);
userGroup.setGroupType(GroupType.DOMAIN_LEVEL_GROUP);
sharingClient.createGroup(userGroup);

MODIFY
modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
@@ -164,6 +164,9 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
userGroup.setGroupCardinality(GroupCardinality.SINGLE_USER);
(new UserGroupRepository()).create(userGroup);
+ String groupId = "everyone@" + user.domainId;
+ addUsersToGroup(user.domainId, Arrays.asList(user.userId), groupId);
+
return user.userId;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);
@@ -277,9 +280,7 @@ public class SharingRegistryServerHandler implements SharingRegistryService.Ifac
group.setUpdatedTime(System.currentTimeMillis());
(new UserGroupRepository()).create(group);
- if(group.ownerId != null)
addUsersToGroup(group.domainId, Arrays.asList(group.ownerId), group.groupId);
-
return group.groupId;
}catch (Throwable ex) {
logger.error(ex.getMessage(), ex);

Modified createUser() to add new user to everyone group