summaryrefslogtreecommitdiff
path: root/src/node
diff options
context:
space:
mode:
authorJohn McLear <john@mclear.co.uk>2015-05-20 01:05:53 +0100
committerJohn McLear <john@mclear.co.uk>2015-05-20 01:05:53 +0100
commit3944a0e79b21802aecf10457d9e44f1fc644a278 (patch)
treebda3129cf9b92d29bbc4c050bd6c35052b77dc37 /src/node
parentfe7ab21c84557834b3e68dc93e2316879bcb59a6 (diff)
downloadetherpad-lite-3944a0e79b21802aecf10457d9e44f1fc644a278.zip
more read only mode fixes andadd support for handleMessageSecurity hook
Diffstat (limited to 'src/node')
-rw-r--r--src/node/handler/PadMessageHandler.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js
index e15af1a4..9a0d1ee7 100644
--- a/src/node/handler/PadMessageHandler.js
+++ b/src/node/handler/PadMessageHandler.js
@@ -190,6 +190,16 @@ exports.handleMessage = function(client, message)
}
var handleMessageHook = function(callback){
+ // Allow plugins to bypass the readonly message blocker
+ hooks.aCallAll("handleMessageSecurity", { client: client, message: message }, function ( err, messages ) {
+ if(ERR(err, callback)) return;
+ _.each(messages, function(newMessage){
+ if ( newMessage === true ) {
+ thisSession.readonly = false;
+ }
+ });
+ });
+
var dropMessage = false;
// Call handleMessage hook. If a plugin returns null, the message will be dropped. Note that for all messages
// handleMessage will be called, even if the client is not authorized
@@ -204,6 +214,7 @@ exports.handleMessage = function(client, message)
// If no plugins explicitly told us to drop the message, its ok to proceed
if(!dropMessage){ callback() };
});
+
}
var finalHandler = function () {