-
Notifications
You must be signed in to change notification settings - Fork 118
direct: Add permissions support for dashboards #3882
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
Open
shreyas-goenka
wants to merge
18
commits into
main
Choose a base branch
from
direct-dashboard-permissions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
61d3d79
direct: Add permissions support for dashboards
shreyas-goenka 26d86e2
update to not require test server changes
shreyas-goenka c406377
update test to cloud'
shreyas-goenka 9b47128
use priint requests python
shreyas-goenka d07abea
remove all_test.go changs
shreyas-goenka fe2c3a7
-
shreyas-goenka 04b229c
Merge remote-tracking branch 'origin' into direct-dashboard-permissions
shreyas-goenka 392b2ae
update tests
shreyas-goenka 80eba8b
fix test for dashboard permissions (TestAll)
shreyas-goenka cce906a
merge
shreyas-goenka e008102
update
shreyas-goenka bf973ad
Merge remote-tracking branch 'origin' into direct-dashboard-permissions
shreyas-goenka 6806083
update cloud tests
shreyas-goenka cc4309f
Merge remote-tracking branch 'origin' into direct-dashboard-permissions
shreyas-goenka 481b29e
undo repl changes
shreyas-goenka e1b5881
single user to make the test deterministic
shreyas-goenka 8561cdf
Merge remote-tracking branch 'origin' into direct-dashboard-permissions
shreyas-goenka c60082e
update tests
shreyas-goenka 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
13 changes: 13 additions & 0 deletions
13
acceptance/bundle/resources/permissions/dashboards/create/databricks.yml.tmpl
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,13 @@ | ||
| bundle: | ||
| name: dashboard-perm-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| dashboards: | ||
| foo: | ||
| display_name: test-dashboard-$UNIQUE_NAME | ||
| warehouse_id: $TEST_DEFAULT_WAREHOUSE_ID | ||
| parent_path: /Users/$CURRENT_USER_NAME/folder1 | ||
| serialized_dashboard: '{"pages":[{"name":"page1","displayName":"Page 1"}]}' | ||
| permissions: | ||
| - level: CAN_READ | ||
| user_name: $TEST_USER_EMAIL |
41 changes: 41 additions & 0 deletions
41
acceptance/bundle/resources/permissions/dashboards/create/out.plan.direct.json
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,41 @@ | ||
| { | ||
| "plan": { | ||
| "resources.dashboards.foo": { | ||
| "action": "create", | ||
| "new_state": { | ||
| "value": { | ||
| "display_name": "test-dashboard-[UNIQUE_NAME]", | ||
| "parent_path": "/Users/[USERNAME]/folder1", | ||
| "warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]" | ||
| } | ||
| } | ||
| }, | ||
| "resources.dashboards.foo.permissions": { | ||
| "depends_on": [ | ||
| { | ||
| "node": "resources.dashboards.foo", | ||
| "label": "${resources.dashboards.foo.id}" | ||
| } | ||
| ], | ||
| "action": "create", | ||
| "new_state": { | ||
| "value": { | ||
| "object_id": "", | ||
| "permissions": [ | ||
| { | ||
| "permission_level": "CAN_READ", | ||
| "user_name": "deco-test-user@databricks.com" | ||
| }, | ||
| { | ||
| "permission_level": "CAN_MANAGE", | ||
| "service_principal_name": "[USERNAME]" | ||
| } | ||
| ] | ||
| }, | ||
| "vars": { | ||
| "object_id": "/dashboards/${resources.dashboards.foo.id}" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
10 changes: 10 additions & 0 deletions
10
acceptance/bundle/resources/permissions/dashboards/create/out.plan.terraform.json
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,10 @@ | ||
| { | ||
| "plan": { | ||
| "resources.dashboards.foo": { | ||
| "action": "create" | ||
| }, | ||
| "resources.dashboards.foo.permissions": { | ||
| "action": "create" | ||
| } | ||
| } | ||
| } |
16 changes: 16 additions & 0 deletions
16
acceptance/bundle/resources/permissions/dashboards/create/out.requests.deploy.direct.json
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,16 @@ | ||
| { | ||
| "method": "PUT", | ||
| "path": "/api/2.0/permissions/dashboards/[DASHBOARD_ID]", | ||
| "body": { | ||
| "access_control_list": [ | ||
| { | ||
| "permission_level": "CAN_READ", | ||
| "user_name": "deco-test-user@databricks.com" | ||
| }, | ||
| { | ||
| "permission_level": "CAN_MANAGE", | ||
| "service_principal_name": "[USERNAME]" | ||
| } | ||
| ] | ||
| } | ||
| } |
16 changes: 16 additions & 0 deletions
16
acceptance/bundle/resources/permissions/dashboards/create/out.requests.deploy.terraform.json
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,16 @@ | ||
| { | ||
| "method": "PUT", | ||
| "path": "/api/2.0/permissions/dashboards/[DASHBOARD_ID]", | ||
| "body": { | ||
| "access_control_list": [ | ||
| { | ||
| "permission_level": "CAN_MANAGE", | ||
| "service_principal_name": "[USERNAME]" | ||
| }, | ||
| { | ||
| "permission_level": "CAN_READ", | ||
| "user_name": "deco-test-user@databricks.com" | ||
| } | ||
| ] | ||
| } | ||
| } |
Empty file.
5 changes: 5 additions & 0 deletions
5
...ptance/bundle/resources/permissions/dashboards/create/out.requests.destroy.terraform.json
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,5 @@ | ||
| { | ||
| "method": "PUT", | ||
| "path": "/api/2.0/permissions/dashboards/[DASHBOARD_ID]", | ||
| "body": {} | ||
| } |
6 changes: 6 additions & 0 deletions
6
acceptance/bundle/resources/permissions/dashboards/create/out.test.toml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
acceptance/bundle/resources/permissions/dashboards/create/output.txt
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,27 @@ | ||
|
|
||
| >>> [CLI] bundle validate -o json | ||
| [ | ||
| { | ||
| "level": "CAN_READ", | ||
| "user_name": "deco-test-user@databricks.com" | ||
| }, | ||
| { | ||
| "level": "CAN_MANAGE", | ||
| "service_principal_name": "[USERNAME]" | ||
| } | ||
| ] | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dashboard-perm-[UNIQUE_NAME]/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| >>> [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.dashboards.foo | ||
|
|
||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/dashboard-perm-[UNIQUE_NAME]/default | ||
|
|
||
| Deleting files... | ||
| Destroy complete! |
21 changes: 21 additions & 0 deletions
21
acceptance/bundle/resources/permissions/dashboards/create/script
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,21 @@ | ||
| if [ -z "$CLOUD_ENV" ]; then | ||
| export TEST_USER_EMAIL="deco-test-user@databricks.com" | ||
| fi | ||
|
|
||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
|
|
||
| trace $CLI bundle validate -o json | jq .resources.dashboards.foo.permissions | ||
| rm out.requests.txt | ||
|
|
||
| $CLI bundle plan --output json > out.plan.$DATABRICKS_BUNDLE_ENGINE.json | ||
|
|
||
| rm out.requests.txt | ||
| trace $CLI bundle deploy | ||
|
|
||
| dashboard_id=$($CLI bundle summary --output json | jq -r '.resources.dashboards.foo.id') | ||
| echo "$dashboard_id:DASHBOARD_ID" >> ACC_REPLS | ||
|
|
||
| print_requests.py //permissions > out.requests.deploy.$DATABRICKS_BUNDLE_ENGINE.json | ||
|
|
||
| trace $CLI bundle destroy --auto-approve | ||
| print_requests.py //permissions > out.requests.destroy.$DATABRICKS_BUNDLE_ENGINE.json |
3 changes: 3 additions & 0 deletions
3
acceptance/bundle/resources/permissions/dashboards/create/test.toml
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,3 @@ | ||
| Local = false | ||
| RequiresWarehouse = true | ||
| Cloud = true | ||
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
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.