From 9fb81b2814f36b28783ce011f48739021442adb6 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 15 Jul 2015 10:11:16 +0100 Subject: [PATCH] Permit login with blank scope Required for the editor, which doesn't know the appropriate scope for the user logging in. The user will adopt their default permission scope once logged in. --- editor/js/ui/deploy.js | 2 +- editor/js/ui/editor.js | 2 ++ editor/js/ui/library.js | 2 +- editor/js/user.js | 2 +- red/api/auth/permissions.js | 14 +++++++++----- red/api/auth/strategies.js | 3 +++ test/red/api/auth/permissions_spec.js | 4 ++++ 7 files changed, 21 insertions(+), 8 deletions(-) diff --git a/editor/js/ui/deploy.js b/editor/js/ui/deploy.js index 1c350f0ea..6d81c97ce 100644 --- a/editor/js/ui/deploy.js +++ b/editor/js/ui/deploy.js @@ -237,7 +237,7 @@ RED.deploy = (function() { }).fail(function(xhr,textStatus,err) { RED.nodes.dirty(true); if (xhr.responseText) { - RED.notify(RED._("notification.error",{message:xhr.responseJSON.message}),"error"); + RED.notify(RED._("notification.error",{message:xhr.responseText}),"error"); } else { RED.notify(RED._("notification.error",{message:RED._("deploy.errors.noResponse")}),"error"); } diff --git a/editor/js/ui/editor.js b/editor/js/ui/editor.js index 1125b4d5d..4e078798f 100644 --- a/editor/js/ui/editor.js +++ b/editor/js/ui/editor.js @@ -287,6 +287,8 @@ RED.editor = (function() { }).done(function() { RED.library.loadFlowLibrary(); RED.notify(RED._("library.savedNodes"),"success"); + }).fail(function(xhr,textStatus,err) { + RED.notify(RED._("library.saveFailed",{message:xhr.responseText}),"error"); }); } } diff --git a/editor/js/ui/library.js b/editor/js/ui/library.js index 15b7bb7b6..4918554d0 100644 --- a/editor/js/ui/library.js +++ b/editor/js/ui/library.js @@ -329,7 +329,7 @@ RED.library = (function() { }).done(function(data,textStatus,xhr) { RED.notify(RED._("library.savedType", {type:options.type}),"success"); }).fail(function(xhr,textStatus,err) { - RED.notify(RED._("library.saveFailed",{message:xhr.responseJSON.message}),"error"); + RED.notify(RED._("library.saveFailed",{message:xhr.responseText}),"error"); }); } $( "#node-dialog-library-save-confirm" ).dialog({ diff --git a/editor/js/user.js b/editor/js/user.js index 39049b443..d2968a550 100644 --- a/editor/js/user.js +++ b/editor/js/user.js @@ -86,7 +86,7 @@ RED.user = (function() { var body = { client_id: "node-red-editor", grant_type: "password", - scope:"*" + scope:"" } for (var i=0;i