Repository: zeppelin
Updated Branches:
  refs/heads/master fb4c778b9 -> 91604c878


[ZEPPELIN-2167] User with insufficient privileges can still restore files by 
renaming files in/out of Trash

### What is this PR for?
User with insufficient privileges can still restore files by renaming files 
in/out of Trash

### What type of PR is it?
[Bug Fix]

### What is the Jira issue?
* [ZEPPELIN-2167](https://issues.apache.org/jira/browse/ZEPPELIN-2167)

### How should this be tested?
Steps to reproduce:
 - Create a notebook "test_nb" as bob.
 - Delete the notebook
 - Login as mary and try restoring "test_nb" from Trash folder. The system 
correctly complains of insufficient privileges.
 - Open the "test_nb" notebook from Trash folder. The notebook opens with title 
"~Trash/test_nb".
 - Edit the title and remove the prefix "~Trash".

If you now look at the list of notebooks there is no file "test_nb" in Trash.
Interestingly when you try and delete the recently moved file from Trash it 
complains that mary does not have privileges to delete it. Edit the title of 
that notebook to "~Trash/test_nb" and it goes back to Trash folder.

### Questions:
* Does the licenses files need update? N/A
* Is there breaking changes for older versions? N/A
* Does this needs documentation? N/A

Author: Prabhjyot Singh <prabhjyotsi...@gmail.com>

Closes #2086 from prabhjyotsingh/ZEPPELIN-2167 and squashes the following 
commits:

07221e0 [Prabhjyot Singh] updateNoteName should use renameNote function


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/91604c87
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/91604c87
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/91604c87

Branch: refs/heads/master
Commit: 91604c878fbf8f1ea5b49d85912b66bbcc50c027
Parents: fb4c778
Author: Prabhjyot Singh <prabhjyotsi...@gmail.com>
Authored: Wed Mar 1 19:28:39 2017 +0530
Committer: Prabhjyot Singh <prabhjyotsi...@gmail.com>
Committed: Sat Mar 4 09:38:00 2017 +0530

----------------------------------------------------------------------
 zeppelin-web/src/app/notebook/notebook.controller.js |  2 +-
 .../src/app/notebook/notebook.controller.test.js     | 15 ++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/91604c87/zeppelin-web/src/app/notebook/notebook.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/notebook.controller.js 
b/zeppelin-web/src/app/notebook/notebook.controller.js
index 928bcbf..1799a6e 100644
--- a/zeppelin-web/src/app/notebook/notebook.controller.js
+++ b/zeppelin-web/src/app/notebook/notebook.controller.js
@@ -422,7 +422,7 @@ function NotebookCtrl($scope, $route, $routeParams, 
$location, $rootScope,
     const trimmedNewName = newName.trim();
     if (trimmedNewName.length > 0 && $scope.note.name !== trimmedNewName) {
       $scope.note.name = trimmedNewName;
-      websocketMsgSrv.updateNote($scope.note.id, $scope.note.name, 
$scope.note.config);
+      websocketMsgSrv.renameNote($scope.note.id, $scope.note.name);
     }
   };
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/91604c87/zeppelin-web/src/app/notebook/notebook.controller.test.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/notebook.controller.test.js 
b/zeppelin-web/src/app/notebook/notebook.controller.test.js
index f4a420b..df90c81 100644
--- a/zeppelin-web/src/app/notebook/notebook.controller.test.js
+++ b/zeppelin-web/src/app/notebook/notebook.controller.test.js
@@ -7,7 +7,8 @@ describe('Controller: NotebookCtrl', function() {
     getNote: function() {},
     listRevisionHistory: function() {},
     getInterpreterBindings: function() {},
-    updateNote: function() {}
+    updateNote: function() {},
+    renameNote: function() {}
   };
 
   var baseUrlSrvMock = {
@@ -100,24 +101,24 @@ describe('Controller: NotebookCtrl', function() {
   });
 
   it('should NOT update note name when updateNoteName() is called with an 
invalid name', function() {
-    spyOn(websocketMsgSrvMock, 'updateNote');
+    spyOn(websocketMsgSrvMock, 'renameNote');
     scope.updateNoteName('');
     expect(scope.note.name).toEqual(noteMock.name);
-    expect(websocketMsgSrvMock.updateNote).not.toHaveBeenCalled();
+    expect(websocketMsgSrvMock.renameNote).not.toHaveBeenCalled();
     scope.updateNoteName(' ');
     expect(scope.note.name).toEqual(noteMock.name);
-    expect(websocketMsgSrvMock.updateNote).not.toHaveBeenCalled();
+    expect(websocketMsgSrvMock.renameNote).not.toHaveBeenCalled();
     scope.updateNoteName(scope.note.name);
     expect(scope.note.name).toEqual(noteMock.name);
-    expect(websocketMsgSrvMock.updateNote).not.toHaveBeenCalled();
+    expect(websocketMsgSrvMock.renameNote).not.toHaveBeenCalled();
   });
 
   it('should update note name when updateNoteName() is called with a valid 
name', function() {
-    spyOn(websocketMsgSrvMock, 'updateNote');
+    spyOn(websocketMsgSrvMock, 'renameNote');
     var newName = 'Your Note';
     scope.updateNoteName(newName);
     expect(scope.note.name).toEqual(newName);
-    expect(websocketMsgSrvMock.updateNote).toHaveBeenCalled();
+    expect(websocketMsgSrvMock.renameNote).toHaveBeenCalled();
   });
 
   it('should reload note info once per one "setNoteMenu" event', function() {

Reply via email to