Repository: airavata Updated Branches: refs/heads/airavata-gov-registry 8afc7ea2e -> ea28a402c
adding capability cascade permissions and not to cascade permissions Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/ea28a402 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/ea28a402 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/ea28a402 Branch: refs/heads/airavata-gov-registry Commit: ea28a402c1ae623278bb2d62514af8a6b97bd29d Parents: 8afc7ea Author: scnakandala <[email protected]> Authored: Wed Oct 5 14:40:23 2016 -0400 Committer: scnakandala <[email protected]> Committed: Wed Oct 5 14:40:23 2016 -0400 ---------------------------------------------------------------------- modules/sharing-registry/pom.xml | 6 +- .../db/repositories/SharingRepository.java | 12 +- .../server/SharingRegistryServerHandler.java | 65 +++-- .../registry/GovRegistryServerHandlerTest.java | 4 +- .../registry/models/EntitySearchFields.java | 48 ++++ .../sharing/registry/models/Sharing.java | 132 ++++++++-- .../sharing/registry/models/SharingType.java | 11 +- .../service/cpi/GovRegistryService.java | 257 +++++++++++++++++-- .../thrift_models/sharing_cpi.thrift | 6 +- .../thrift_models/sharing_models.thrift | 10 +- 10 files changed, 464 insertions(+), 87 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/ea28a402/modules/sharing-registry/pom.xml ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/pom.xml b/modules/sharing-registry/pom.xml index 78b65cc..50e8d7b 100644 --- a/modules/sharing-registry/pom.xml +++ b/modules/sharing-registry/pom.xml @@ -21,8 +21,8 @@ </properties> <modules> - <module>airavata-sharing-registry-stubs</module> - <module>airavata-sharing-registry-core</module> - <module>airavata-sharing-data-migrator</module> + <module>sharing-registry-stubs</module> + <module>sharing-registry-core</module> + <module>sharing-data-migrator</module> </modules> </project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/ea28a402/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/repositories/SharingRepository.java ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/repositories/SharingRepository.java b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/repositories/SharingRepository.java index 27f9e0e..f5145a3 100644 --- a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/repositories/SharingRepository.java +++ b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/db/repositories/SharingRepository.java @@ -42,16 +42,22 @@ public class SharingRepository extends AbstractRepository<Sharing, SharingEntity public List<Sharing> getIndirectSharedChildren(String parentId, String permissionTypeId) throws GovRegistryException { HashMap<String, String> filters = new HashMap<>(); filters.put(DBConstants.SharingTable.INHERITED_PARENT_ID, parentId); - filters.put(DBConstants.SharingTable.SHARING_TYPE, SharingType.INHERITED.toString()); + filters.put(DBConstants.SharingTable.SHARING_TYPE, SharingType.INDIRECT_CASCADING.toString()); filters.put(DBConstants.SharingTable.PERMISSION_TYPE_ID, permissionTypeId); return select(filters, 0, -1); } - public List<Sharing> getPermissionsForEntity(String entityId) throws GovRegistryException { + public List<Sharing> getCascadingPermissionsForEntity(String entityId) throws GovRegistryException { HashMap<String, String> filters = new HashMap<>(); filters.put(DBConstants.SharingTable.ENTITY_ID, entityId); - return select(filters, 0, -1); + String query = "SELECT p from " + SharingEntity.class.getSimpleName() + " as p"; + query += " WHERE "; + query += "p." + DBConstants.SharingTable.ENTITY_ID + " = '" + entityId + "' AND "; + query += "p." + DBConstants.SharingTable.SHARING_TYPE + " IN('" + SharingType.DIRECT_CASCADING.toString() + + "', '" + SharingType.INDIRECT_CASCADING + "') "; + query += " ORDER BY p.createdTime DESC"; + return select(query, 0, -1); } public boolean hasAccess(String entityId, List<String> groupIds, List<String> permissionTypeIds) throws GovRegistryException { http://git-wip-us.apache.org/repos/asf/airavata/blob/ea28a402/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java index 7ae1c64..01ae934 100644 --- a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java +++ b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java @@ -36,7 +36,7 @@ import java.util.*; public class SharingRegistryServerHandler implements GovRegistryService.Iface{ private final static Logger logger = LoggerFactory.getLogger(SharingRegistryServerHandler.class); - public static String GLOBAL_PERMISSION_NAME = "GLOBAL"; + public static String GLOBAL_PERMISSION_NAME = "OWNER"; private DomainRepository domainRepository; private UserRepository userRepository; @@ -372,7 +372,7 @@ public class SharingRegistryServerHandler implements GovRegistryService.Iface{ newSharing.setEntityId(entity.entityId); newSharing.setGroupId(entity.ownerId); newSharing.setGroupType(GroupType.SINGLE_USER); - newSharing.setSharingType(SharingType.DIRECT); + newSharing.setSharingType(SharingType.DIRECT_CASCADING); newSharing.setCreatedTime(System.currentTimeMillis()); newSharing.setUpdatedTime(System.currentTimeMillis()); @@ -380,14 +380,14 @@ public class SharingRegistryServerHandler implements GovRegistryService.Iface{ //creating records for inherited permissions if(entity.getParentEntityId() != null && entity.getParentEntityId() != ""){ - List<Sharing> sharings = sharingRepository.getPermissionsForEntity(entity.parentEntityId); + List<Sharing> sharings = sharingRepository.getCascadingPermissionsForEntity(entity.parentEntityId); for(Sharing sharing : sharings){ newSharing = new Sharing(); newSharing.setPermissionTypeId(sharing.permissionTypeId); newSharing.setEntityId(entity.entityId); newSharing.setGroupId(sharing.groupId); newSharing.setGroupType(sharing.groupType); - newSharing.setSharingType(SharingType.INHERITED); + newSharing.setSharingType(SharingType.INDIRECT_CASCADING); newSharing.setCreatedTime(System.currentTimeMillis()); newSharing.setUpdatedTime(System.currentTimeMillis()); @@ -439,16 +439,16 @@ public class SharingRegistryServerHandler implements GovRegistryService.Iface{ * @param permissionType */ @Override - public boolean shareEntityWithUsers(String entityId, List<String> userList, String permissionTypeId) throws GovRegistryException, TException { - return shareEntity(entityId, userList, permissionTypeId, GroupType.SINGLE_USER); + public boolean shareEntityWithUsers(String entityId, List<String> userList, String permissionTypeId, boolean cascadePermission) throws GovRegistryException, TException { + return shareEntity(entityId, userList, permissionTypeId, GroupType.SINGLE_USER, cascadePermission); } @Override - public boolean shareEntityWithGroups(String entityId, List<String> groupList, String permissionTypeId) throws GovRegistryException, TException { - return shareEntity(entityId, groupList, permissionTypeId, GroupType.MULTI_USER); + public boolean shareEntityWithGroups(String entityId, List<String> groupList, String permissionTypeId, boolean cascadePermission) throws GovRegistryException, TException { + return shareEntity(entityId, groupList, permissionTypeId, GroupType.MULTI_USER, cascadePermission); } - private boolean shareEntity(String entityId, List<String> groupOrUserList, String permissionTypeId, GroupType groupType) throws GovRegistryException, TException { + private boolean shareEntity(String entityId, List<String> groupOrUserList, String permissionTypeId, GroupType groupType, boolean cascadePermission) throws GovRegistryException, TException { //Adding permission for the specified users/groups for the specified entity LinkedList<Entity> temp = new LinkedList<>(); for(String userId : groupOrUserList){ @@ -457,31 +457,40 @@ public class SharingRegistryServerHandler implements GovRegistryService.Iface{ sharing.setEntityId(entityId); sharing.setGroupId(userId); sharing.setGroupType(groupType); - sharing.setSharingType(SharingType.DIRECT); + if(cascadePermission) { + sharing.setSharingType(SharingType.DIRECT_CASCADING); + sharing.setCascadePermission(true); + }else { + sharing.setSharingType(SharingType.DIRECT_NON_CASCADING); + sharing.setCascadePermission(false); + } sharing.setCreatedTime(System.currentTimeMillis()); sharing.setUpdatedTime(System.currentTimeMillis()); sharingRepository.create(sharing); } - //Adding permission for the specified users/groups for all child entities - entityRepository.getChildEntities(entityId).stream().forEach(e-> temp.addLast(e)); - while(temp.size() > 0){ - Entity entity = temp.pop(); - String childEntityId = entity.entityId; - String parentEntityId = entity.parentEntityId; - for(String userId : groupOrUserList){ - Sharing sharing = new Sharing(); - sharing.setPermissionTypeId(permissionTypeId); - sharing.setEntityId(childEntityId); - sharing.setGroupId(userId); - sharing.setGroupType(groupType); - sharing.setSharingType(SharingType.INHERITED); - sharing.setInheritedParentId(parentEntityId); - sharing.setCreatedTime(System.currentTimeMillis()); - sharing.setUpdatedTime(System.currentTimeMillis()); - sharingRepository.create(sharing); - entityRepository.getChildEntities(childEntityId).stream().forEach(e-> temp.addLast(e)); + if(cascadePermission){ + //Adding permission for the specified users/groups for all child entities + entityRepository.getChildEntities(entityId).stream().forEach(e-> temp.addLast(e)); + while(temp.size() > 0){ + Entity entity = temp.pop(); + String childEntityId = entity.entityId; + String parentEntityId = entity.parentEntityId; + for(String userId : groupOrUserList){ + Sharing sharing = new Sharing(); + sharing.setPermissionTypeId(permissionTypeId); + sharing.setEntityId(childEntityId); + sharing.setGroupId(userId); + sharing.setGroupType(groupType); + sharing.setSharingType(SharingType.INDIRECT_CASCADING); + sharing.setInheritedParentId(parentEntityId); + sharing.setCascadePermission(true); + sharing.setCreatedTime(System.currentTimeMillis()); + sharing.setUpdatedTime(System.currentTimeMillis()); + sharingRepository.create(sharing); + entityRepository.getChildEntities(childEntityId).stream().forEach(e-> temp.addLast(e)); + } } } return true; http://git-wip-us.apache.org/repos/asf/airavata/blob/ea28a402/modules/sharing-registry/sharing-registry-core/src/test/java/org/apache/airavata/sharing/registry/GovRegistryServerHandlerTest.java ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/sharing-registry-core/src/test/java/org/apache/airavata/sharing/registry/GovRegistryServerHandlerTest.java b/modules/sharing-registry/sharing-registry-core/src/test/java/org/apache/airavata/sharing/registry/GovRegistryServerHandlerTest.java index 688117c..afef6b8 100644 --- a/modules/sharing-registry/sharing-registry-core/src/test/java/org/apache/airavata/sharing/registry/GovRegistryServerHandlerTest.java +++ b/modules/sharing-registry/sharing-registry-core/src/test/java/org/apache/airavata/sharing/registry/GovRegistryServerHandlerTest.java @@ -236,8 +236,8 @@ public class GovRegistryServerHandlerTest { String entityId3 = govRegistryServerHandler.createEntity(entity3); Assert.assertNotNull(entityId3); - govRegistryServerHandler.shareEntityWithUsers(entityId1, Arrays.asList(userId2), permissionTypeId1); - govRegistryServerHandler.shareEntityWithGroups(entityId3, Arrays.asList(groupId2), permissionTypeId1); + govRegistryServerHandler.shareEntityWithUsers(entityId1, Arrays.asList(userId2), permissionTypeId1, true); + govRegistryServerHandler.shareEntityWithGroups(entityId3, Arrays.asList(groupId2), permissionTypeId1, true); Entity entity4 = new Entity(); entity4.setEntityId(domainId+":Entity4"); http://git-wip-us.apache.org/repos/asf/airavata/blob/ea28a402/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/EntitySearchFields.java ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/EntitySearchFields.java b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/EntitySearchFields.java new file mode 100644 index 0000000..6832191 --- /dev/null +++ b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/EntitySearchFields.java @@ -0,0 +1,48 @@ +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.sharing.registry.models; + + +import java.util.Map; +import java.util.HashMap; +import org.apache.thrift.TEnum; + +public enum EntitySearchFields implements org.apache.thrift.TEnum { + NAME(0), + DESCRIPTION(1), + FULL_TEXT(2); + + private final int value; + + private EntitySearchFields(int value) { + this.value = value; + } + + /** + * Get the integer value of this enum value, as defined in the Thrift IDL. + */ + public int getValue() { + return value; + } + + /** + * Find a the enum type by its integer value, as defined in the Thrift IDL. + * @return null if the value is not found. + */ + public static EntitySearchFields findByValue(int value) { + switch (value) { + case 0: + return NAME; + case 1: + return DESCRIPTION; + case 2: + return FULL_TEXT; + default: + return null; + } + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/ea28a402/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Sharing.java ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Sharing.java b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Sharing.java index 5106eab..3b3a709 100644 --- a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Sharing.java +++ b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/Sharing.java @@ -44,8 +44,9 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields private static final org.apache.thrift.protocol.TField GROUP_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("groupType", org.apache.thrift.protocol.TType.I32, (short)4); private static final org.apache.thrift.protocol.TField SHARING_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("sharingType", org.apache.thrift.protocol.TType.I32, (short)5); private static final org.apache.thrift.protocol.TField INHERITED_PARENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("inheritedParentId", org.apache.thrift.protocol.TType.STRING, (short)6); - 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)7); - 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)8); + private static final org.apache.thrift.protocol.TField CASCADE_PERMISSION_FIELD_DESC = new org.apache.thrift.protocol.TField("cascadePermission", org.apache.thrift.protocol.TType.BOOL, (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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -67,6 +68,7 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields */ public SharingType sharingType; // optional public String inheritedParentId; // optional + public boolean cascadePermission; // optional public long createdTime; // optional public long updatedTime; // optional @@ -86,8 +88,9 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields */ SHARING_TYPE((short)5, "sharingType"), INHERITED_PARENT_ID((short)6, "inheritedParentId"), - CREATED_TIME((short)7, "createdTime"), - UPDATED_TIME((short)8, "updatedTime"); + CASCADE_PERMISSION((short)7, "cascadePermission"), + CREATED_TIME((short)8, "createdTime"), + UPDATED_TIME((short)9, "updatedTime"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -114,9 +117,11 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields return SHARING_TYPE; case 6: // INHERITED_PARENT_ID return INHERITED_PARENT_ID; - case 7: // CREATED_TIME + case 7: // CASCADE_PERMISSION + return CASCADE_PERMISSION; + case 8: // CREATED_TIME return CREATED_TIME; - case 8: // UPDATED_TIME + case 9: // UPDATED_TIME return UPDATED_TIME; default: return null; @@ -158,10 +163,11 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields } // isset id assignments - private static final int __CREATEDTIME_ISSET_ID = 0; - private static final int __UPDATEDTIME_ISSET_ID = 1; + private static final int __CASCADEPERMISSION_ISSET_ID = 0; + private static final int __CREATEDTIME_ISSET_ID = 1; + private static final int __UPDATEDTIME_ISSET_ID = 2; private byte __isset_bitfield = 0; - private static final _Fields optionals[] = {_Fields.PERMISSION_TYPE_ID,_Fields.ENTITY_ID,_Fields.GROUP_ID,_Fields.GROUP_TYPE,_Fields.SHARING_TYPE,_Fields.INHERITED_PARENT_ID,_Fields.CREATED_TIME,_Fields.UPDATED_TIME}; + private static final _Fields optionals[] = {_Fields.PERMISSION_TYPE_ID,_Fields.ENTITY_ID,_Fields.GROUP_ID,_Fields.GROUP_TYPE,_Fields.SHARING_TYPE,_Fields.INHERITED_PARENT_ID,_Fields.CASCADE_PERMISSION,_Fields.CREATED_TIME,_Fields.UPDATED_TIME}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); @@ -177,6 +183,8 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, SharingType.class))); tmpMap.put(_Fields.INHERITED_PARENT_ID, new org.apache.thrift.meta_data.FieldMetaData("inheritedParentId", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.CASCADE_PERMISSION, new org.apache.thrift.meta_data.FieldMetaData("cascadePermission", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); tmpMap.put(_Fields.CREATED_TIME, new org.apache.thrift.meta_data.FieldMetaData("createdTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, 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, @@ -211,6 +219,7 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields if (other.isSetInheritedParentId()) { this.inheritedParentId = other.inheritedParentId; } + this.cascadePermission = other.cascadePermission; this.createdTime = other.createdTime; this.updatedTime = other.updatedTime; } @@ -227,6 +236,8 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields this.groupType = null; this.sharingType = null; this.inheritedParentId = null; + setCascadePermissionIsSet(false); + this.cascadePermission = false; setCreatedTimeIsSet(false); this.createdTime = 0; setUpdatedTimeIsSet(false); @@ -393,6 +404,29 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields } } + public boolean isCascadePermission() { + return this.cascadePermission; + } + + public Sharing setCascadePermission(boolean cascadePermission) { + this.cascadePermission = cascadePermission; + setCascadePermissionIsSet(true); + return this; + } + + public void unsetCascadePermission() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CASCADEPERMISSION_ISSET_ID); + } + + /** Returns true if field cascadePermission is set (has been assigned a value) and false otherwise */ + public boolean isSetCascadePermission() { + return EncodingUtils.testBit(__isset_bitfield, __CASCADEPERMISSION_ISSET_ID); + } + + public void setCascadePermissionIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CASCADEPERMISSION_ISSET_ID, value); + } + public long getCreatedTime() { return this.createdTime; } @@ -489,6 +523,14 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields } break; + case CASCADE_PERMISSION: + if (value == null) { + unsetCascadePermission(); + } else { + setCascadePermission((Boolean)value); + } + break; + case CREATED_TIME: if (value == null) { unsetCreatedTime(); @@ -528,6 +570,9 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields case INHERITED_PARENT_ID: return getInheritedParentId(); + case CASCADE_PERMISSION: + return isCascadePermission(); + case CREATED_TIME: return getCreatedTime(); @@ -557,6 +602,8 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields return isSetSharingType(); case INHERITED_PARENT_ID: return isSetInheritedParentId(); + case CASCADE_PERMISSION: + return isSetCascadePermission(); case CREATED_TIME: return isSetCreatedTime(); case UPDATED_TIME: @@ -632,6 +679,15 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields return false; } + boolean this_present_cascadePermission = true && this.isSetCascadePermission(); + boolean that_present_cascadePermission = true && that.isSetCascadePermission(); + if (this_present_cascadePermission || that_present_cascadePermission) { + if (!(this_present_cascadePermission && that_present_cascadePermission)) + return false; + if (this.cascadePermission != that.cascadePermission) + return false; + } + boolean this_present_createdTime = true && this.isSetCreatedTime(); boolean that_present_createdTime = true && that.isSetCreatedTime(); if (this_present_createdTime || that_present_createdTime) { @@ -687,6 +743,11 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields if (present_inheritedParentId) list.add(inheritedParentId); + boolean present_cascadePermission = true && (isSetCascadePermission()); + list.add(present_cascadePermission); + if (present_cascadePermission) + list.add(cascadePermission); + boolean present_createdTime = true && (isSetCreatedTime()); list.add(present_createdTime); if (present_createdTime) @@ -768,6 +829,16 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields return lastComparison; } } + lastComparison = Boolean.valueOf(isSetCascadePermission()).compareTo(other.isSetCascadePermission()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCascadePermission()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cascadePermission, other.cascadePermission); + if (lastComparison != 0) { + return lastComparison; + } + } lastComparison = Boolean.valueOf(isSetCreatedTime()).compareTo(other.isSetCreatedTime()); if (lastComparison != 0) { return lastComparison; @@ -867,6 +938,12 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields } first = false; } + if (isSetCascadePermission()) { + if (!first) sb.append(", "); + sb.append("cascadePermission:"); + sb.append(this.cascadePermission); + first = false; + } if (isSetCreatedTime()) { if (!first) sb.append(", "); sb.append("createdTime:"); @@ -972,7 +1049,15 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 7: // CREATED_TIME + case 7: // CASCADE_PERMISSION + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.cascadePermission = iprot.readBool(); + struct.setCascadePermissionIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 8: // CREATED_TIME if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.createdTime = iprot.readI64(); struct.setCreatedTimeIsSet(true); @@ -980,7 +1065,7 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 8: // UPDATED_TIME + case 9: // UPDATED_TIME if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.updatedTime = iprot.readI64(); struct.setUpdatedTimeIsSet(true); @@ -1045,6 +1130,11 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields oprot.writeFieldEnd(); } } + if (struct.isSetCascadePermission()) { + oprot.writeFieldBegin(CASCADE_PERMISSION_FIELD_DESC); + oprot.writeBool(struct.cascadePermission); + oprot.writeFieldEnd(); + } if (struct.isSetCreatedTime()) { oprot.writeFieldBegin(CREATED_TIME_FIELD_DESC); oprot.writeI64(struct.createdTime); @@ -1091,13 +1181,16 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields if (struct.isSetInheritedParentId()) { optionals.set(5); } - if (struct.isSetCreatedTime()) { + if (struct.isSetCascadePermission()) { optionals.set(6); } - if (struct.isSetUpdatedTime()) { + if (struct.isSetCreatedTime()) { optionals.set(7); } - oprot.writeBitSet(optionals, 8); + if (struct.isSetUpdatedTime()) { + optionals.set(8); + } + oprot.writeBitSet(optionals, 9); if (struct.isSetPermissionTypeId()) { oprot.writeString(struct.permissionTypeId); } @@ -1116,6 +1209,9 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields if (struct.isSetInheritedParentId()) { oprot.writeString(struct.inheritedParentId); } + if (struct.isSetCascadePermission()) { + oprot.writeBool(struct.cascadePermission); + } if (struct.isSetCreatedTime()) { oprot.writeI64(struct.createdTime); } @@ -1127,7 +1223,7 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields @Override public void read(org.apache.thrift.protocol.TProtocol prot, Sharing struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(8); + BitSet incoming = iprot.readBitSet(9); if (incoming.get(0)) { struct.permissionTypeId = iprot.readString(); struct.setPermissionTypeIdIsSet(true); @@ -1153,10 +1249,14 @@ public class Sharing implements org.apache.thrift.TBase<Sharing, Sharing._Fields struct.setInheritedParentIdIsSet(true); } if (incoming.get(6)) { + struct.cascadePermission = iprot.readBool(); + struct.setCascadePermissionIsSet(true); + } + if (incoming.get(7)) { struct.createdTime = iprot.readI64(); struct.setCreatedTimeIsSet(true); } - if (incoming.get(7)) { + if (incoming.get(8)) { struct.updatedTime = iprot.readI64(); struct.setUpdatedTimeIsSet(true); } http://git-wip-us.apache.org/repos/asf/airavata/blob/ea28a402/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/SharingType.java ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/SharingType.java b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/SharingType.java index ff9f919..f57f7d1 100644 --- a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/SharingType.java +++ b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/models/SharingType.java @@ -12,8 +12,9 @@ import java.util.HashMap; import org.apache.thrift.TEnum; public enum SharingType implements org.apache.thrift.TEnum { - DIRECT(0), - INHERITED(1); + DIRECT_NON_CASCADING(0), + DIRECT_CASCADING(1), + INDIRECT_CASCADING(2); private final int value; @@ -35,9 +36,11 @@ public enum SharingType implements org.apache.thrift.TEnum { public static SharingType findByValue(int value) { switch (value) { case 0: - return DIRECT; + return DIRECT_NON_CASCADING; case 1: - return INHERITED; + return DIRECT_CASCADING; + case 2: + return INDIRECT_CASCADING; default: return null; } http://git-wip-us.apache.org/repos/asf/airavata/blob/ea28a402/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/service/cpi/GovRegistryService.java ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/service/cpi/GovRegistryService.java b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/service/cpi/GovRegistryService.java index efcbab5..1e0e1b9 100644 --- a/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/service/cpi/GovRegistryService.java +++ b/modules/sharing-registry/sharing-registry-stubs/src/main/java/org/apache/airavata/sharing/registry/service/cpi/GovRegistryService.java @@ -152,12 +152,13 @@ public class GovRegistryService { * @param entityId * @param userList * @param perssionTypeId + * @param cascadePermission */ - public boolean shareEntityWithUsers(String entityId, List<String> userList, String perssionTypeId) throws org.apache.airavata.sharing.registry.models.GovRegistryException, org.apache.thrift.TException; + public boolean shareEntityWithUsers(String entityId, List<String> userList, String perssionTypeId, boolean cascadePermission) throws org.apache.airavata.sharing.registry.models.GovRegistryException, org.apache.thrift.TException; public boolean revokeEntitySharingFromUsers(String entityId, List<String> userList, String perssionTypeId) throws org.apache.airavata.sharing.registry.models.GovRegistryException, org.apache.thrift.TException; - public boolean shareEntityWithGroups(String entityId, List<String> groupList, String perssionTypeId) throws org.apache.airavata.sharing.registry.models.GovRegistryException, org.apache.thrift.TException; + public boolean shareEntityWithGroups(String entityId, List<String> groupList, String perssionTypeId, boolean cascadePermission) throws org.apache.airavata.sharing.registry.models.GovRegistryException, org.apache.thrift.TException; public boolean revokeEntitySharingFromGroups(String entityId, List<String> groupList, String perssionTypeId) throws org.apache.airavata.sharing.registry.models.GovRegistryException, org.apache.thrift.TException; @@ -237,11 +238,11 @@ public class GovRegistryService { public void getPermissionTypes(String domain, int offset, int limit, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void shareEntityWithUsers(String entityId, List<String> userList, String perssionTypeId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void shareEntityWithUsers(String entityId, List<String> userList, String perssionTypeId, boolean cascadePermission, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void revokeEntitySharingFromUsers(String entityId, List<String> userList, String perssionTypeId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void shareEntityWithGroups(String entityId, List<String> groupList, String perssionTypeId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void shareEntityWithGroups(String entityId, List<String> groupList, String perssionTypeId, boolean cascadePermission, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void revokeEntitySharingFromGroups(String entityId, List<String> groupList, String perssionTypeId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -1195,18 +1196,19 @@ public class GovRegistryService { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPermissionTypes failed: unknown result"); } - public boolean shareEntityWithUsers(String entityId, List<String> userList, String perssionTypeId) throws org.apache.airavata.sharing.registry.models.GovRegistryException, org.apache.thrift.TException + public boolean shareEntityWithUsers(String entityId, List<String> userList, String perssionTypeId, boolean cascadePermission) throws org.apache.airavata.sharing.registry.models.GovRegistryException, org.apache.thrift.TException { - send_shareEntityWithUsers(entityId, userList, perssionTypeId); + send_shareEntityWithUsers(entityId, userList, perssionTypeId, cascadePermission); return recv_shareEntityWithUsers(); } - public void send_shareEntityWithUsers(String entityId, List<String> userList, String perssionTypeId) throws org.apache.thrift.TException + public void send_shareEntityWithUsers(String entityId, List<String> userList, String perssionTypeId, boolean cascadePermission) throws org.apache.thrift.TException { shareEntityWithUsers_args args = new shareEntityWithUsers_args(); args.setEntityId(entityId); args.setUserList(userList); args.setPerssionTypeId(perssionTypeId); + args.setCascadePermission(cascadePermission); sendBase("shareEntityWithUsers", args); } @@ -1251,18 +1253,19 @@ public class GovRegistryService { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "revokeEntitySharingFromUsers failed: unknown result"); } - public boolean shareEntityWithGroups(String entityId, List<String> groupList, String perssionTypeId) throws org.apache.airavata.sharing.registry.models.GovRegistryException, org.apache.thrift.TException + public boolean shareEntityWithGroups(String entityId, List<String> groupList, String perssionTypeId, boolean cascadePermission) throws org.apache.airavata.sharing.registry.models.GovRegistryException, org.apache.thrift.TException { - send_shareEntityWithGroups(entityId, groupList, perssionTypeId); + send_shareEntityWithGroups(entityId, groupList, perssionTypeId, cascadePermission); return recv_shareEntityWithGroups(); } - public void send_shareEntityWithGroups(String entityId, List<String> groupList, String perssionTypeId) throws org.apache.thrift.TException + public void send_shareEntityWithGroups(String entityId, List<String> groupList, String perssionTypeId, boolean cascadePermission) throws org.apache.thrift.TException { shareEntityWithGroups_args args = new shareEntityWithGroups_args(); args.setEntityId(entityId); args.setGroupList(groupList); args.setPerssionTypeId(perssionTypeId); + args.setCascadePermission(cascadePermission); sendBase("shareEntityWithGroups", args); } @@ -2531,9 +2534,9 @@ public class GovRegistryService { } } - public void shareEntityWithUsers(String entityId, List<String> userList, String perssionTypeId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void shareEntityWithUsers(String entityId, List<String> userList, String perssionTypeId, boolean cascadePermission, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); - shareEntityWithUsers_call method_call = new shareEntityWithUsers_call(entityId, userList, perssionTypeId, resultHandler, this, ___protocolFactory, ___transport); + shareEntityWithUsers_call method_call = new shareEntityWithUsers_call(entityId, userList, perssionTypeId, cascadePermission, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } @@ -2542,11 +2545,13 @@ public class GovRegistryService { private String entityId; private List<String> userList; private String perssionTypeId; - public shareEntityWithUsers_call(String entityId, List<String> userList, String perssionTypeId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + private boolean cascadePermission; + public shareEntityWithUsers_call(String entityId, List<String> userList, String perssionTypeId, boolean cascadePermission, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); this.entityId = entityId; this.userList = userList; this.perssionTypeId = perssionTypeId; + this.cascadePermission = cascadePermission; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { @@ -2555,6 +2560,7 @@ public class GovRegistryService { args.setEntityId(entityId); args.setUserList(userList); args.setPerssionTypeId(perssionTypeId); + args.setCascadePermission(cascadePermission); args.write(prot); prot.writeMessageEnd(); } @@ -2607,9 +2613,9 @@ public class GovRegistryService { } } - public void shareEntityWithGroups(String entityId, List<String> groupList, String perssionTypeId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void shareEntityWithGroups(String entityId, List<String> groupList, String perssionTypeId, boolean cascadePermission, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); - shareEntityWithGroups_call method_call = new shareEntityWithGroups_call(entityId, groupList, perssionTypeId, resultHandler, this, ___protocolFactory, ___transport); + shareEntityWithGroups_call method_call = new shareEntityWithGroups_call(entityId, groupList, perssionTypeId, cascadePermission, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } @@ -2618,11 +2624,13 @@ public class GovRegistryService { private String entityId; private List<String> groupList; private String perssionTypeId; - public shareEntityWithGroups_call(String entityId, List<String> groupList, String perssionTypeId, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + private boolean cascadePermission; + public shareEntityWithGroups_call(String entityId, List<String> groupList, String perssionTypeId, boolean cascadePermission, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); this.entityId = entityId; this.groupList = groupList; this.perssionTypeId = perssionTypeId; + this.cascadePermission = cascadePermission; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { @@ -2631,6 +2639,7 @@ public class GovRegistryService { args.setEntityId(entityId); args.setGroupList(groupList); args.setPerssionTypeId(perssionTypeId); + args.setCascadePermission(cascadePermission); args.write(prot); prot.writeMessageEnd(); } @@ -3648,7 +3657,7 @@ public class GovRegistryService { public shareEntityWithUsers_result getResult(I iface, shareEntityWithUsers_args args) throws org.apache.thrift.TException { shareEntityWithUsers_result result = new shareEntityWithUsers_result(); try { - result.success = iface.shareEntityWithUsers(args.entityId, args.userList, args.perssionTypeId); + result.success = iface.shareEntityWithUsers(args.entityId, args.userList, args.perssionTypeId, args.cascadePermission); result.setSuccessIsSet(true); } catch (org.apache.airavata.sharing.registry.models.GovRegistryException gre) { result.gre = gre; @@ -3698,7 +3707,7 @@ public class GovRegistryService { public shareEntityWithGroups_result getResult(I iface, shareEntityWithGroups_args args) throws org.apache.thrift.TException { shareEntityWithGroups_result result = new shareEntityWithGroups_result(); try { - result.success = iface.shareEntityWithGroups(args.entityId, args.groupList, args.perssionTypeId); + result.success = iface.shareEntityWithGroups(args.entityId, args.groupList, args.perssionTypeId, args.cascadePermission); result.setSuccessIsSet(true); } catch (org.apache.airavata.sharing.registry.models.GovRegistryException gre) { result.gre = gre; @@ -5872,7 +5881,7 @@ public class GovRegistryService { } public void start(I iface, shareEntityWithUsers_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException { - iface.shareEntityWithUsers(args.entityId, args.userList, args.perssionTypeId,resultHandler); + iface.shareEntityWithUsers(args.entityId, args.userList, args.perssionTypeId, args.cascadePermission,resultHandler); } } @@ -5988,7 +5997,7 @@ public class GovRegistryService { } public void start(I iface, shareEntityWithGroups_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException { - iface.shareEntityWithGroups(args.entityId, args.groupList, args.perssionTypeId,resultHandler); + iface.shareEntityWithGroups(args.entityId, args.groupList, args.perssionTypeId, args.cascadePermission,resultHandler); } } @@ -37294,6 +37303,7 @@ public class GovRegistryService { private static final org.apache.thrift.protocol.TField ENTITY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("entityId", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField USER_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("userList", org.apache.thrift.protocol.TType.LIST, (short)2); private static final org.apache.thrift.protocol.TField PERSSION_TYPE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("perssionTypeId", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField CASCADE_PERMISSION_FIELD_DESC = new org.apache.thrift.protocol.TField("cascadePermission", org.apache.thrift.protocol.TType.BOOL, (short)4); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -37304,12 +37314,14 @@ public class GovRegistryService { public String entityId; // required public List<String> userList; // required public String perssionTypeId; // required + public boolean cascadePermission; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { ENTITY_ID((short)1, "entityId"), USER_LIST((short)2, "userList"), - PERSSION_TYPE_ID((short)3, "perssionTypeId"); + PERSSION_TYPE_ID((short)3, "perssionTypeId"), + CASCADE_PERMISSION((short)4, "cascadePermission"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -37330,6 +37342,8 @@ public class GovRegistryService { return USER_LIST; case 3: // PERSSION_TYPE_ID return PERSSION_TYPE_ID; + case 4: // CASCADE_PERMISSION + return CASCADE_PERMISSION; default: return null; } @@ -37370,6 +37384,8 @@ public class GovRegistryService { } // isset id assignments + private static final int __CASCADEPERMISSION_ISSET_ID = 0; + private byte __isset_bitfield = 0; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); @@ -37380,6 +37396,8 @@ public class GovRegistryService { new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); tmpMap.put(_Fields.PERSSION_TYPE_ID, new org.apache.thrift.meta_data.FieldMetaData("perssionTypeId", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.CASCADE_PERMISSION, new org.apache.thrift.meta_data.FieldMetaData("cascadePermission", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(shareEntityWithUsers_args.class, metaDataMap); } @@ -37390,18 +37408,22 @@ public class GovRegistryService { public shareEntityWithUsers_args( String entityId, List<String> userList, - String perssionTypeId) + String perssionTypeId, + boolean cascadePermission) { this(); this.entityId = entityId; this.userList = userList; this.perssionTypeId = perssionTypeId; + this.cascadePermission = cascadePermission; + setCascadePermissionIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public shareEntityWithUsers_args(shareEntityWithUsers_args other) { + __isset_bitfield = other.__isset_bitfield; if (other.isSetEntityId()) { this.entityId = other.entityId; } @@ -37412,6 +37434,7 @@ public class GovRegistryService { if (other.isSetPerssionTypeId()) { this.perssionTypeId = other.perssionTypeId; } + this.cascadePermission = other.cascadePermission; } public shareEntityWithUsers_args deepCopy() { @@ -37423,6 +37446,8 @@ public class GovRegistryService { this.entityId = null; this.userList = null; this.perssionTypeId = null; + setCascadePermissionIsSet(false); + this.cascadePermission = false; } public String getEntityId() { @@ -37512,6 +37537,29 @@ public class GovRegistryService { } } + public boolean isCascadePermission() { + return this.cascadePermission; + } + + public shareEntityWithUsers_args setCascadePermission(boolean cascadePermission) { + this.cascadePermission = cascadePermission; + setCascadePermissionIsSet(true); + return this; + } + + public void unsetCascadePermission() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CASCADEPERMISSION_ISSET_ID); + } + + /** Returns true if field cascadePermission is set (has been assigned a value) and false otherwise */ + public boolean isSetCascadePermission() { + return EncodingUtils.testBit(__isset_bitfield, __CASCADEPERMISSION_ISSET_ID); + } + + public void setCascadePermissionIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CASCADEPERMISSION_ISSET_ID, value); + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case ENTITY_ID: @@ -37538,6 +37586,14 @@ public class GovRegistryService { } break; + case CASCADE_PERMISSION: + if (value == null) { + unsetCascadePermission(); + } else { + setCascadePermission((Boolean)value); + } + break; + } } @@ -37552,6 +37608,9 @@ public class GovRegistryService { case PERSSION_TYPE_ID: return getPerssionTypeId(); + case CASCADE_PERMISSION: + return isCascadePermission(); + } throw new IllegalStateException(); } @@ -37569,6 +37628,8 @@ public class GovRegistryService { return isSetUserList(); case PERSSION_TYPE_ID: return isSetPerssionTypeId(); + case CASCADE_PERMISSION: + return isSetCascadePermission(); } throw new IllegalStateException(); } @@ -37613,6 +37674,15 @@ public class GovRegistryService { return false; } + boolean this_present_cascadePermission = true; + boolean that_present_cascadePermission = true; + if (this_present_cascadePermission || that_present_cascadePermission) { + if (!(this_present_cascadePermission && that_present_cascadePermission)) + return false; + if (this.cascadePermission != that.cascadePermission) + return false; + } + return true; } @@ -37635,6 +37705,11 @@ public class GovRegistryService { if (present_perssionTypeId) list.add(perssionTypeId); + boolean present_cascadePermission = true; + list.add(present_cascadePermission); + if (present_cascadePermission) + list.add(cascadePermission); + return list.hashCode(); } @@ -37676,6 +37751,16 @@ public class GovRegistryService { return lastComparison; } } + lastComparison = Boolean.valueOf(isSetCascadePermission()).compareTo(other.isSetCascadePermission()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCascadePermission()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cascadePermission, other.cascadePermission); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -37719,6 +37804,10 @@ public class GovRegistryService { sb.append(this.perssionTypeId); } first = false; + if (!first) sb.append(", "); + sb.append("cascadePermission:"); + sb.append(this.cascadePermission); + first = false; sb.append(")"); return sb.toString(); } @@ -37734,6 +37823,7 @@ public class GovRegistryService { if (perssionTypeId == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'perssionTypeId' was not present! Struct: " + toString()); } + // alas, we cannot check 'cascadePermission' because it's a primitive and you chose the non-beans generator. // check for sub-struct validity } @@ -37747,6 +37837,8 @@ public class GovRegistryService { private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); @@ -37805,6 +37897,14 @@ public class GovRegistryService { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 4: // CASCADE_PERMISSION + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.cascadePermission = iprot.readBool(); + struct.setCascadePermissionIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -37813,6 +37913,9 @@ public class GovRegistryService { iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetCascadePermission()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'cascadePermission' was not found in serialized data! Struct: " + toString()); + } struct.validate(); } @@ -37842,6 +37945,9 @@ public class GovRegistryService { oprot.writeString(struct.perssionTypeId); oprot.writeFieldEnd(); } + oprot.writeFieldBegin(CASCADE_PERMISSION_FIELD_DESC); + oprot.writeBool(struct.cascadePermission); + oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -37868,6 +37974,7 @@ public class GovRegistryService { } } oprot.writeString(struct.perssionTypeId); + oprot.writeBool(struct.cascadePermission); } @Override @@ -37888,6 +37995,8 @@ public class GovRegistryService { struct.setUserListIsSet(true); struct.perssionTypeId = iprot.readString(); struct.setPerssionTypeIdIsSet(true); + struct.cascadePermission = iprot.readBool(); + struct.setCascadePermissionIsSet(true); } } @@ -39440,6 +39549,7 @@ public class GovRegistryService { private static final org.apache.thrift.protocol.TField ENTITY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("entityId", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField GROUP_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("groupList", org.apache.thrift.protocol.TType.LIST, (short)2); private static final org.apache.thrift.protocol.TField PERSSION_TYPE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("perssionTypeId", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField CASCADE_PERMISSION_FIELD_DESC = new org.apache.thrift.protocol.TField("cascadePermission", org.apache.thrift.protocol.TType.BOOL, (short)4); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -39450,12 +39560,14 @@ public class GovRegistryService { public String entityId; // required public List<String> groupList; // required public String perssionTypeId; // required + public boolean cascadePermission; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { ENTITY_ID((short)1, "entityId"), GROUP_LIST((short)2, "groupList"), - PERSSION_TYPE_ID((short)3, "perssionTypeId"); + PERSSION_TYPE_ID((short)3, "perssionTypeId"), + CASCADE_PERMISSION((short)4, "cascadePermission"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -39476,6 +39588,8 @@ public class GovRegistryService { return GROUP_LIST; case 3: // PERSSION_TYPE_ID return PERSSION_TYPE_ID; + case 4: // CASCADE_PERMISSION + return CASCADE_PERMISSION; default: return null; } @@ -39516,6 +39630,8 @@ public class GovRegistryService { } // isset id assignments + private static final int __CASCADEPERMISSION_ISSET_ID = 0; + private byte __isset_bitfield = 0; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); @@ -39526,6 +39642,8 @@ public class GovRegistryService { new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); tmpMap.put(_Fields.PERSSION_TYPE_ID, new org.apache.thrift.meta_data.FieldMetaData("perssionTypeId", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.CASCADE_PERMISSION, new org.apache.thrift.meta_data.FieldMetaData("cascadePermission", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(shareEntityWithGroups_args.class, metaDataMap); } @@ -39536,18 +39654,22 @@ public class GovRegistryService { public shareEntityWithGroups_args( String entityId, List<String> groupList, - String perssionTypeId) + String perssionTypeId, + boolean cascadePermission) { this(); this.entityId = entityId; this.groupList = groupList; this.perssionTypeId = perssionTypeId; + this.cascadePermission = cascadePermission; + setCascadePermissionIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public shareEntityWithGroups_args(shareEntityWithGroups_args other) { + __isset_bitfield = other.__isset_bitfield; if (other.isSetEntityId()) { this.entityId = other.entityId; } @@ -39558,6 +39680,7 @@ public class GovRegistryService { if (other.isSetPerssionTypeId()) { this.perssionTypeId = other.perssionTypeId; } + this.cascadePermission = other.cascadePermission; } public shareEntityWithGroups_args deepCopy() { @@ -39569,6 +39692,8 @@ public class GovRegistryService { this.entityId = null; this.groupList = null; this.perssionTypeId = null; + setCascadePermissionIsSet(false); + this.cascadePermission = false; } public String getEntityId() { @@ -39658,6 +39783,29 @@ public class GovRegistryService { } } + public boolean isCascadePermission() { + return this.cascadePermission; + } + + public shareEntityWithGroups_args setCascadePermission(boolean cascadePermission) { + this.cascadePermission = cascadePermission; + setCascadePermissionIsSet(true); + return this; + } + + public void unsetCascadePermission() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CASCADEPERMISSION_ISSET_ID); + } + + /** Returns true if field cascadePermission is set (has been assigned a value) and false otherwise */ + public boolean isSetCascadePermission() { + return EncodingUtils.testBit(__isset_bitfield, __CASCADEPERMISSION_ISSET_ID); + } + + public void setCascadePermissionIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CASCADEPERMISSION_ISSET_ID, value); + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case ENTITY_ID: @@ -39684,6 +39832,14 @@ public class GovRegistryService { } break; + case CASCADE_PERMISSION: + if (value == null) { + unsetCascadePermission(); + } else { + setCascadePermission((Boolean)value); + } + break; + } } @@ -39698,6 +39854,9 @@ public class GovRegistryService { case PERSSION_TYPE_ID: return getPerssionTypeId(); + case CASCADE_PERMISSION: + return isCascadePermission(); + } throw new IllegalStateException(); } @@ -39715,6 +39874,8 @@ public class GovRegistryService { return isSetGroupList(); case PERSSION_TYPE_ID: return isSetPerssionTypeId(); + case CASCADE_PERMISSION: + return isSetCascadePermission(); } throw new IllegalStateException(); } @@ -39759,6 +39920,15 @@ public class GovRegistryService { return false; } + boolean this_present_cascadePermission = true; + boolean that_present_cascadePermission = true; + if (this_present_cascadePermission || that_present_cascadePermission) { + if (!(this_present_cascadePermission && that_present_cascadePermission)) + return false; + if (this.cascadePermission != that.cascadePermission) + return false; + } + return true; } @@ -39781,6 +39951,11 @@ public class GovRegistryService { if (present_perssionTypeId) list.add(perssionTypeId); + boolean present_cascadePermission = true; + list.add(present_cascadePermission); + if (present_cascadePermission) + list.add(cascadePermission); + return list.hashCode(); } @@ -39822,6 +39997,16 @@ public class GovRegistryService { return lastComparison; } } + lastComparison = Boolean.valueOf(isSetCascadePermission()).compareTo(other.isSetCascadePermission()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCascadePermission()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cascadePermission, other.cascadePermission); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -39865,6 +40050,10 @@ public class GovRegistryService { sb.append(this.perssionTypeId); } first = false; + if (!first) sb.append(", "); + sb.append("cascadePermission:"); + sb.append(this.cascadePermission); + first = false; sb.append(")"); return sb.toString(); } @@ -39880,6 +40069,7 @@ public class GovRegistryService { if (perssionTypeId == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'perssionTypeId' was not present! Struct: " + toString()); } + // alas, we cannot check 'cascadePermission' because it's a primitive and you chose the non-beans generator. // check for sub-struct validity } @@ -39893,6 +40083,8 @@ public class GovRegistryService { private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); @@ -39951,6 +40143,14 @@ public class GovRegistryService { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 4: // CASCADE_PERMISSION + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.cascadePermission = iprot.readBool(); + struct.setCascadePermissionIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -39959,6 +40159,9 @@ public class GovRegistryService { iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetCascadePermission()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'cascadePermission' was not found in serialized data! Struct: " + toString()); + } struct.validate(); } @@ -39988,6 +40191,9 @@ public class GovRegistryService { oprot.writeString(struct.perssionTypeId); oprot.writeFieldEnd(); } + oprot.writeFieldBegin(CASCADE_PERMISSION_FIELD_DESC); + oprot.writeBool(struct.cascadePermission); + oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -40014,6 +40220,7 @@ public class GovRegistryService { } } oprot.writeString(struct.perssionTypeId); + oprot.writeBool(struct.cascadePermission); } @Override @@ -40034,6 +40241,8 @@ public class GovRegistryService { struct.setGroupListIsSet(true); struct.perssionTypeId = iprot.readString(); struct.setPerssionTypeIdIsSet(true); + struct.cascadePermission = iprot.readBool(); + struct.setCascadePermissionIsSet(true); } } http://git-wip-us.apache.org/repos/asf/airavata/blob/ea28a402/modules/sharing-registry/thrift_models/sharing_cpi.thrift ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/thrift_models/sharing_cpi.thrift b/modules/sharing-registry/thrift_models/sharing_cpi.thrift index d3cc54f..cec2543 100644 --- a/modules/sharing-registry/thrift_models/sharing_cpi.thrift +++ b/modules/sharing-registry/thrift_models/sharing_cpi.thrift @@ -88,9 +88,9 @@ service GovRegistryService { /** * Sharing Entity with Users and Groups **/ - bool shareEntityWithUsers(1: required string entityId, 2: required list<string> userList, 3: required string perssionTypeId) throws (1: sharing_models.GovRegistryException gre) - bool revokeEntitySharingFromUsers(1: required string entityId, 2: required list<string> userList, 3: required string perssionTypeId) throws (1: sharing_models.GovRegistryException gre) - bool shareEntityWithGroups(1: required string entityId, 2: required list<string> groupList, 3: required string perssionTypeId) throws (1: sharing_models.GovRegistryException gre) + bool shareEntityWithUsers(1: required string entityId, 2: required list<string> userList, 3: required string perssionTypeId, 4: required bool cascadePermission) throws (1: sharing_models.GovRegistryException gre) + bool revokeEntitySharingFromUsers(1: required string entityId, 2: required list<string> userList, 3: required string perssionTypeId ) throws (1: sharing_models.GovRegistryException gre) + bool shareEntityWithGroups(1: required string entityId, 2: required list<string> groupList, 3: required string perssionTypeId, 4: required bool cascadePermission) throws (1: sharing_models.GovRegistryException gre) bool revokeEntitySharingFromGroups(1: required string entityId, 2: required list<string> groupList, 3: required string perssionTypeId) throws (1: sharing_models.GovRegistryException gre) bool userHasAccess(1: required string domainId, 2: required string userId, 3: required string entityId, 4: required string permissionTypeId) throws (1: sharing_models.GovRegistryException gre) } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/ea28a402/modules/sharing-registry/thrift_models/sharing_models.thrift ---------------------------------------------------------------------- diff --git a/modules/sharing-registry/thrift_models/sharing_models.thrift b/modules/sharing-registry/thrift_models/sharing_models.thrift index 5670c5e..6dd3983 100644 --- a/modules/sharing-registry/thrift_models/sharing_models.thrift +++ b/modules/sharing-registry/thrift_models/sharing_models.thrift @@ -109,8 +109,9 @@ struct PermissionType { } enum SharingType { - DIRECT, - INHERITED + DIRECT_NON_CASCADING, + DIRECT_CASCADING, + INDIRECT_CASCADING } struct Sharing { @@ -120,8 +121,9 @@ struct Sharing { 4: optional GroupType groupType, 5: optional SharingType sharingType, 6: optional string inheritedParentId, - 7: optional i64 createdTime, - 8: optional i64 updatedTime + 7: optional bool cascadePermission, + 8: optional i64 createdTime, + 9: optional i64 updatedTime } exception GovRegistryException {
