data-resource-management-service/drms-graph-impl/drms-api/src/main/java/org/apache/airavata/drms/api/handlers/SharingServiceHandler.java [198:238]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                Entity entity = Entity.newBuilder().setId(request.getEntityId()).build();
                PermissionType permissionTypeEditor = PermissionType.newBuilder().setId("EDITOR").build();
                PermissionType permissionTypeAdmin = PermissionType.newBuilder().setId("ADMIN").build();

                SharingRequest sharingRequestEditor = SharingRequest
                        .newBuilder()
                        .setClientId(tenantId)
                        .setEntity(entity)
                        .setPermissionType(permissionTypeEditor)
                        .addOwnerId(username).build();
                org.apache.custos.sharing.service.Status status = sharingManagementClient
                        .userHasAccess(tenantId, sharingRequestEditor);
                SharingRequest sharingRequestAdmin = SharingRequest
                        .newBuilder()
                        .setClientId(tenantId)
                        .setEntity(entity)
                        .setPermissionType(permissionTypeAdmin)
                        .addOwnerId(username).build();
                org.apache.custos.sharing.service.Status statusAdmin = sharingManagementClient
                        .userHasAccess(tenantId, sharingRequestAdmin);
                if (status.getStatus() || statusAdmin.getStatus()) {
                    SharingRequest shrRequest = SharingRequest
                            .newBuilder()
                            .setClientId(tenantId)
                            .setEntity(entity)
                            .setPermissionType(PermissionType.newBuilder().setId(request.getPermissionId()).build())
                            .addOwnerId(request.getRevokedGroupId()).build();
                    sharingManagementClient.revokeEntitySharingFromGroups(tenantId, shrRequest);
                    responseObserver.onNext(Empty.newBuilder().build());
                    responseObserver.onCompleted();

                } else {
                    String msg = "You don't have permission to manage sharing";
                    LOGGER.error(msg);
                    responseObserver.onError(Status.PERMISSION_DENIED.withDescription(msg).asRuntimeException());
                }
            }
        } catch (Exception ex) {
            LOGGER.error("Error occurred while revoking entity with user {}", request.getRevokedGroupId());
            String msg = "Error occurred while revoking entity with user {}" + request.getRevokedGroupId();
            responseObserver.onError(Status.INTERNAL.withDescription(msg).asRuntimeException());
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



data-resource-management-service/drms-rdbms-impl/drms-server/src/main/java/org/apache/airavata/drms/api/handlers/SharingServiceHandler.java [200:240]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                Entity entity = Entity.newBuilder().setId(request.getEntityId()).build();
                PermissionType permissionTypeEditor = PermissionType.newBuilder().setId("EDITOR").build();
                PermissionType permissionTypeAdmin = PermissionType.newBuilder().setId("ADMIN").build();

                SharingRequest sharingRequestEditor = SharingRequest
                        .newBuilder()
                        .setClientId(tenantId)
                        .setEntity(entity)
                        .setPermissionType(permissionTypeEditor)
                        .addOwnerId(username).build();
                org.apache.custos.sharing.service.Status status = sharingManagementClient
                        .userHasAccess(tenantId, sharingRequestEditor);
                SharingRequest sharingRequestAdmin = SharingRequest
                        .newBuilder()
                        .setClientId(tenantId)
                        .setEntity(entity)
                        .setPermissionType(permissionTypeAdmin)
                        .addOwnerId(username).build();
                org.apache.custos.sharing.service.Status statusAdmin = sharingManagementClient
                        .userHasAccess(tenantId, sharingRequestAdmin);
                if (status.getStatus() || statusAdmin.getStatus()) {
                    SharingRequest shrRequest = SharingRequest
                            .newBuilder()
                            .setClientId(tenantId)
                            .setEntity(entity)
                            .setPermissionType(PermissionType.newBuilder().setId(request.getPermissionId()).build())
                            .addOwnerId(request.getRevokedGroupId()).build();
                    sharingManagementClient.revokeEntitySharingFromGroups(tenantId, shrRequest);
                    responseObserver.onNext(Empty.newBuilder().build());
                    responseObserver.onCompleted();

                } else {
                    String msg = "You don't have permission to manage sharing";
                    LOGGER.error(msg);
                    responseObserver.onError(Status.PERMISSION_DENIED.withDescription(msg).asRuntimeException());
                }
            }
        } catch (Exception ex) {
            LOGGER.error("Error occurred while revoking entity with user {}", request.getRevokedGroupId());
            String msg = "Error occurred while revoking entity with user {}" + request.getRevokedGroupId();
            responseObserver.onError(Status.INTERNAL.withDescription(msg).asRuntimeException());
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



