@mongoosejs/studio 0.0.114 → 0.0.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,6 +22,7 @@ const ExecuteScriptParams = new Archetype({
|
|
|
22
22
|
|
|
23
23
|
module.exports = ({ db, studioConnection }) => async function executeScript(params) {
|
|
24
24
|
const { initiatedById, chatMessageId, script, roles } = new ExecuteScriptParams(params);
|
|
25
|
+
const ChatThread = studioConnection.model('__Studio_ChatThread');
|
|
25
26
|
const ChatMessage = studioConnection.model('__Studio_ChatMessage');
|
|
26
27
|
|
|
27
28
|
await authorize('ChatMessage.executeScript', roles);
|
|
@@ -30,8 +31,9 @@ module.exports = ({ db, studioConnection }) => async function executeScript(para
|
|
|
30
31
|
if (!chatMessage) {
|
|
31
32
|
throw new Error('Chat message not found');
|
|
32
33
|
}
|
|
34
|
+
const chatThread = await ChatThread.findById(chatMessage.chatThreadId).orFail();
|
|
33
35
|
|
|
34
|
-
if (initiatedById &&
|
|
36
|
+
if (initiatedById && chatThread.userId?.toString() !== initiatedById.toString()) {
|
|
35
37
|
throw new Error('Unauthorized');
|
|
36
38
|
}
|
|
37
39
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongoosejs/studio",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.115",
|
|
4
4
|
"description": "A sleek, powerful MongoDB UI with built-in dashboarding and auth, seamlessly integrated with your Express, Vercel, or Netlify app.",
|
|
5
5
|
"homepage": "https://studio.mongoosejs.io/",
|
|
6
6
|
"repository": {
|