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 {
51
51
52
52
const expiryDate = new Date ( Date . now ( ) + EXPIRY_MS ) ;
53
53
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
+
54
64
await this . session . apiClient . createDatabaseUser ( {
55
65
params : {
56
66
path : {
@@ -62,7 +72,7 @@ export class ConnectClusterTool extends AtlasToolBase {
62
72
groupId : projectId ,
63
73
roles : [
64
74
{
65
- roleName : "readWriteAnyDatabase" ,
75
+ roleName,
66
76
databaseName : "admin" ,
67
77
} ,
68
78
] ,
You can’t perform that action at this time.
0 commit comments