psolom / RichFilemanager

An open-source file manager. Up-to-date for PHP, Java, ASHX, ASP, NodeJs & Python 3 Flask. Contributions are welcome!
http://fm.devale.pro
905 stars 251 forks source link

Capabilities - move not set but still possible #375

Open npirlot opened 5 years ago

npirlot commented 5 years ago

In raising this issue, I confirm the following (please check boxes):

I use the following server-side connector (check one):

My familiarity with the project is as follows (check one):


In the config.json, I provide the desired capabilities, having removed "move" from them, but it is still possible in the filemanager to drag folders and files, in both the tree panel and the files panel, and in effect move them.

Should this not be disabled / impossible if "move" is not in the capabilities in the json config?

Here is a snapshot of the options returned in browser by my json config file:

image

Thanks

npirlot commented 5 years ago

PS: in the meantime, I've set the permission function fm_has_write_permission() in PHP connector to return false on $_GET['mode'] == "move", which does not allow the move, but the user experience is not great as they can still drag and drop folders/files.

tharris9d commented 5 years ago

We are having the exact same issue with capabilities set either on the server side in.Net Core filemanagercontroller.cs or on the client side using filemanager.config.json We removed 'move', 'copy' and 'rename' but users can drag files and folders all over the place. We have over 30 set folders that shouldn't be changed. Please advise. Any drag-drop quick fixes in the RichFilemanager code that we can change?

tharris9d commented 5 years ago

Here is my emergency fix in filemanager.js. Still testing to see if there are any unknown issues. Checking with hasCapability. If move is in the list then use drag drop else no drag drop at all. if (hasCapability('move')) {

    ko.bindingHandlers.draggableView = {
      init: function (element, valueAccessor, allBindingsAccessor) {
        fmModel.ddModel.makeDraggable(valueAccessor(), element);
      }
    };

    ko.bindingHandlers.droppableView = {
      init: function (element, valueAccessor, allBindingsAccessor) {
        fmModel.ddModel.makeDroppable(valueAccessor(), element);
      }
    };

    ko.bindingHandlers.draggableTree = {
      init: function (element, valueAccessor, allBindingsAccessor) {
        fmModel.ddModel.makeDraggable(valueAccessor(), element);
      }
    };

    ko.bindingHandlers.droppableTree = {
      init: function (element, valueAccessor, allBindingsAccessor) {
        fmModel.ddModel.makeDroppable(valueAccessor(), element);
      }
    };
  }
  //////////// Hide if capability does not have move
  $wrapper.mousewheel(function (e) {
    if (!fmModel.ddModel.dragHelper) {
      return true;
    }