File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,16 @@ export class ConnectClusterTool extends AtlasToolBase {
5151
5252 const expiryDate = new Date ( Date . now ( ) + EXPIRY_MS ) ;
5353
54+ const readOnly =
55+ this . config . readOnly ||
56+ ( this . config . disabledTools ?. includes ( "create" ) &&
57+ this . config . disabledTools ?. includes ( "update" ) &&
58+ this . config . disabledTools ?. includes ( "delete" ) &&
59+ ! this . config . disabledTools ?. includes ( "read" ) &&
60+ ! this . config . disabledTools ?. includes ( "metadata" ) ) ;
61+
62+ const roleName = readOnly ? "readAnyDatabase" : "readWriteAnyDatabase" ;
63+
5464 await this . session . apiClient . createDatabaseUser ( {
5565 params : {
5666 path : {
@@ -62,7 +72,7 @@ export class ConnectClusterTool extends AtlasToolBase {
6272 groupId : projectId ,
6373 roles : [
6474 {
65- roleName : "readWriteAnyDatabase" ,
75+ roleName,
6676 databaseName : "admin" ,
6777 } ,
6878 ] ,
You can’t perform that action at this time.
0 commit comments