Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK-4389 - OpenCGA Catalog - Organizations #2375

Merged
merged 101 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
b76f2dc
catalog: start organization implementation, #TASK-4389
pfurio Jul 14, 2023
a19c61e
catalog: create Organization db adaptor, #TASK-4389
pfurio Aug 10, 2023
91b5aed
catalog: create a single database per organization, #TASK-4389
pfurio Aug 11, 2023
1de04f2
catalog: add organizationId to some managers, #TASK-4389
pfurio Aug 28, 2023
31a7811
catalog: add organizationId to File, Study managers, #TASK-4389
pfurio Aug 30, 2023
a31fc46
Merge branch 'develop' into TASK-4389
pfurio Aug 30, 2023
60103f0
catalog: add organizationId to Individual and Interpretation Managers
pfurio Aug 30, 2023
c7866c4
core: add organizationId to Job manager, #TASK-4389
pfurio Sep 1, 2023
8028603
organizations: work in progress #TASK-4389
pfurio Sep 8, 2023
0bff62f
Merge branch 'develop' into TASK-4389
pfurio Sep 11, 2023
9844259
organizations: start removal of organization from public api, TASK-4389
pfurio Sep 18, 2023
3389db5
org: remove from Cohort, Case and Sample, #TASK-4389
pfurio Sep 20, 2023
796bd18
org: remove from Family, File and Individual, #TASK-4389
pfurio Sep 20, 2023
0e9d364
org: remove from Interpretation, Panel, #TASK-4389
pfurio Sep 20, 2023
a98e6f1
org: add new jwtpayload, #TASK-4389
pfurio Sep 26, 2023
52806dd
org: include jwtpayload in managers, #TASK-4389
pfurio Sep 27, 2023
915623e
org: fix issues in managers, #TASK-4389
pfurio Sep 29, 2023
008adc6
org: catalog module compiles, #TASK-4389
pfurio Oct 2, 2023
ac53d47
catalog: improve Organization data model, #TASK-4389
pfurio Oct 16, 2023
d882956
catalog: first catalog tests, #TASK-4389
pfurio Oct 18, 2023
114ad40
catalog: first catalog test work, #TASK-4389
pfurio Oct 24, 2023
2ce5bc5
catalog: improve testing performance, #TASK-4389
pfurio Oct 25, 2023
17d1ca4
catalog: fix all db adaptor tests, #TASK-4389
pfurio Oct 27, 2023
8621912
catalog: fix test restoration, #TASK-4389
pfurio Oct 31, 2023
9becd06
catalog: fix serveral tests, #TASK-4389
pfurio Nov 2, 2023
4172613
catalog: fix more tests, #TASK-4389
pfurio Nov 7, 2023
8ce6ada
catalog: all catalog tests working, #TASK-4389
pfurio Nov 9, 2023
1b4d882
Merge branch 'develop' into TASK-4389
pfurio Nov 9, 2023
09054d1
analysis: fix several analysis, #TASK-4389
pfurio Nov 20, 2023
b3fc4af
catalog: fixes in Catalog, #TASK-4389
pfurio Nov 23, 2023
2cff31a
analysis: hide solr index, #TASK-4389
pfurio Nov 24, 2023
b8e8985
analysis: fix compilation issues from analysis tests, #TASK-4389
pfurio Nov 24, 2023
7b30c83
analysis: Fix variantStorageManager audit #TASK-4389
j-coll Nov 24, 2023
f4badcf
Merge branch 'develop' into TASK-4389
pfurio Dec 1, 2023
c3e90d8
catalog: organization compiles, #TASK-4389
pfurio Dec 4, 2023
8ed7340
catalog: add organization migration, #TASK-4389
pfurio Dec 4, 2023
c5e5e35
Merge branch 'TASK-4389' of github.com:opencb/opencga into TASK-4389
pfurio Dec 13, 2023
33c041d
app: fix migration, #TASK-4389
pfurio Dec 15, 2023
91012e8
catalog: avoid npe, #TASK-4389
pfurio Dec 15, 2023
6fa15c4
catalog: avoid next possible npe issue, #TASK-4389
pfurio Dec 15, 2023
74ee6fe
server: add new Organization web service, #TASK-4389
pfurio Dec 18, 2023
93e4325
app: generate cli, #TASK-4389
pfurio Dec 18, 2023
2259ed5
catalog: include migration executions, #TASK-4389
pfurio Dec 19, 2023
2387845
catalog: fix execution daemon issues, #TASK-4389
pfurio Dec 19, 2023
88d6dab
catalog: make annotation set id optional, #TASK-4389
pfurio Dec 21, 2023
a039cad
Merge branch 'develop' into TASK-4389
pfurio Jan 12, 2024
ebf2212
catalog: fix tests, #TASK-4389
pfurio Jan 12, 2024
9bf8af7
app: migration does not fail if already migrated
pfurio Jan 12, 2024
bc70072
catalog: organization id optional on login, #TASK-4389
pfurio Jan 15, 2024
5c4fe5e
workaround for ci-cd
pfurio Jan 15, 2024
1e5d075
app: fix migration, #TASK-4389
pfurio Jan 16, 2024
3028cf4
catalog: change collection naming order, #TASK-4389
pfurio Jan 17, 2024
a60f4fe
analysis: Fix some tests issues related with orgs #TASK-5415
j-coll Jan 17, 2024
00ce46e
catalog: fix duplicated organization when creating a user, #TASK-4389
pfurio Jan 18, 2024
bb76439
catalog: Change all FQN references with user@ #TASK-4389
j-coll Jan 18, 2024
488dafd
analysis: Fix some tests issues related with orgs #TASK-5415
j-coll Jan 18, 2024
eb51514
Merge branch 'TASK-4389' of github.com:opencb/opencga into TASK-4389
pfurio Jan 18, 2024
0661394
Merge branch 'TASK-4389' of github.com:opencb/opencga into TASK-4389
j-coll Jan 19, 2024
90eea90
catalog: Use CatalogManagerExternalResource as a ClassRule #TASK-4389
j-coll Jan 19, 2024
0272529
catalog: ensure there's always an authOrigin, #TASK-4389
pfurio Jan 19, 2024
9bbf7b8
catalog: remove unused users folder, #TASK-4389
pfurio Jan 19, 2024
99ceffd
app: autogenerate libraries, #TASK-4389
pfurio Jan 19, 2024
def6837
catalog: Review method names at AuthorizationManager. #TASK-4389
j-coll Jan 19, 2024
560ca9c
master: Ensure tools are executed as expected. #TASK-4389
j-coll Jan 19, 2024
bed7ff3
Merge branch 'TASK-4389' of github.com:opencb/opencga into TASK-4389
j-coll Jan 19, 2024
fd5e60d
analysis: Fix all tests issues related with orgs #TASK-5415
j-coll Jan 22, 2024
695cc43
app: create missing organization and project directories, #TASK-4389
pfurio Jan 23, 2024
632bfc8
catalog: fix usage of deprecated authOrigins, #TASK-4389
pfurio Jan 24, 2024
0ad6038
app: organization is no longer required on login, #TASK-4389
pfurio Jan 24, 2024
54d1a0f
catalog: check for new organizations in AuthFactory, #TASK-4389
pfurio Jan 24, 2024
fbb1e08
catalog: fix mongo cli builder, #TASK-4389
pfurio Jan 24, 2024
eb474b2
app: fix migration to include default AuthOrigin, #TASK-4389
pfurio Jan 25, 2024
1a6c350
app: set new auth origin for admin organization, #TASK-4389
pfurio Jan 29, 2024
b6ae4ce
Merge branch 'develop' into TASK-4389
pfurio Jan 29, 2024
d98ac47
core: add Settings fields, #TASK-4389
pfurio Jan 30, 2024
7460062
server: add /anonymous web service, #TASK-4389
pfurio Jan 31, 2024
5cdcdc3
catalog: forbid creating of 'opencga' user, #TASK-4389
pfurio Jan 31, 2024
28526f8
core: fix project constructor, #TASK-4389
pfurio Jan 31, 2024
1847c32
app: Add organizations awareness to catalog status. Make some --organ…
j-coll Jan 31, 2024
8e289fb
Merge branch 'TASK-4389' of github.com:opencb/opencga into TASK-4389
j-coll Feb 1, 2024
3aefdd8
catalog: add uid to Settings, #TASK-4389
pfurio Feb 2, 2024
336e1bd
catalog: fix check if user is super admin, #TASK-4389
pfurio Feb 6, 2024
676d874
app: Improve logging around storage status #TASK-4389
j-coll Feb 6, 2024
2942d77
catalog: fix method description, #TASK-4389
pfurio Feb 7, 2024
d8c27a9
catalog: rename Settings to Notes, #TASK-4389
pfurio Feb 7, 2024
2a82e71
Merge branch 'develop' into TASK-4389
pfurio Feb 7, 2024
5c3f8f5
catalog: fix effective permission tests, #TASK-4389
pfurio Feb 8, 2024
e407360
app: add missing organization field to all users, #TASK-4389
pfurio Feb 8, 2024
cd36edb
core: rename organizationId to organization, #TASK-4389
pfurio Feb 9, 2024
638284e
Merge branch 'develop' into TASK-4389
pfurio Feb 9, 2024
09ac76a
catalog: fix tests, #TASK-4389
pfurio Feb 9, 2024
9e10275
analysis: delete summary stats tasks, #TASK-4389
pfurio Feb 9, 2024
929949c
catalog: clean solr related code, #TASK-4389
pfurio Feb 9, 2024
96e35be
catalog: remove deprecated method isOpencga, #TASK-4389
pfurio Feb 9, 2024
f2fe884
app: Fix command storage update-database-prefix #TASK-4389
j-coll Feb 9, 2024
1999552
master: remove non-existing operation ids, #TASK-4389
pfurio Feb 12, 2024
4dd1b28
catalog: use ANONYMOUS constant, #TASK-4389
pfurio Feb 12, 2024
758dada
catalog: improve error message, #TASK-4389
pfurio Feb 12, 2024
a87a99f
Merge branch 'TASK-4389' of github.com:opencb/opencga into TASK-4389
pfurio Feb 12, 2024
5444467
catalog: fix check is opencga administrator, #TASK-4389
pfurio Feb 12, 2024
2c7013a
Merge branch 'develop' into TASK-4389
pfurio Feb 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<module name="Checker">
<module name="FileLength">
<property name="max" value="4100"/>
<property name="max" value="4500"/>
</module>
<module name="FileTabCharacter"/>
<module name="NewlineAtEndOfFile"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.opencb.opencga.analysis;

