private List<MetadataBase> linksToMetadata(Map<String, Set<ResourceAccessType>> links) {
        return links.entrySet().stream()
                .map(entry -> {
                    String link = entry.getKey();
                    Set<ResourceAccessType> permissions = entry.getValue();
                    ResourceDescriptor resource = ResourceDescriptorFactory.fromPrivateUrl(link, encryptionService);
                    MetadataBase metadata = resource.isFolder()
                            ? new ResourceFolderMetadata(resource)
                            : new ResourceItemMetadata(resource);
                    metadata.setPermissions(permissions);
                    return metadata;
                }).toList();
    }
Revoke share access for provided resources. Only resource owner can perform this operation

@param bucket              - user bucket
@param location            - storage location
@param permissionsToRevoke - collection of resources and permissions to revoke access
server/src/main/java/com/epam/aidial/core/server/service/ShareService.java