You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -92,12 +84,7 @@ export class ConnectClusterTool extends AtlasToolBase {
92
84
body: {
93
85
databaseName: "admin",
94
86
groupId: projectId,
95
-
roles: [
96
-
{
97
-
roleName,
98
-
databaseName: "admin",
99
-
},
100
-
],
87
+
roles: [role],
101
88
scopes: [{type: "CLUSTER",name: clusterName}],
102
89
username,
103
90
password,
@@ -258,4 +245,35 @@ export class ConnectClusterTool extends AtlasToolBase {
258
245
],
259
246
};
260
247
}
248
+
249
+
/**
250
+
* @description Get the role name for the database user based on the Atlas Admin API https://www.mongodb.com/docs/atlas/mongodb-users-roles-and-privileges/
251
+
* @returns The role name for the database user
252
+
*/
253
+
privategetRoleFromConfig(): DatabaseUserRole{
254
+
if(this.config.readOnly){
255
+
return{
256
+
roleName: "readAnyDatabase",
257
+
databaseName: "admin",
258
+
};
259
+
}
260
+
261
+
// If all write tools are enabled, use readWriteAnyDatabase
0 commit comments