public Map<ResourceDescriptor, Set<ResourceAccessType>> getPermissions(
            String bucket, String location, Set<ResourceDescriptor> allResources) {
        Map<ResourceType, List<ResourceDescriptor>> privateResourcesByTypes = allResources.stream()
                .filter(ResourceDescriptor::isPrivate)
                .collect(Collectors.groupingBy(ResourceDescriptor::getType));
        Map<ResourceDescriptor, Set<ResourceAccessType>> result = new HashMap<>();
        privateResourcesByTypes.forEach((type, resources) -> {
            ResourceDescriptor shareResource = getShareResource(ResourceTypes.SHARED_WITH_ME, type, bucket, location);

            String state = resourceService.getResource(shareResource);
            SharedResources sharedResources = ProxyUtil.convertToObject(state, SharedResources.class);
            if (sharedResources == null) {
                log.debug("No state found for share access");
                return;
            }

            Map<String, Set<ResourceAccessType>> resourcePermissions =
                    sharedResourcesToMap(sharedResources.getResources());
            for (ResourceDescriptor resource : resources) {
                result.put(resource, lookupPermissions(resource, resourcePermissions, new HashMap<>()));
            }
        });

        return result;
    }
Accept an invitation to grand share access for provided resources

@param invitationId - invitation ID
server/src/main/java/com/epam/aidial/core/server/service/ShareService.java