-
Notifications
You must be signed in to change notification settings - Fork 30
Add global functions user permissions 🎨 #7868
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
Merged
pcrespov
merged 20 commits into
ITISFoundation:master
from
wvangeit:add_global_functions_user_abilities
Jun 13, 2025
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4518f10
Add global abilities for user wrt functions (read,write,execute)
wvangeit 569871b
Add function user abilities
wvangeit 1441336
Merge branch 'master' into add_global_functions_user_abilities
wvangeit ff3c380
Merge branch 'master' into add_global_functions_user_abilities
wvangeit 72b7fd1
All tests working
wvangeit d71a213
Merge branch 'add_global_functions_user_abilities' of github.com:wvan…
wvangeit ea0755a
Address some comments in the PR
wvangeit b4c8472
Merge branch 'master' into add_global_functions_user_abilities
wvangeit 62e9301
Merge branch 'master' into add_global_functions_user_abilities
wvangeit 21f045e
Renamed abilities to api_access_rights
wvangeit 0c1aefd
Rm migration script
wvangeit db50854
Add migration script
wvangeit de88627
Add more tests
wvangeit 74a54d4
Merge branch 'add_global_functions_user_abilities' of github.com:wvan…
wvangeit 183702c
Merge branch 'master' into add_global_functions_user_abilities
wvangeit b706b59
Merge branch 'master' into add_global_functions_user_abilities
wvangeit 9a6549b
Some more abilities renaming
wvangeit fcdf6a9
Merge branch 'add_global_functions_user_abilities' of github.com:wvan…
wvangeit 876e4f7
Merge branch 'master' into add_global_functions_user_abilities
wvangeit a3892a9
Merge branch 'master' into add_global_functions_user_abilities
wvangeit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...core_postgres_database/migration/versions/4f6fd2586491_add_functions_api_access_rights.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
"""Add functions api access rights | ||
|
||
Revision ID: 4f6fd2586491 | ||
Revises: afb1ba08f3c2 | ||
Create Date: 2025-06-13 12:14:59.317685+00:00 | ||
|
||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "4f6fd2586491" | ||
down_revision = "afb1ba08f3c2" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"funcapi_group_api_access_rights", | ||
sa.Column("group_id", sa.BigInteger(), nullable=False), | ||
sa.Column("product_name", sa.String(), nullable=False), | ||
sa.Column("read_functions", sa.Boolean(), nullable=True), | ||
sa.Column("write_functions", sa.Boolean(), nullable=True), | ||
sa.Column("execute_functions", sa.Boolean(), nullable=True), | ||
sa.Column("read_function_jobs", sa.Boolean(), nullable=True), | ||
sa.Column("write_function_jobs", sa.Boolean(), nullable=True), | ||
sa.Column("execute_function_jobs", sa.Boolean(), nullable=True), | ||
sa.Column("read_function_job_collections", sa.Boolean(), nullable=True), | ||
sa.Column("write_function_job_collections", sa.Boolean(), nullable=True), | ||
sa.Column("execute_function_job_collections", sa.Boolean(), nullable=True), | ||
sa.Column( | ||
"created", | ||
sa.DateTime(timezone=True), | ||
server_default=sa.text("now()"), | ||
nullable=False, | ||
), | ||
sa.Column( | ||
"modified", | ||
sa.DateTime(timezone=True), | ||
server_default=sa.text("now()"), | ||
nullable=False, | ||
), | ||
sa.ForeignKeyConstraint( | ||
["group_id"], | ||
["groups.gid"], | ||
name="fk_func_access_to_groups_group_id", | ||
onupdate="CASCADE", | ||
ondelete="CASCADE", | ||
), | ||
sa.ForeignKeyConstraint( | ||
["product_name"], | ||
["products.name"], | ||
name="fk_func_access_to_products_product_name", | ||
onupdate="CASCADE", | ||
ondelete="CASCADE", | ||
), | ||
sa.PrimaryKeyConstraint( | ||
"group_id", | ||
"product_name", | ||
name="pk_func_group_product_name_to_api_access_rights", | ||
), | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table("funcapi_group_api_access_rights") | ||
# ### end Alembic commands ### |
87 changes: 87 additions & 0 deletions
87
...postgres-database/src/simcore_postgres_database/models/funcapi_api_access_rights_table.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
"""Function api access rights of groups (read, write, execute)""" | ||
|
||
import sqlalchemy as sa | ||
from simcore_postgres_database.models._common import ( | ||
RefActions, | ||
column_created_datetime, | ||
column_modified_datetime, | ||
) | ||
|
||
from .base import metadata | ||
|
||
funcapi_api_access_rights_table = sa.Table( | ||
"funcapi_group_api_access_rights", | ||
metadata, | ||
sa.Column( | ||
"group_id", | ||
sa.ForeignKey( | ||
"groups.gid", | ||
name="fk_func_access_to_groups_group_id", | ||
onupdate=RefActions.CASCADE, | ||
ondelete=RefActions.CASCADE, | ||
), | ||
nullable=False, | ||
), | ||
sa.Column( | ||
"product_name", | ||
sa.ForeignKey( | ||
"products.name", | ||
name="fk_func_access_to_products_product_name", | ||
onupdate=RefActions.CASCADE, | ||
ondelete=RefActions.CASCADE, | ||
), | ||
nullable=False, | ||
), | ||
sa.Column( | ||
"read_functions", | ||
sa.Boolean, | ||
default=False, | ||
), | ||
sa.Column( | ||
"write_functions", | ||
sa.Boolean, | ||
default=False, | ||
), | ||
sa.Column( | ||
"execute_functions", | ||
sa.Boolean, | ||
default=False, | ||
), | ||
sa.Column( | ||
"read_function_jobs", | ||
sa.Boolean, | ||
default=False, | ||
), | ||
sa.Column( | ||
"write_function_jobs", | ||
sa.Boolean, | ||
default=False, | ||
), | ||
sa.Column( | ||
"execute_function_jobs", | ||
sa.Boolean, | ||
default=False, | ||
), | ||
sa.Column( | ||
"read_function_job_collections", | ||
sa.Boolean, | ||
default=False, | ||
), | ||
sa.Column( | ||
"write_function_job_collections", | ||
sa.Boolean, | ||
default=False, | ||
), | ||
sa.Column( | ||
"execute_function_job_collections", | ||
sa.Boolean, | ||
default=False, | ||
), | ||
column_created_datetime(), | ||
column_modified_datetime(), | ||
sa.PrimaryKeyConstraint( | ||
"group_id", | ||
"product_name", | ||
name="pk_func_group_product_name_to_api_access_rights", | ||
), | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.