import org.opencb.biodata.models.clinical.qc.RelatednessScore;
import org.opencb.commons.datastore.core.Query;
import org.opencb.commons.datastore.core.QueryOptions;
import org.opencb.opencga.catalog.db.api.FileDBAdaptor;
Expand All @@ -17,8 +16,6 @@
import java.nio.file.Path;
import java.util.*;

import static org.opencb.opencga.core.api.ParamConstants.SAMTOOLS_COMMANDS_SUPPORTED;

public class AnalysisUtils {

public static boolean isSupportedCommand(String commands) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import org.opencb.opencga.catalog.db.api.ProjectDBAdaptor;
import org.opencb.opencga.catalog.exceptions.CatalogException;
import org.opencb.opencga.catalog.managers.CatalogManager;
import org.opencb.opencga.catalog.utils.CatalogFqn;
import org.opencb.opencga.core.models.JwtPayload;
import org.opencb.opencga.core.models.project.Project;
import org.opencb.opencga.core.response.OpenCGAResult;

Expand Down Expand Up @@ -116,7 +118,12 @@ public static DownloadedRefGenome downloadRefGenome(String assembly, Path outDir
public static String getAssembly(CatalogManager catalogManager, String studyId, String sessionId) throws CatalogException {
String assembly = "";
OpenCGAResult<Project> projectQueryResult;
projectQueryResult = catalogManager.getProjectManager().search(new Query(ProjectDBAdaptor.QueryParams.STUDY.key(), studyId),

JwtPayload jwtPayload = catalogManager.getUserManager().validateToken(sessionId);
CatalogFqn studyFqn = CatalogFqn.extractFqnFromStudy(studyId, jwtPayload);
String organizationId = studyFqn.getOrganizationId();

projectQueryResult = catalogManager.getProjectManager().search(organizationId, new Query(ProjectDBAdaptor.QueryParams.STUDY.key(), studyId),
new QueryOptions(QueryOptions.INCLUDE, ProjectDBAdaptor.QueryParams.ORGANISM.key()), sessionId);
if (CollectionUtils.isNotEmpty(projectQueryResult.getResults())
&& projectQueryResult.first().getOrganism() != null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
import org.opencb.opencga.catalog.db.api.ProjectDBAdaptor;
import org.opencb.opencga.catalog.exceptions.CatalogException;
import org.opencb.opencga.catalog.managers.CatalogManager;
import org.opencb.opencga.catalog.utils.CatalogFqn;
import org.opencb.opencga.core.config.Configuration;
import org.opencb.opencga.core.config.storage.StorageConfiguration;
import org.opencb.opencga.core.models.JwtPayload;
import org.opencb.opencga.core.models.file.File;
import org.opencb.opencga.core.models.project.DataStore;
import org.opencb.opencga.core.models.project.Project;
Expand Down Expand Up @@ -73,19 +75,6 @@ protected StorageManager(CatalogManager catalogManager, CacheManager cacheManage
logger = LoggerFactory.getLogger(getClass());
}


public void clearCache(String sessionId) throws CatalogException {
String userId = catalogManager.getUserManager().getUserId(sessionId);

}


public void clearCache(String studyId, String sessionId) throws CatalogException {
String userId = catalogManager.getUserManager().getUserId(sessionId);

}


public abstract void testConnection() throws StorageEngineException;

@Deprecated
Expand All @@ -95,18 +84,20 @@ protected StudyInfo getStudyInfo(@Nullable String studyIdStr, String fileIdStr,
}

@Deprecated
protected StudyInfo getStudyInfo(@Nullable String studyIdStr, List<String> fileIdStrs, String sessionId)
throws CatalogException {
StudyInfo studyInfo = new StudyInfo().setSessionId(sessionId);
protected StudyInfo getStudyInfo(@Nullable String studyIdStr, List<String> fileIdStrs, String token) throws CatalogException {
StudyInfo studyInfo = new StudyInfo().setSessionId(token);

JwtPayload jwtPayload = catalogManager.getUserManager().validateToken(token);
CatalogFqn catalogFqn = CatalogFqn.extractFqnFromStudy(studyIdStr, jwtPayload);
String organizationId = catalogFqn.getOrganizationId();

String userId = catalogManager.getUserManager().getUserId(sessionId);
Study study = catalogManager.getStudyManager().get(studyIdStr, QueryOptions.empty(), sessionId).first();
Study study = catalogManager.getStudyManager().get(studyIdStr, QueryOptions.empty(), token).first();

List<File> files;
if (fileIdStrs.isEmpty()) {
files = Collections.emptyList();
} else {
DataResult<File> queryResult = catalogManager.getFileManager().get(studyIdStr, fileIdStrs, null, sessionId);
DataResult<File> queryResult = catalogManager.getFileManager().get(studyIdStr, fileIdStrs, null, token);
files = queryResult.getResults();
}
List<FileInfo> fileInfos = new ArrayList<>(fileIdStrs.size());
Expand All @@ -130,17 +121,15 @@ protected StudyInfo getStudyInfo(@Nullable String studyIdStr, List<String> fileI

studyInfo.setStudy(study);
String projectFqn = catalogManager.getStudyManager().getProjectFqn(study.getFqn());
Project project = catalogManager.getProjectManager().search(new Query(ProjectDBAdaptor.QueryParams.FQN.key(), projectFqn),
new QueryOptions(), sessionId).first();
Project project = catalogManager.getProjectManager().search(organizationId, new Query(ProjectDBAdaptor.QueryParams.FQN.key(), projectFqn),
new QueryOptions(), token).first();
studyInfo.setProjectUid(project.getUid());
studyInfo.setProjectId(project.getId());
studyInfo.setOrganism(project.getOrganism());
String user = catalogManager.getProjectManager().getOwner(project.getUid());
studyInfo.setUserId(user);

Map<File.Bioformat, DataStore> dataStores = new HashMap<>();
dataStores.put(File.Bioformat.VARIANT, getDataStore(catalogManager, study.getFqn(), File.Bioformat.VARIANT, sessionId));
dataStores.put(File.Bioformat.ALIGNMENT, getDataStore(catalogManager, study.getFqn(), File.Bioformat.ALIGNMENT, sessionId));
dataStores.put(File.Bioformat.VARIANT, getDataStore(catalogManager, study.getFqn(), File.Bioformat.VARIANT, token));
dataStores.put(File.Bioformat.ALIGNMENT, getDataStore(catalogManager, study.getFqn(), File.Bioformat.ALIGNMENT, token));
studyInfo.setDataStores(dataStores);

return studyInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@
import org.opencb.commons.datastore.core.ObjectMap;
import org.opencb.commons.datastore.core.Query;
import org.opencb.commons.datastore.core.QueryOptions;
import org.opencb.commons.utils.FileUtils;
import org.opencb.opencga.analysis.StorageManager;
import org.opencb.opencga.analysis.models.FileInfo;
import org.opencb.opencga.analysis.models.StudyInfo;
import org.opencb.opencga.catalog.db.api.FileDBAdaptor;
import org.opencb.opencga.catalog.db.api.ProjectDBAdaptor;
import org.opencb.opencga.catalog.exceptions.CatalogException;
import org.opencb.opencga.catalog.managers.CatalogManager;
import org.opencb.opencga.catalog.utils.CatalogFqn;
import org.opencb.opencga.catalog.utils.ParamUtils;
import org.opencb.opencga.core.exceptions.ToolException;
import org.opencb.opencga.core.models.JwtPayload;
import org.opencb.opencga.core.models.file.File;
import org.opencb.opencga.core.models.project.Project;
import org.opencb.opencga.core.models.study.Study;
Expand Down Expand Up @@ -219,9 +220,13 @@ public OpenCGAResult<GeneCoverageStats> coverageStats(String studyIdStr, String
File file = extractAlignmentOrCoverageFile(studyIdStr, fileIdStr, token);
// System.out.println("file = " + file.getUri());

JwtPayload jwtPayload = new JwtPayload(token);
CatalogFqn studyFqn = CatalogFqn.extractFqnFromStudy(studyIdStr, jwtPayload);
String organizationId = studyFqn.getOrganizationId();

// Get species and assembly from catalog
OpenCGAResult<Project> projectQueryResult = catalogManager.getProjectManager().search(
new Query(ProjectDBAdaptor.QueryParams.STUDY.key(), studyIdStr),
organizationId, new Query(ProjectDBAdaptor.QueryParams.STUDY.key(), studyIdStr),
new QueryOptions(QueryOptions.INCLUDE, Arrays.asList(ProjectDBAdaptor.QueryParams.ORGANISM.key(),
ProjectDBAdaptor.QueryParams.CELLBASE.key())), token);
if (projectQueryResult.getNumResults() != 1) {
Expand Down Expand Up @@ -437,9 +442,12 @@ public List<Region> mergeRegions(List<Region> regions, List<String> genes, boole
}
}

JwtPayload jwtPayload = new JwtPayload(token);
CatalogFqn studyFqn = CatalogFqn.extractFqnFromStudy(study, jwtPayload);
String organizationId = studyFqn.getOrganizationId();
// Get species and assembly from catalog
OpenCGAResult<Project> projectQueryResult = catalogManager.getProjectManager().search(
new Query(ProjectDBAdaptor.QueryParams.STUDY.key(), study),
organizationId, new Query(ProjectDBAdaptor.QueryParams.STUDY.key(), study),
new QueryOptions(QueryOptions.INCLUDE, Arrays.asList(
ProjectDBAdaptor.QueryParams.ORGANISM.key(),
ProjectDBAdaptor.QueryParams.CELLBASE.key())), token);
Expand Down Expand Up @@ -562,23 +570,6 @@ private void checkAlignmentBioformat(List<FileInfo> fileInfo) throws CatalogExce
public void testConnection() throws StorageEngineException {
}

@Deprecated
private Path getFilePath(long fileId, String sessionId) throws CatalogException, IOException {
QueryOptions fileOptions = new QueryOptions(QueryOptions.INCLUDE,
Arrays.asList(FileDBAdaptor.QueryParams.URI.key(), FileDBAdaptor.QueryParams.NAME.key()));
OpenCGAResult<File> fileResult = catalogManager.getFileManager().get(fileId, fileOptions, sessionId);

if (fileResult.getNumResults() != 1) {
logger.error("Critical error: File {} not found in catalog.", fileId);
throw new CatalogException("Critical error: File " + fileId + " not found in catalog");
}

Path path = Paths.get(fileResult.first().getUri().getRawPath());
FileUtils.checkFile(path);

return path;
}

@Deprecated
private Path getWorkspace(long studyId, String sessionId) throws CatalogException, IOException {
// Obtain the study uri
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.opencb.opencga.analysis.alignment.qc;

import org.apache.commons.lang3.StringUtils;
import org.opencb.biodata.formats.alignment.samtools.SamtoolsFlagstats;
import org.opencb.biodata.formats.sequence.fastqc.FastQcMetrics;
import org.opencb.biodata.formats.sequence.fastqc.io.FastQcParser;
import org.opencb.commons.datastore.core.Query;
Expand All @@ -29,8 +28,6 @@
import org.opencb.opencga.core.models.alignment.AlignmentFastQcMetricsParams;
import org.opencb.opencga.core.models.common.Enums;
import org.opencb.opencga.core.models.file.File;
import org.opencb.opencga.core.models.file.FileQualityControl;
import org.opencb.opencga.core.models.file.FileUpdateParams;
import org.opencb.opencga.core.response.OpenCGAResult;
import org.opencb.opencga.core.tools.annotations.Tool;
import org.opencb.opencga.core.tools.annotations.ToolParams;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
import org.opencb.opencga.core.models.alignment.AlignmentFlagStatsParams;
import org.opencb.opencga.core.models.common.Enums;
import org.opencb.opencga.core.models.file.File;
import org.opencb.opencga.core.models.file.FileQualityControl;
import org.opencb.opencga.core.models.file.FileUpdateParams;
import org.opencb.opencga.core.response.OpenCGAResult;
import org.opencb.opencga.core.tools.annotations.Tool;
import org.opencb.opencga.core.tools.annotations.ToolParams;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.opencb.opencga.analysis.alignment.qc;

import org.apache.commons.lang3.StringUtils;
import org.opencb.biodata.formats.alignment.picard.HsMetrics;
import org.opencb.biodata.formats.alignment.samtools.SamtoolsFlagstats;
import org.opencb.biodata.formats.alignment.samtools.SamtoolsStats;
import org.opencb.biodata.formats.sequence.fastqc.FastQcMetrics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.opencb.biodata.formats.alignment.samtools.SamtoolsFlagstats;
import org.opencb.biodata.formats.alignment.samtools.SamtoolsStats;
import org.opencb.biodata.formats.alignment.samtools.io.SamtoolsFlagstatsParser;
import org.opencb.commons.datastore.core.Query;
import org.opencb.commons.datastore.core.QueryOptions;
import org.opencb.opencga.analysis.tools.OpenCgaToolScopeStudy;
Expand All @@ -32,8 +30,6 @@
import org.opencb.opencga.core.models.alignment.AlignmentStatsParams;
import org.opencb.opencga.core.models.common.Enums;
import org.opencb.opencga.core.models.file.File;
import org.opencb.opencga.core.models.file.FileQualityControl;
import org.opencb.opencga.core.models.file.FileUpdateParams;
import org.opencb.opencga.core.response.OpenCGAResult;
import org.opencb.opencga.core.tools.annotations.Tool;
import org.opencb.opencga.core.tools.annotations.ToolParams;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
import org.opencb.opencga.catalog.exceptions.CatalogException;
import org.opencb.opencga.catalog.managers.FileManager;
import org.opencb.opencga.catalog.utils.AnnotationUtils;
import org.opencb.opencga.catalog.utils.CatalogFqn;
import org.opencb.opencga.catalog.utils.Constants;
import org.opencb.opencga.core.api.ParamConstants;
import org.opencb.opencga.core.exceptions.ToolException;
import org.opencb.opencga.core.models.JwtPayload;
import org.opencb.opencga.core.models.common.AnnotationSet;
import org.opencb.opencga.core.models.file.File;
import org.opencb.opencga.core.models.sample.SamplePermissions;
Expand Down Expand Up @@ -71,7 +73,9 @@ public void setStudy(String study) {

@Override
protected void check() throws Exception {
String userId = catalogManager.getUserManager().getUserId(token);
JwtPayload jwtPayload = catalogManager.getUserManager().validateToken(token);
CatalogFqn studyFqn = CatalogFqn.extractFqnFromStudy(study, jwtPayload);
String userId = jwtPayload.getUserId(studyFqn.getOrganizationId());

OpenCGAResult<File> fileResult = catalogManager.getFileManager().get(study, path, FileManager.INCLUDE_FILE_URI_PATH, token);
if (fileResult.getNumResults() == 0) {
Expand Down
Loading
Loading