Skip to content

Commit 31eeb6b

Browse files
authored
Fix Cluster Selector (#1289)
## Changes - Show proper title when the selector is invoked from the tree view - Fix the permission detection iam API errors out on all the clusters for which a users doesn't have CAN_MANAGE permission. ClustersAPI works better in that regard and returns correct acl info. Also add `users` to the groups check, which refers to "All Workspace Users". ## Tests <!-- How is this tested? -->
1 parent fded834 commit 31eeb6b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

packages/databricks-vscode/src/configuration/ConnectionCommands.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ export class ConnectionCommands implements Disposable {
130130
const quickPick = window.createQuickPick<
131131
ClusterItem | QuickPickItem
132132
>();
133-
quickPick.title = title;
133+
quickPick.title =
134+
typeof title === "string" ? title : "Select Cluster";
134135
quickPick.keepScrollPosition = true;
135136
quickPick.busy = true;
136137

packages/databricks-vscode/src/sdk-extensions/Cluster.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,16 @@ export class Cluster {
173173
));
174174
}
175175

176-
const permissionApi = new iam.PermissionsService(this.client);
177-
const perms = await permissionApi.get({
178-
request_object_id: this.id,
179-
request_object_type: "clusters",
176+
const perms = await this.clusterApi.getPermissions({
177+
cluster_id: this.id,
180178
});
181-
182179
return (this._hasExecutePerms =
183180
(perms.access_control_list ?? []).find((ac) => {
184181
return (
185182
ac.user_name === userDetails.userName ||
183+
// `users` is a system group for "All Workspace Users"
184+
// https://docs.databricks.com/en/admin/users-groups/groups.html
185+
ac.group_name === "users" ||
186186
userDetails.groups
187187
?.map((v) => v.display)
188188
.includes(ac.group_name ?? "")

0 commit comments

Comments
 (0)