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

model: design workflow run sharing tables #206

Open
tiborsimko opened this issue Oct 25, 2023 · 4 comments · May be fixed by #207
Open

model: design workflow run sharing tables #206

tiborsimko opened this issue Oct 25, 2023 · 4 comments · May be fixed by #207

Comments

@tiborsimko
Copy link
Member

For the workflow sharing sprint reanahub/reana#751 we shall need DB model changes to express that Alice shared her workflow run myanalysis 42 with user Bob.

The DB design should be flexible enough to hint at various "user roles" e.g. Bob is only a R/O reader, but we should pave the way towards possible future more roles (e.g. someone who can restart workflows, e.g. someone who could modify some parts in R/W manner in Alice's name, etc.)

The goal of this issue it to design the new DB tables and prepare an Alembic recipe for upgrades of existing deployments.

@tiborsimko tiborsimko added this to Ready for work in Workflow-Sharing Oct 25, 2023
@DaanRosendal DaanRosendal moved this from Ready for work to In work in Workflow-Sharing Oct 26, 2023
@DaanRosendal
Copy link
Member

To achieve the desired functionality, two new tables have to be introduced:

  1. user_workflow: This table is essential for verifying whether a specific workflow has been shared with a user.
  2. role: This table will store various roles, such as 'read-only' and 'read-write.' Note that the design restricts a user to a single role for each shared workflow.

The proposed entity relationship diagram that illustrates these changes:
Entity relationship diagram drawio

DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Oct 26, 2023
Adds two tables to the database. The `user_workflow` table makes it
possible to verify whether a specific workflow has been shared with a
user. The `role` table stores various roles, such as 'read-only' and
'read-write.'

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Oct 26, 2023
Adds two tables to the database. The `user_workflow` table makes it
possible to verify whether a specific workflow has been shared with a
user. The `role` table stores various roles, such as 'read-only' and
'read-write.'

Closes reanahub#206
@DaanRosendal DaanRosendal linked a pull request Oct 26, 2023 that will close this issue
@DaanRosendal DaanRosendal moved this from In work to In review in Workflow-Sharing Oct 26, 2023
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Oct 26, 2023
Adds two tables to the database. The `user_workflow` table makes it
possible to verify whether a specific workflow has been shared with a
user. The `role` table stores various roles, such as 'read-only' and
'read-write.'

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Oct 26, 2023
Adds two tables to the database. The `user_workflow` table makes it
possible to verify whether a specific workflow has been shared with a
user. The `role` table stores various roles, such as 'read-only' and
'read-write.'

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Oct 26, 2023
Adds two tables to the database. The `user_workflow` table makes it
possible to verify whether a specific workflow has been shared with a
user. The `role` table stores various roles, such as 'read-only' and
'read-write.'

Closes reanahub#206
@tiborsimko
Copy link
Member Author

Looks good, some more thoughts:

  • In the user_workflow table, we may have to have (workflow_id, user_id, role_id) to be the primary key, if we allow one day one user accessing the same workflow via multiple roles. (But I guess this is not really needed.)

  • For the use case of sharing a workflow run with "anybody", it may not be easy to use workflow_user table, since we would have to "overpopulate it" with each user. But I guess for this use case we shall probably make a catch-all group "anybody" where all users will be members of, if this is needed, so the use case could come implemented via group sharing. (Again something for later.)

  • As @mdonadoni suggested, perhaps we could use enums for roles (such as "reader"), since we shall be defining them only at the development/admin level, and not offer defining them at runtime by users. (See also "cpu" and "disk" resources.)

@DaanRosendal
Copy link
Member

  1. I think we can keep it like this for now, such functionality could always be added later.
  2. Alternatively, we could add an extra boolean column shared_with_anybody to the workflow table, but that would get messy with the sharing expiration feature. I suppose a catch-all group is indeed the best solution here.
  3. An implementation similar to how resources are implemented makes sense 👍

@DaanRosendal
Copy link
Member

DaanRosendal commented Oct 31, 2023

After in-person discussions, several changes were made to the database design:

  1. The role table has been eliminated and replaced with an access_type enum. Additional access types, such as write, will be introduced in the distant future. Should the need arise, restructuring the database (e.g., reintroducing the role/access_type table) can be considered at that point. This change not only simplifies the database but also paves the way for quicker implementation.
  2. The role entity has been renamed to access_type to enhance clarity.
  3. The message column has been removed to optimize storage, as messages can be sent to users when sharing without the necessity of storing them in the database.

The updated entity relationship diagram:
Entity relationship diagram drawio (3)

DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Nov 2, 2023
Adds a table and an enum to the database. The `user_workflow` table
makes it possible to verify whether a specific workflow has been shared
with a user. The `accesstype` enum defines the different access types
that can be granted to a user. For now only `read` access is supported.

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Nov 2, 2023
Adds a table and an enum to the database. The `user_workflow` table
makes it possible to verify whether a specific workflow has been shared
with a user. The `accesstype` enum defines the different access types
that can be granted to a user. For now only `read` access is supported.

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Nov 2, 2023
Adds a table and an enum to the database. The `user_workflow` table
makes it possible to verify whether a specific workflow has been shared
with a user. The `accesstype` enum defines the different access types
that can be granted to a user. For now only `read` access is supported.

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Nov 2, 2023
Adds a table and an enum to the database. The `user_workflow` table
makes it possible to verify whether a specific workflow has been shared
with a user. The `accesstype` enum defines the different access types
that can be granted to a user. For now only `read` access is supported.

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Nov 2, 2023
Adds a table and an enum to the database. The `user_workflow` table
makes it possible to verify whether a specific workflow has been shared
with a user. The `accesstype` enum defines the different access types
that can be granted to a user. For now, only `read` access is supported.

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Nov 2, 2023
Adds a table and an enum to the database. The `user_workflow` table
makes it possible to verify whether a specific workflow has been shared
with a user. The `accesstype` enum defines the different access types
that can be granted to a user. For now, only `read` access is supported.

Closes reanahub#206
@mdonadoni mdonadoni self-assigned this Dec 20, 2023
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Mar 11, 2024
Adds a table and an enum to the database. The `user_workflow` table
makes it possible to verify whether a specific workflow has been shared
with a user. The `accesstype` enum defines the different access types
that can be granted to a user. For now, only `read` access is supported.

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Mar 11, 2024
Adds a table and an enum to the database. The `user_workflow` table
makes it possible to verify whether a specific workflow has been shared
with a user. The `accesstype` enum defines the different access types
that can be granted to a user. For now, only `read` access is supported.

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Mar 13, 2024
Adds a table and an enum to the database. The `user_workflow` table
makes it possible to verify whether a specific workflow has been shared
with a user. The `accesstype` enum defines the different access types
that can be granted to a user. For now, only `read` access is supported.

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Mar 13, 2024
Adds a table and an enum to the database. The `user_workflow` table
makes it possible to verify whether a specific workflow has been shared
with a user. The `accesstype` enum defines the different access types
that can be granted to a user. For now, only `read` access is supported.

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Mar 14, 2024
Adds a table and an enum to the database. The `user_workflow` table
makes it possible to verify whether a specific workflow has been shared
with a user. The `accesstype` enum defines the different access types
that can be granted to a user. For now, only `read` access is supported.

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Mar 14, 2024
Adds a table and an enum to the database. The `user_workflow` table
makes it possible to verify whether a specific workflow has been shared
with a user. The `accesstype` enum defines the different access types
that can be granted to a user. For now, only `read` access is supported.

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Mar 14, 2024
Adds a table and an enum to the database. The `user_workflow` table
makes it possible to verify whether a specific workflow has been shared
with a user. The `accesstype` enum defines the different access types
that can be granted to a user. For now, only `read` access is supported.

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Mar 14, 2024
Adds a table and an enum to the database. The `user_workflow` table
makes it possible to verify whether a specific workflow has been shared
with a user. The `accesstype` enum defines the different access types
that can be granted to a user. For now, only `read` access is supported.

Closes reanahub#206
DaanRosendal added a commit to DaanRosendal/reana-db that referenced this issue Mar 18, 2024
Adds a table and an enum to the database. The `user_workflow` table
makes it possible to verify whether a specific workflow has been shared
with a user. The `accesstype` enum defines the different access types
that can be granted to a user. For now, only `read` access is supported.

Closes reanahub#206
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

3 participants