Skip to content

Commit

Permalink
Patches for clipboard_controller and files_controller
Browse files Browse the repository at this point in the history
  • Loading branch information
mischa78 committed Jun 24, 2017
1 parent c9bb944 commit 5f20250
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
13 changes: 13 additions & 0 deletions patches/clipboard_controller.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/app/controllers/clipboard_controller.rb b/app/controllers/clipboard_controller.rb
index 0eff17b..1c8183b 100644
--- a/app/controllers/clipboard_controller.rb
+++ b/app/controllers/clipboard_controller.rb
@@ -3,7 +3,7 @@ class ClipboardController < ApplicationController
before_action :require_existing_target_folder, :only => [:copy, :move]
before_action :require_target_is_not_child, :only => :move
before_action :require_create_permission, :only => [:copy, :move]
- before_action :require_read_permission, :only => :create
+ before_action :require_read_permission, :only => [:create, :copy, :move]
before_action :require_delete_permission, :only => :move

# @item is set in require_existing_item
20 changes: 20 additions & 0 deletions patches/files_controller.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 9f9cd8a..22b3a5e 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -43,9 +43,12 @@ class FilesController < ApplicationController
end

def exists
- @file = UserFile.new(:attachment_file_name => params[:name].gsub(RESTRICTED_CHARACTERS, '_'))
- @file.folder_id = params[:folder]
- render :json => [email protected]?
+ @folder = Folder.find(params[:folder])
+
+ if current_user.can_read @folder || current_user.can_write @folder
+ @file = @folder.user_files.build(:attachment_file_name => params[:name].gsub(RESTRICTED_CHARACTERS, '_'))
+ render :json => [email protected]?
+ end
end

private

0 comments on commit 5f20250

Please sign in to comment.