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

Feat: working version tying permissions to teamproject role #101

Conversation

pieterlukasse
Copy link

@pieterlukasse pieterlukasse commented Nov 17, 2023

--------Please refer to PR #107 for the latest review--------

Jira Ticket: VADC-809

New Features

Example:

Creating a cohort (with id 8) while logged in as a team member of "team project" def, results in the following records:

"def"	"cohortdefinition:8:check:post"
"def"	"cohortdefinition:8:put"
"def"	"cohortdefinition:8:delete"
"def"	"cohortdefinition:8:version:*:get"
"def"	"cohortdefinition:8:info:get"
"def"	"cohortdefinition:8:get"
"def"	"cohortdefinition:8:version:get"

Query used for list above:

select 
    sec_role.name, sec_permission.value
  from
    webapi.sec_role 
    inner join webapi.sec_role_permission on sec_role.id = sec_role_permission.role_id
    inner join webapi.sec_permission on sec_role_permission.permission_id = sec_permission.id
 where 
   sec_role.name = 'def'

Motivation

Motivation for this PR is twofold:

  1. This change ensures that when another user logs in with the same "team project" (def in this case), this user will get the role def assigned and thus inherit access to cohorts accessible to this role (8 in this case).

  2. By linking the cohorts to a "team project" role instead of linking them directly to a user, it becomes possible to get the complete list of all cohorts for a given "team project" (which is useful in other scenarios / for some of the other non-atlas tooling integrating with this DB)

Merge order

Should be merged after vinci-ohdsi#5

@pieterlukasse pieterlukasse changed the title wip: working version tying permissions to teamproject role Feat: working version tying permissions to teamproject role Nov 17, 2023
@pieterlukasse pieterlukasse force-pushed the feat/add_team_project_access_control branch 2 times, most recently from 7a157b6 to f15c0ce Compare November 22, 2023 13:50
@pieterlukasse pieterlukasse force-pushed the feat/add_team_project_access_control branch from af6a085 to 6a0ae7b Compare January 5, 2024 15:50
... these roles turned out to be essential for getting the error resolved (an error stating
"you are not authorized to view the concept set expression")
pom.xml Show resolved Hide resolved
@pieterlukasse pieterlukasse force-pushed the feat/add_team_project_access_control branch from cb6c2e7 to 65b3fbd Compare January 10, 2024 18:09
@pieterlukasse pieterlukasse force-pushed the feat/add_team_project_access_control branch from 65b3fbd to ad236d0 Compare January 10, 2024 18:12
@pieterlukasse pieterlukasse force-pushed the feat/add_team_project_access_control branch 2 times, most recently from f18cc4d to 59e5e46 Compare February 9, 2024 21:02
...and therefore from the flow of endpoints like /user/refresh.
Not sure why this was added there, as the /user/logout should be
the place to remove a session.
This solves a org.apache.shiro.subject.support.DisabledSessionException.

If the worry is that logout won`t be called, then the
expiry time should just be set to a short period.

The adjustment in JwtAuthRealm.java was to deal with the side
effect that occurred after the removal of the .stop in
the UpdateAccessTokenFilter filter:
java.lang.ClassCastException: io.buji.pac4j.subject.Pac4jPrincipal cannot be cast to java.lang.String
@pieterlukasse pieterlukasse force-pushed the feat/add_team_project_access_control branch from 59e5e46 to 32e90bc Compare February 9, 2024 21:03
pieterlukasse and others added 6 commits February 9, 2024 22:22
...to avoid any race conditions where two threads could end up
trying to remove the same role for example.
Co-authored-by: burtonk <117617405+k-burt-uch@users.noreply.github.com>
...and extra failsafe to avoid empty string names in the request parameters
…rvice

...with the access rules only changing if this.authorizationMode.equals("teamproject").
For teamproject mode we want the users to only see items that are granted through a role
and not include the ones they have created (as they might have created this while
logged/in / working on another teamproject
@pieterlukasse pieterlukasse force-pushed the feat/add_team_project_access_control branch from 7c0f231 to fb4a072 Compare February 14, 2024 21:20
@pieterlukasse
Copy link
Author

PR #107 replaces this one.

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.

2 participants