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

TASK-4389 - OpenCGA Catalog - Organizations #2375

merged 101 commits into from
Feb 15, 2024

Conversation

pfurio
Copy link
Member

@pfurio pfurio commented Jan 17, 2024

TASK-4389

pfurio added 30 commits July 14, 2023 15:02
@pfurio pfurio requested a review from j-coll February 9, 2024 10:14
juanfeSanahuja
juanfeSanahuja previously approved these changes Feb 9, 2024

if (!isInstallationAdministrator(userId) && !isAdministrativeUser(studyId, userId)) {
throw new CatalogAuthorizationException("Only administrative users are allowed to assign/remove users to groups.");
if (ADMINS_GROUP.equals(group) && !isOrganizationOwnerOrAdmin(organizationId, userId)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this also allow "opencgaAdministrator" ? 99% of the calls to the method "isOrganizatoinOwnerOrAdmin" include a call to "isOpencgaAdministrator". Shouldn't we have a method that checks if is "at least" organizationAdmin? This would include:

  • opencgaAdministrator
  • organizationOwner
  • organizationAdministrator

Some similar methods might be helpful

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. To be changed in the next release.

/**
* Check if the user is part of the {@link ParamConstants#ADMINS_GROUP} group of the study.
* Keep in mind that all organization admins and the organization owner are also study admins.
* It does not include the opencga admins.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isStudyAdmin includes

  • studyAdmin
  • organizationAdmin
  • organizationOwner

but excludes "opencgaAdmin" .. why? Same as before, we have a lot of queries to both methods:

!isOpencgaAdministrator(organizationId, userId) && !isStudyAdministrator(organizationId, studyId, userId) 

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that there is nothing that an opencgaAdministrator shouldn't be allowed to do

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. To be changed in the next release.

@@ -131,13 +130,6 @@ enum QueryParams implements QueryParam {
BATTRIBUTES("battributes", BOOLEAN, ""), // "Format: <key><operation><true|false> where <operation> is [==|!=]"

PROJECTS("projects", TEXT_ARRAY, ""),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still used?

Copy link
Member Author

@pfurio pfurio Feb 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it will be removed in the next release.

@@ -117,6 +117,7 @@
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<scope>test</scope>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the other solr-related dependencies are not needed.
I can only see one usage at org.opencb.opencga.catalog.managers.StudyManagerTest , and it should be replaced with comons-lang3

import org.apache.solr.common.StringUtils;
import org.apache.commons.lang3.StringUtils;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. To be changed in the next release.


public class JwtPayload {

private String userId;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these fields be "final"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, to be changed in the next release.

j-coll
j-coll previously approved these changes Feb 14, 2024
@pfurio pfurio merged commit 4c9fc9c into develop Feb 15, 2024
8 of 9 checks passed
@pfurio pfurio deleted the TASK-4389 branch February 15, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants