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

Migrate to a new permission checker #569

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
397 commits
Select commit Hold shift + click to select a range
2126583
Merge branch 'module_dependencies' into merge_from_main
nikpodsh May 5, 2023
8858a78
Merge branch 'merge_from_main' into sharing_modularization
nikpodsh May 5, 2023
dbf6197
Moved code related to dataset sharing
nikpodsh May 5, 2023
26b2e8b
Moved task for sharing
nikpodsh May 5, 2023
2c40b92
Removed shares_refresh task since it's not used in the project
nikpodsh May 5, 2023
29a7f7e
Fixed imports
nikpodsh May 5, 2023
da2bac5
Moved services to repositories since it would be easier to extract bu…
nikpodsh May 5, 2023
5c67ef4
Review remarks
nikpodsh May 8, 2023
57f1e1f
Review remarks
nikpodsh May 8, 2023
7f6a390
Merge branch 'datasets-mod-part5' into module_dependencies
nikpodsh May 8, 2023
bb4bfa0
Merge branch 'module_dependencies' into merge_from_main
nikpodsh May 8, 2023
66510d6
Removed common and added sagemaker base
nikpodsh May 8, 2023
9cb407d
Merge branch 'merge_from_main' into sharing_modularization
nikpodsh May 8, 2023
a1af334
Resolved merge conflict
nikpodsh May 8, 2023
44c653d
Moved dataset service to repository for now
nikpodsh May 8, 2023
2ff57a2
Moved listDataItemsSharedWithEnvGroup to sharing
nikpodsh May 8, 2023
b0e30d8
Moved queries related to sharing
nikpodsh May 8, 2023
1ceb50e
Review remarks
nikpodsh May 8, 2023
0a5170e
Moved dataset constants
nikpodsh May 8, 2023
19377d6
Returned deleted methods and added triggering of alarms
nikpodsh May 8, 2023
ae0c611
Resolved cyclic import
nikpodsh May 9, 2023
a2e27a8
Moved glue script to dataset module and introduced extension for envi…
nikpodsh May 9, 2023
732f726
Renamed the method
nikpodsh May 9, 2023
90d6429
Fixed test and added registration of glue extension
nikpodsh May 9, 2023
c681a45
Merge branch 'datasets-mod-part5' into module_dependencies
nikpodsh May 9, 2023
d586e7f
Merge branch 'module_dependencies' into merge_from_main
nikpodsh May 9, 2023
23b5eb8
Merge conflict
nikpodsh May 9, 2023
a2adaa9
Merge branch 'merge_from_main' into sharing_modularization
nikpodsh May 9, 2023
99fb506
Fix merge conflict
nikpodsh May 9, 2023
b383820
Extracted EcsShareHandler
nikpodsh May 9, 2023
efbdd26
Reduced code duplication
nikpodsh May 9, 2023
efe9154
Moved GraphQL constants
nikpodsh May 9, 2023
13a2fc0
Modify docker-compose yaml to read region and default region from env…
dlpzx May 10, 2023
d9ace5d
Moved GraphQL and db constants
nikpodsh May 10, 2023
5654763
Renamed the file
nikpodsh May 10, 2023
235ec82
Moved to share_object_repository.py
nikpodsh May 10, 2023
c598dcb
Introduced DatasetColumnService
nikpodsh May 10, 2023
fef5309
Merge remote-tracking branch 'upstream/modularization-main' into modu…
nikpodsh May 10, 2023
3de57d2
Merge branch 'module_dependencies' into merge_from_main
nikpodsh May 10, 2023
8bd83f4
Merge branch 'merge_from_main' into sharing_modularization
nikpodsh May 10, 2023
2331d17
Created DatasetTableService
nikpodsh May 10, 2023
95557ba
Extracted AthenaTableClient
nikpodsh May 10, 2023
445e25a
Split logic between service and repo for DatasetTable
nikpodsh May 11, 2023
22c970b
Split logic between service and repo for DatasetTable
nikpodsh May 11, 2023
f186a30
Moved ConfidentialityClassification
nikpodsh May 11, 2023
d76005a
Extracted DatasetLocationService
nikpodsh May 11, 2023
e01e4e9
Extracted DatasetLocationService
nikpodsh May 11, 2023
db1df34
Extracted DatasetProfilingService
nikpodsh May 11, 2023
c831f18
Extracted DatasetProfilingService
nikpodsh May 11, 2023
77efeb3
Put all code in dataset_base because of name collision
nikpodsh May 11, 2023
0e06894
Extracted methods into DatasetService
nikpodsh May 11, 2023
7ba235d
Introduced S3DatasetClient and small fixes
nikpodsh May 11, 2023
5e65e41
Extracting logic from repos
nikpodsh May 11, 2023
a420f0e
Some refactoring
nikpodsh May 11, 2023
f6cab09
Extracted code to fix circular dependency
nikpodsh May 11, 2023
15f2c93
Fixed tests
nikpodsh May 12, 2023
73ff866
Fixed incorrect check
nikpodsh May 12, 2023
cd34079
Fixed tests
nikpodsh May 12, 2023
a92e829
Moved permissions related to sharing
nikpodsh May 12, 2023
afc8a73
Migrated to a new permission API
nikpodsh May 12, 2023
bfce1cb
Returned filter back
nikpodsh May 12, 2023
1d386da
Extracted validation logic
nikpodsh May 12, 2023
2467144
Extracted two sharing services
nikpodsh May 15, 2023
dd0fc0a
Review remarks
nikpodsh May 15, 2023
6765aaa
Removed dataset_share_service.py
nikpodsh May 15, 2023
4d2db02
Small fix
nikpodsh May 15, 2023
d0e9f64
Fix test with a new check
nikpodsh May 15, 2023
345f71d
Fixed small issues
nikpodsh May 15, 2023
e9ebb08
Bump pymdown-extensions from 8.1.1 to 10.0 in /documentation/userguid…
dependabot[bot] May 16, 2023
45da50f
Moved datasets and share tests into dataset folder
nikpodsh May 16, 2023
054e1b6
Fixing tests after moving them
nikpodsh May 16, 2023
e891ad9
Fixing tests after moving them
nikpodsh May 16, 2023
71d1ccb
Moving cdk stack tests
nikpodsh May 16, 2023
012a01f
Moving next part of dataset tests
nikpodsh May 17, 2023
929861c
Extracted LakeFormationDatasetClient
nikpodsh May 17, 2023
3b10f32
Deleted dead code
nikpodsh May 17, 2023
931c778
Moved lakeformation.py
nikpodsh May 17, 2023
e462507
Moved a method to DatasetCrawler
nikpodsh May 17, 2023
4ad8ce7
Bump starlette from 0.25.0 to 0.27.0 and upgrade fastapi (#460)
dlpzx May 17, 2023
06644dc
Moved glue methods into sharing
nikpodsh May 17, 2023
fadb54f
Moved filter used only in sharing
nikpodsh May 17, 2023
dfc8be8
Merge branch 'module_dependencies' into merge_from_main
nikpodsh May 17, 2023
dfb6003
Merge branch 'merge_from_main' into sharing_modularization
nikpodsh May 17, 2023
cd9751b
Merge remote-tracking branch 'upstream/modularization-main' into merg…
nikpodsh May 17, 2023
5581b5d
Merge branch 'merge_from_main' into sharing_modularization
nikpodsh May 17, 2023
03c7fb9
Solved merge conflict after the merge
nikpodsh May 17, 2023
8418d31
Found a share related exception
nikpodsh May 17, 2023
ee4f34c
Fixes issue with existing cognito callbacks (#464)
gmuslia May 17, 2023
d7b6b51
Added delete environment listener
nikpodsh May 17, 2023
62cbb12
Added two import mode dedicated to tasks loading and refactored these…
nikpodsh May 17, 2023
34ac1cd
Fixed imports
nikpodsh May 17, 2023
1891f53
Fixed issue with multiply loading
nikpodsh May 17, 2023
4c8b91c
Moved share/dataset related tests
nikpodsh May 19, 2023
d75ebfd
Moved to tasks folder
nikpodsh May 19, 2023
69daa0d
Updated a version of pytest
nikpodsh May 19, 2023
9c47b30
Fixed linting
nikpodsh May 19, 2023
5303772
Moved queries to repositories
nikpodsh May 19, 2023
9b3a179
Moved queries to repositories
nikpodsh May 19, 2023
4ef4ddd
Fixed migration's imports
nikpodsh May 19, 2023
2b7fd44
Fixed linting
nikpodsh May 19, 2023
4fc225c
Fixed tests
nikpodsh May 19, 2023
3b85ad2
Fix lambda/ECS IAM permissions for AOSS (#467)
kukushking May 22, 2023
3097a3a
465 - Update Aurora default Parameter Group to 'default.aurora-postgr…
rbernotas May 22, 2023
efc06dd
User requests. Deleted TODOs
nikpodsh May 22, 2023
c11082d
Fixed loading issue
nikpodsh May 22, 2023
3b2fb48
Fixed loading issue with redshift. Added more comments and removed im…
nikpodsh May 22, 2023
a1c5156
DatasetSummary is not used
nikpodsh May 22, 2023
fd7da75
Bump requests from 2.27.1 to 2.31.0 in /backend (#469)
dependabot[bot] May 23, 2023
65ea17b
Bump requests from 2.27.1 to 2.31.0 in /backend/dataall/cdkproxy (#470)
dependabot[bot] May 23, 2023
b59cf9e
hotfix: Remove GitHub template option from data.all Pipelines (#472)
dlpzx May 23, 2023
3340610
fix: Upgrade aurora engine version to 11.16 (#471)
kimengu-david May 24, 2023
b441258
Updated CDK Version to fix issue with cdkproxy/ dataset stack creatio…
gmuslia May 24, 2023
8175d10
Created dashboard module
nikpodsh May 24, 2023
faebdaf
Moved dashboard api into modules
nikpodsh May 24, 2023
92f6ca8
Created DashboardRepository
nikpodsh May 24, 2023
d528544
Moved dashboard models to the dashboard module
nikpodsh May 24, 2023
c3e2b37
Moved Dashboard's feed and glossary code
nikpodsh May 24, 2023
ace2b02
Moved DashboardIndexer
nikpodsh May 25, 2023
1f340c0
Renamed the file name
nikpodsh May 25, 2023
880963e
Created dashboard_catalog_indexer
nikpodsh May 25, 2023
c97b5e9
Implemented EnvironmentResource for dashboards
nikpodsh May 25, 2023
5d71bd6
Fixed copy error
nikpodsh May 25, 2023
d0ea832
update auth-at-edge semantic version to latest 2.1.5 (#480)
dlpzx May 25, 2023
f1a52a1
Added ShareEnvironmentResource
nikpodsh May 25, 2023
3669a2b
Merge remote-tracking branch 'upstream/main' into merge_from_main
nikpodsh May 25, 2023
99e0305
Merge branch 'merge_from_main' into sharing_modularization
nikpodsh May 25, 2023
1771743
Merge branch 'sharing_modularization' into dashboard_modularization
nikpodsh May 25, 2023
31ff92e
Merge remote-tracking branch 'upstream/modularization-main' into shar…
nikpodsh May 25, 2023
15d1a68
Minor changes
nikpodsh May 25, 2023
27076a3
Moved dashboard permissions
nikpodsh May 25, 2023
f14d789
Migrated dashboards to a new API for permission check
nikpodsh May 25, 2023
ecb16b8
Removed unused parameters
nikpodsh May 25, 2023
dfa7b6d
Moved validation to resolvers.py
nikpodsh May 25, 2023
07e3155
Introduced DashboardShareService
nikpodsh May 26, 2023
d174b43
Added missed handlers
nikpodsh May 26, 2023
45194d5
Migrated quicksight policy to dashboards
nikpodsh May 30, 2023
27ccfe3
Moved dashboard API to the dashboard module
nikpodsh May 30, 2023
4fb4a11
Introduced DashboardService
nikpodsh May 30, 2023
bfca075
Renamed policy
nikpodsh May 30, 2023
1308982
Introduced DashboardQuicksightService
nikpodsh May 30, 2023
67ce787
Moved dashboard enums
nikpodsh May 30, 2023
bf3d739
Removed missed dashboard code
nikpodsh May 30, 2023
e83833b
dashboardsEnabled has become a parameter
nikpodsh May 31, 2023
19ee2ff
Renamed Quicksight to QuicksightClient and extracted DashboardQuicksi…
nikpodsh May 31, 2023
e9ee056
Moved dashboard tests into the module
nikpodsh May 31, 2023
238234c
Moved dashboard tests into the module
nikpodsh May 31, 2023
071094d
Fixed issue staticmethod is not callable for python3.8
nikpodsh May 31, 2023
96f770d
Returned missed return statement
nikpodsh Jun 1, 2023
33d3d7f
Column name should be used instead of instance uri
nikpodsh Jun 1, 2023
8af93a3
Fixed description of the permissions
nikpodsh Jun 1, 2023
c33b248
Added missed depends on statements
nikpodsh Jun 1, 2023
f23eeca
Added missed return statement
nikpodsh Jun 1, 2023
e991e70
Removed unused queries
nikpodsh Jun 1, 2023
28a2ef7
Removed unused queries
nikpodsh Jun 1, 2023
a38be2e
Renaming of the camelcase variables
nikpodsh Jun 1, 2023
e0b67b1
Indexers don't have queries. Removed big join queries
nikpodsh Jun 1, 2023
0eee556
Added default filter
nikpodsh Jun 1, 2023
bca586d
The method is under permission
nikpodsh Jun 1, 2023
cf5e4c8
Removed addDatasetTable since it's not used
nikpodsh Jun 2, 2023
3de2e09
list_dataset_tables is not used
nikpodsh Jun 2, 2023
345db03
Removed unused API
nikpodsh Jun 2, 2023
a25c9be
Removed unused API for datasets
nikpodsh Jun 2, 2023
972d533
Fixed linting
nikpodsh Jun 2, 2023
4cc4e0f
Handler was not used
nikpodsh Jun 2, 2023
fa165fb
Fixed tests
nikpodsh Jun 2, 2023
d493a70
Added more logging
nikpodsh Jun 2, 2023
684eb49
Removed unused method
nikpodsh Jun 2, 2023
be05244
Replaced process with queue
nikpodsh Jun 5, 2023
f9cf61a
There was a nasty bug. It turns out that __main__.ClassName is not th…
nikpodsh Jun 5, 2023
c5180c2
Removed used arguments
nikpodsh Jun 5, 2023
1d6a7b0
Added missed dataset feed target
nikpodsh Jun 5, 2023
0ab3cf3
Returned synchronous code back
nikpodsh Jun 9, 2023
d19761c
Moved sync method to table API
nikpodsh Jun 9, 2023
d9c2872
Replaced creation of the task with direct invokation of code
nikpodsh Jun 9, 2023
9064636
Replaced creation of the task with direct invokation of code
nikpodsh Jun 9, 2023
0541438
Fixed tests
nikpodsh Jun 9, 2023
1ec37ba
Removed unused imports
nikpodsh Jun 15, 2023
f57c8e9
Merge remote-tracking branch 'upstream/modularization-main' into shar…
nikpodsh Jun 15, 2023
43a6305
Fixed tests
nikpodsh Jun 15, 2023
f45eeed
Fix profiling
nikpodsh Jun 15, 2023
7e259c3
Fix ML studio migration script
nikpodsh Jun 15, 2023
d667996
Removed return statement
nikpodsh Jun 15, 2023
f477f37
Fixed wrong order of params
nikpodsh Jun 16, 2023
3a0a521
Disable and skip module test directories for modules that are inactive
nikpodsh Jun 16, 2023
96cdead
Fixed dict
nikpodsh Jun 19, 2023
21fe806
Merge remote-tracking branch 'upstream/modularization-main' into shar…
nikpodsh Jun 22, 2023
bb7a1ab
Update backend/dataall/core/stack_finder.py
nikpodsh Jun 23, 2023
f052a4f
Renamed the file
nikpodsh Jun 23, 2023
a540db3
Renamed the previewTable
nikpodsh Jun 23, 2023
7e1aed4
Removed in_config union
nikpodsh Jun 26, 2023
6e58690
LIST_ENVIRONMENT_NOTEBOOKS is not used
nikpodsh Jun 26, 2023
314a6aa
Delete unused permissions
nikpodsh Jun 26, 2023
13188c8
Removed the commented line
nikpodsh Jun 26, 2023
4417ec9
Moved client to a constructor
nikpodsh Jun 26, 2023
7dfa2a9
Merge branch 'sharing_modularization' into dashboard_modularization
nikpodsh Jun 27, 2023
daa7046
Resolve merge conflict
nikpodsh Jun 27, 2023
1a64e9f
Resolve merge conflict
nikpodsh Jun 27, 2023
ab59603
Fix merge conflict
nikpodsh Jun 27, 2023
f12e2c0
Fix tests
nikpodsh Jun 28, 2023
dff8228
Simplified the indexer. SQL Alchemy caches the responses and it's lik…
nikpodsh Jun 28, 2023
4e88625
Fixed a merge error
nikpodsh Jun 28, 2023
d93bd37
Fixed a typo
nikpodsh Jun 28, 2023
7e4c209
Fixed a typo
nikpodsh Jun 28, 2023
b0444a7
Renamed a file name
nikpodsh Jun 28, 2023
f25ffab
Fixed JS linting
nikpodsh Jun 28, 2023
f114ea8
uri param must be a kwarg
nikpodsh Jun 28, 2023
cee05ca
The name error
nikpodsh Jun 28, 2023
d3bb7b2
Merge remote-tracking branch 'origin/dashboard_modularization' into d…
nikpodsh Jun 29, 2023
6809cee
Fix username error
nikpodsh Jun 29, 2023
e3d90e5
Fixed renamed variable
nikpodsh Jun 29, 2023
7a64f89
Permissions are set on dashboard
nikpodsh Jun 29, 2023
80785ee
Added missed permissions
nikpodsh Jul 3, 2023
2e0f591
Added user specific check
nikpodsh Jul 3, 2023
98b79b2
Moved RamClient
nikpodsh Jul 3, 2023
0101da5
Removed unused methods
nikpodsh Jul 3, 2023
b53dc8d
Refactored kms client
nikpodsh Jul 3, 2023
60b7571
Simplified the code a little
nikpodsh Jul 3, 2023
a7c3c5d
Moved and simplified S3 client
nikpodsh Jul 3, 2023
75a2c9e
Moved sqs poller to datasets
nikpodsh Jul 3, 2023
743ad51
Secret manager is not used
nikpodsh Jul 3, 2023
d0e5c01
Review remarks
nikpodsh Jul 3, 2023
b12cecc
Fixed region
nikpodsh Jul 3, 2023
a79a402
Merge branch 'dashboard_modularization' into small_changes
nikpodsh Jul 3, 2023
a728fc6
Call to AWS should be done in clients
nikpodsh Jul 3, 2023
740830b
Calls to AWS should be done in clients
nikpodsh Jul 3, 2023
578770e
Review remarks
nikpodsh Jul 4, 2023
f07922b
Review remarks + linting
nikpodsh Jul 4, 2023
400df74
Fixed tests
nikpodsh Jul 4, 2023
4f9008f
Merge branch 'dashboard_modularization' into fix_methods_without_perm…
nikpodsh Jul 4, 2023
ecc4062
Merge remote-tracking branch 'upstream/modularization-main' into fix_…
nikpodsh Jul 4, 2023
4542e06
Migrate environment to a new permission check API and remove unused p…
nikpodsh Jul 5, 2023
989d8cc
Migrate glossary to a new permission check API and remove unused para…
nikpodsh Jul 5, 2023
b07675f
Migrate keyvaluetag to a new permission check API and remove unused p…
nikpodsh Jul 5, 2023
b577f4f
Migrate organization to a new permission check API and remove unused …
nikpodsh Jul 5, 2023
bd58026
Migrate stack to a new permission check API and remove unused parameters
nikpodsh Jul 5, 2023
cef4390
Migrate vote to a new permission check API and remove unused parameters
nikpodsh Jul 5, 2023
c40790a
Migrate VPC to a new permission check API and remove unused parameters
nikpodsh Jul 5, 2023
21bd055
Remove old permission checker
nikpodsh Jul 5, 2023
1901f3a
Migrated direct call for permission check with a decorator
nikpodsh Jul 5, 2023
4acc981
removed unused method
nikpodsh Jul 7, 2023
137cf87
Merge branch 'fix_methods_without_permissions' into refactoring_of_aw…
nikpodsh Jul 10, 2023
c50c110
Merge remote-tracking branch 'upstream/modularization-main' into refa…
nikpodsh Jul 10, 2023
d6c290b
Removed a new added file
nikpodsh Jul 10, 2023
fef7f34
Review remarks
nikpodsh Jul 13, 2023
58626df
Clean up imports
nikpodsh Jul 13, 2023
cc3bf83
Review remarks
nikpodsh Jul 14, 2023
fd96a7f
Merge remote-tracking branch 'origin/refactoring_of_aws_calls' into n…
nikpodsh Jul 19, 2023
b0766e6
Fixed imports in merge conflicts
nikpodsh Jul 19, 2023
15930bc
Merge remote-tracking branch 'upstream/modularization-main' into new_…
nikpodsh Jul 19, 2023
a984bfe
Review remarks
nikpodsh Jul 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 6 additions & 73 deletions backend/dataall/api/Objects/Environment/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,8 @@ def create_environment(context: Context, source, input=None):
input['cdk_role_name'] = cdk_role_name
env = Environment.create_environment(
session=session,
username=context.username,
groups=context.groups,
uri=input.get('organizationUri'),
data=input,
check_perm=True,
)
Stack.create_stack(
session=session,
Expand Down Expand Up @@ -123,11 +120,8 @@ def update_environment(

environment = db.api.Environment.update_environment(
session,
username=context.username,
groups=context.groups,
uri=environmentUri,
data=input,
check_perm=True,
)

if EnvironmentResourceManager.deploy_updated_stack(session, previous_resource_prefix, environment):
Expand All @@ -140,11 +134,8 @@ def invite_group(context: Context, source, input):
with context.engine.scoped_session() as session:
environment, environment_group = db.api.Environment.invite_group(
session=session,
username=context.username,
groups=context.groups,
uri=input['environmentUri'],
data=input,
check_perm=True,
)

stack_helper.deploy_stack(targetUri=environment.environmentUri)
Expand All @@ -163,11 +154,8 @@ def add_consumption_role(context: Context, source, input):
)
consumption_role = db.api.Environment.add_consumption_role(
session=session,
username=context.username,
groups=context.groups,
uri=input['environmentUri'],
data=input,
check_perm=True,
)

return consumption_role
Expand All @@ -177,11 +165,8 @@ def update_group_permissions(context, source, input):
with context.engine.scoped_session() as session:
environment = db.api.Environment.update_group_permissions(
session=session,
username=context.username,
groups=context.groups,
uri=input['environmentUri'],
data=input,
check_perm=True,
)

stack_helper.deploy_stack(targetUri=environment.environmentUri)
Expand All @@ -193,11 +178,8 @@ def remove_group(context: Context, source, environmentUri=None, groupUri=None):
with context.engine.scoped_session() as session:
environment = db.api.Environment.remove_group(
session=session,
username=context.username,
groups=context.groups,
uri=environmentUri,
data={'groupUri': groupUri},
check_perm=True,
group=groupUri,
)

stack_helper.deploy_stack(targetUri=environment.environmentUri)
Expand All @@ -209,11 +191,8 @@ def remove_consumption_role(context: Context, source, environmentUri=None, consu
with context.engine.scoped_session() as session:
status = db.api.Environment.remove_consumption_role(
session=session,
username=context.username,
groups=context.groups,
uri=consumptionRoleUri,
data={'environmentUri': environmentUri},
check_perm=True,
env_uri=environmentUri,
)

return status
Expand All @@ -227,11 +206,8 @@ def list_environment_invited_groups(
with context.engine.scoped_session() as session:
return db.api.Environment.paginated_environment_invited_groups(
session=session,
username=context.username,
groups=context.groups,
uri=environmentUri,
data=filter,
check_perm=True,
)


Expand All @@ -241,11 +217,8 @@ def list_environment_groups(context: Context, source, environmentUri=None, filte
with context.engine.scoped_session() as session:
return db.api.Environment.paginated_user_environment_groups(
session=session,
username=context.username,
groups=context.groups,
uri=environmentUri,
data=filter,
check_perm=True,
)


Expand All @@ -257,11 +230,8 @@ def list_all_environment_groups(
with context.engine.scoped_session() as session:
return db.api.Environment.paginated_all_environment_groups(
session=session,
username=context.username,
groups=context.groups,
uri=environmentUri,
data=filter,
check_perm=True,
)


Expand All @@ -273,11 +243,8 @@ def list_environment_consumption_roles(
with context.engine.scoped_session() as session:
return db.api.Environment.paginated_user_environment_consumption_roles(
session=session,
username=context.username,
groups=context.groups,
uri=environmentUri,
data=filter,
check_perm=True,
)


Expand All @@ -289,11 +256,8 @@ def list_all_environment_consumption_roles(
with context.engine.scoped_session() as session:
return db.api.Environment.paginated_all_environment_consumption_roles(
session=session,
username=context.username,
groups=context.groups,
uri=environmentUri,
data=filter,
check_perm=True,
)


Expand All @@ -315,14 +279,7 @@ def list_environments(context: Context, source, filter=None):
if filter is None:
filter = {}
with context.engine.scoped_session() as session:
return db.api.Environment.paginated_user_environments(
session=session,
username=context.username,
groups=context.groups,
uri=None,
data=filter,
check_perm=True,
)
return db.api.Environment.paginated_user_environments(session, filter)


def list_environment_networks(
Expand All @@ -333,11 +290,8 @@ def list_environment_networks(
with context.engine.scoped_session() as session:
return db.api.Environment.paginated_environment_networks(
session=session,
username=context.username,
groups=context.groups,
uri=environmentUri,
data=filter,
check_perm=True,
)


Expand All @@ -355,15 +309,7 @@ def resolve_vpc_list(context: Context, source, **kwargs):

def get_environment(context: Context, source, environmentUri: str = None):
with context.engine.scoped_session() as session:
ResourcePolicy.check_user_resource_permission(
session=session,
username=context.username,
groups=context.groups,
resource_uri=environmentUri,
permission_name=permissions.GET_ENVIRONMENT,
)
environment = db.api.Environment.get_environment_by_uri(session, environmentUri)
return environment
return db.api.Environment.find_environment_by_uri(session, uri=environmentUri)


def resolve_user_role(context: Context, source: models.Environment):
Expand Down Expand Up @@ -394,11 +340,8 @@ def list_environment_group_permissions(
with context.engine.scoped_session() as session:
return db.api.Environment.list_group_permissions(
session=session,
username=context.username,
groups=context.groups,
uri=environmentUri,
data={'groupUri': groupUri},
check_perm=True,
group_uri=groupUri
)


Expand Down Expand Up @@ -518,23 +461,13 @@ def delete_environment(
context: Context, source, environmentUri: str = None, deleteFromAWS: bool = False
):
with context.engine.scoped_session() as session:
ResourcePolicy.check_user_resource_permission(
session=session,
username=context.username,
groups=context.groups,
resource_uri=environmentUri,
permission_name=permissions.DELETE_ENVIRONMENT,
)
environment = db.api.Environment.get_environment_by_uri(session, environmentUri)

try:
db.api.Environment.delete_environment(
session,
username=context.username,
groups=context.groups,
uri=environmentUri,
data={'environment': environment},
check_perm=True,
environment=environment
)
except exc.IntegrityError:
raise exceptions.EnvironmentResourcesFound(
Expand Down
45 changes: 2 additions & 43 deletions backend/dataall/api/Objects/Glossary/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,7 @@ def create_glossary(
context: Context, source, input: dict = None
) -> models.GlossaryNode:
with context.engine.scoped_session() as session:
return db.api.Glossary.create_glossary(
session=session,
username=context.username,
groups=context.groups,
uri=None,
data=input,
check_perm=True,
)
return db.api.Glossary.create_glossary(session, input)


def tree(context: Context, source: models.GlossaryNode):
Expand Down Expand Up @@ -93,23 +86,17 @@ def create_category(
with context.engine.scoped_session() as session:
return db.api.Glossary.create_category(
session=session,
username=context.username,
groups=context.groups,
uri=parentUri,
data=input,
check_perm=True,
)


def create_term(context: Context, source, parentUri: str = None, input: dict = None):
with context.engine.scoped_session() as session:
return db.api.Glossary.create_term(
session=session,
username=context.username,
groups=context.groups,
uri=parentUri,
data=input,
check_perm=True,
)


Expand All @@ -119,11 +106,7 @@ def list_glossaries(context: Context, source, filter: dict = None):
with context.engine.scoped_session() as session:
return db.api.Glossary.list_glossaries(
session=session,
username=context.username,
groups=context.groups,
uri=None,
data=filter,
check_perm=True,
)


Expand All @@ -137,11 +120,8 @@ def resolve_categories(
with context.engine.scoped_session() as session:
return db.api.Glossary.list_categories(
session=session,
username=context.username,
groups=context.groups,
uri=source.nodeUri,
data=filter,
check_perm=True,
)


Expand All @@ -153,11 +133,8 @@ def resolve_terms(context: Context, source: models.GlossaryNode, filter: dict =
with context.engine.scoped_session() as session:
return db.api.Glossary.list_terms(
session=session,
username=context.username,
groups=context.groups,
uri=source.nodeUri,
data=filter,
check_perm=True,
)


Expand All @@ -167,11 +144,8 @@ def update_node(
with context.engine.scoped_session() as session:
return db.api.Glossary.update_node(
session,
username=context.username,
groups=context.groups,
uri=nodeUri,
data=input,
check_perm=True,
)


Expand All @@ -193,14 +167,7 @@ def resolve_user_role(context: Context, source: models.GlossaryNode, **kwargs):

def delete_node(context: Context, source, nodeUri: str = None) -> bool:
with context.engine.scoped_session() as session:
return db.api.Glossary.delete_node(
session,
username=context.username,
groups=context.groups,
uri=nodeUri,
data=None,
check_perm=True,
)
return db.api.Glossary.delete_node(session, nodeUri)


def hierarchical_search(context: Context, source, filter: dict = None):
Expand All @@ -210,11 +177,7 @@ def hierarchical_search(context: Context, source, filter: dict = None):
with context.engine.scoped_session() as session:
return db.api.Glossary.hierarchical_search(
session=session,
username=context.username,
groups=context.groups,
uri=None,
data=filter,
check_perm=True,
)


Expand Down Expand Up @@ -251,11 +214,7 @@ def search_terms(context: Context, source, filter: dict = None):
with context.engine.scoped_session() as session:
return db.api.Glossary.search_terms(
session=session,
username=context.username,
groups=context.groups,
uri=None,
data=filter,
check_perm=True,
)


Expand Down
5 changes: 1 addition & 4 deletions backend/dataall/api/Objects/Group/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ def resolve_group_environment_permissions(context, source, environmentUri):
with context.engine.scoped_session() as session:
return db.api.Environment.list_group_permissions(
session=session,
username=context.username,
groups=context.groups,
uri=environmentUri,
data={'groupUri': source.groupUri},
check_perm=True,
group_uri=source.groupUri
)


Expand Down
8 changes: 1 addition & 7 deletions backend/dataall/api/Objects/KeyValueTag/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,17 @@ def list_key_value_tags(
with context.engine.scoped_session() as session:
return db.api.KeyValueTag.list_key_value_tags(
session=session,
username=context.username,
groups=context.groups,
uri=targetUri,
data={'targetType': targetType},
check_perm=True,
target_type=targetType,
)


def update_key_value_tags(context: Context, source, input=None):
with context.engine.scoped_session() as session:
kv_tags = db.api.KeyValueTag.update_key_value_tags(
session=session,
username=context.username,
groups=context.groups,
uri=input['targetUri'],
data=input,
check_perm=True,
)
stack_helper.deploy_stack(targetUri=input['targetUri'])
return kv_tags
Loading