diff --git a/.travis.yml b/.travis.yml index e91e4676..cb117264 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -23,10 +23,10 @@ language: ruby sudo: true -dist: trusty +dist: xenial rvm: - - 2.4 + - 2.5 before_install: - mysql -e 'CREATE DATABASE IF NOT EXISTS test CHARACTER SET utf8mb4;' diff --git a/CHANGELOG.md b/CHANGELOG.md index a635aaa6..03a7c590 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,30 @@ Changelog for Redmine DMSF ========================== +2.0.0 *2019-02-28* +------------------ + + Compatibility with Redmine 4.0 + Russian localization updated + +* Bug: #976 - Can't link document to issue with column in subject +* Bug: #969 - About the DMSF folder search logic +* Bug: #966 - folder_manipulation permission +* Bug: #965 - tag column missing in the dms_file_revision_table +* Bug: #959 - crete symbolic link error +* Bug: #956 - About "External" of "Link from" +* Bug: #950 - Wrong description, missing argument for macro {{dmsft}} +* Bug: #940 - dav4rack license +* Bug: #937 - Documents upload if disk is full +* Bug: #936 - Then go to configuration an internal error #500 appear +* Bug: #935 - Upload failure for 2.0 +* Bug: #934 - problem to get reversion error +* Bug: #933 - změny v xapian_indexer +* Bug: #932 - undefined method `to_prepare' for ActionDispatch::Reloader:Class (Redmine 4.0 / Rails 5) +* Bug: #929 - Problems in revision history +* New: #928 - About Redmine 4.0.0 +* New: #576 - Installation problem 1.5.7 (step 4 of the guide) + 1.6.2 *2018-12-04* ------------------ diff --git a/Gemfile b/Gemfile index d9294841..e6511368 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -22,7 +22,7 @@ source 'https://rubygems.org' -gem 'rubyzip', '>= 1.0.0' +gem 'rubyzip', '>= 1.1.3' gem 'zip-zip' gem 'simple_enum' gem 'uuidtools' @@ -35,3 +35,7 @@ end # Dav4Rack gem 'ox' + +group :test do + gem 'rails-controller-testing' +end \ No newline at end of file diff --git a/README.md b/README.md index b45d05de..4e0bdc46 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Redmine DMSF Plugin =================== -The current version of Redmine DMSF is **1.6.2** [![Build Status](https://api.travis-ci.org/danmunn/redmine_dmsf.png)](https://travis-ci.org/danmunn/redmine_dmsf) +The current version of Redmine DMSF is **2.0.0** [![Build Status](https://api.travis-ci.org/danmunn/redmine_dmsf.png)](https://travis-ci.org/danmunn/redmine_dmsf) Redmine DMSF is Document Management System Features plugin for Redmine issue tracking system; It is aimed to replace current Redmine's Documents module. @@ -38,12 +38,12 @@ Features * Document tagging * Trash bin * Documents attachable to issues - * Compatible with Redmine 3.4.x + * Compatible with Redmine 4.0.x Dependencies ------------ - * Redmine 3.4.0 or higher + * Redmine 4.0.0 or higher ### Full-text search (optional) @@ -211,14 +211,20 @@ There's a patch (tested with Redmine 3.4.2) that helps you to modify all help fi Setup / Upgrade --------------- -Before installing ensure that the Redmine instance is stopped. +You can either clone the master branch or download the latest zipped version. Before installing ensure that the Redmine instance is stopped. -1. In case of upgrade BACKUP YOUR DATABASE first -2. Put redmine_dmsf plugin directory into plugins. + git clone git@github.com:danmunn/redmine_dmsf.git + + wget https://github.com/danmunn/redmine_dmsf/archive/master.zip + +1. In case of upgrade **BACKUP YOUR DATABASE, ORIGINAL PLUGIN AND THE FOLDER WITH DOCUMENTS** first!!! +2. Put redmine_dmsf plugin directory into plugins. The plugins sub-directory must be named just **redmine_dmsf**. In case + of need rename _redmine_dmsf-x.y.z_ to *redmine_dmsf*. +3. **Go to the redmine directory** `cd redmine` 3. Install dependencies: `bundle install`. -4. Initialize/Update database: `bundle exec rake redmine:plugins:migrate RAILS_ENV="production"`. +4. Initialize/Update database: `bundle exec rake redmine:plugins:migrate NAME=redmine_dmsf RAILS_ENV="production"`. 5. The access rights must be set for web server, example: `chown -R www-data:www-data plugins/redmine_dmsf`. -6. Restart the web server. +6. Restart the web server. e.g. `service apache2 restart` 7. You should configure the plugin via Redmine interface: Administration -> Plugins -> DMSF -> Configure. 8. Assign DMSF permissions to appropriate roles. 9. There are a few rake tasks: @@ -279,13 +285,13 @@ It is necessary to index DMSF files with omindex before searching attempts to re 1. Change the configuration part of redmine_dmsf/extra/xapian_indexer.rb file according to your environment. (The path to the index database set in xapian_indexer.rb must corresponds to the path set in the plugin's settings.) - 2. Run `ruby redmine_dmsf/extra/xapian_indexer.rb -vf` + 2. Run `ruby redmine_dmsf/extra/xapian_indexer.rb -v` This command should be run on regular basis (e.g. from cron) Example of cron job (once per hour at 8th minute): - 8 * * * * root /usr/bin/ruby redmine_dmsf/extra/xapian_indexer.rb -f + 8 * * * * root /usr/bin/ruby redmine_dmsf/extra/xapian_indexer.rb See redmine_dmsf/extra/xapian_indexer.rb for help. diff --git a/after_init.rb b/after_init.rb index 6114569a..84ce3d8d 100644 --- a/after_init.rb +++ b/after_init.rb @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -23,6 +23,8 @@ require_dependency 'zip' require_dependency File.dirname(__FILE__) + '/lib/redmine_dmsf.rb' +ActiveSupport::Dependencies.autoload_paths << File.join(File.dirname(__FILE__), 'app', 'validators') + def init # Administration menu extension Redmine::MenuManager.map :admin_menu do |menu| @@ -100,7 +102,7 @@ else init end -ActionDispatch::Reloader.to_prepare do +RedmineExtensions::Reloader.to_prepare do # Rubyzip configuration Zip.unicode_names = true diff --git a/app/controllers/dmsf_context_menus_controller.rb b/app/controllers/dmsf_context_menus_controller.rb index b4b29788..20547503 100644 --- a/app/controllers/dmsf_context_menus_controller.rb +++ b/app/controllers/dmsf_context_menus_controller.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb index cd2ca7ff..fa182284 100644 --- a/app/controllers/dmsf_controller.rb +++ b/app/controllers/dmsf_controller.rb @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -21,6 +21,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class DmsfController < ApplicationController + include RedmineDmsf::DmsfZip before_action :find_project before_action :authorize, :except => [:expand_folder] @@ -93,7 +94,7 @@ class DmsfController < ApplicationController :type => 'application/zip', :disposition => 'attachment') rescue Exception => e - flash[:error] = e.message + flash[:errors] = e.message end def entries_operation @@ -150,7 +151,7 @@ class DmsfController < ApplicationController rescue DmsfAccessError render_403 # and return rescue StandardError => e - flash[:error] = e.message + flash[:errors] = e.message Rails.logger.error e.message end end @@ -170,9 +171,9 @@ class DmsfController < ApplicationController def entries_email if params[:email][:to].strip.blank? - flash[:error] = l(:error_email_to_must_be_entered) + flash[:errors] = l(:error_email_to_must_be_entered) else - DmsfMailer.send_documents(@project, params[:email]).deliver + DmsfMailer.deliver_send_documents(@project, params[:email].permit!) File.delete(params[:email][:zipped_content]) flash[:notice] = l(:notice_email_sent, params[:email][:to]) end @@ -189,7 +190,6 @@ class DmsfController < ApplicationController @parent = @folder.dmsf_folder @pathfolder = copy_folder(@folder) @force_file_unlock_allowed = User.current.allowed_to?(:force_file_unlock, @project) - @users = Principal.active.where(id: @folder.dmsf_folder_permissions.users.map{ |p| p.object_id }) end def create @@ -247,7 +247,7 @@ class DmsfController < ApplicationController if result flash[:notice] = l(:notice_folder_deleted) else - flash[:error] = @folder.errors.full_messages.to_sentence + flash[:errors] = @folder.errors.full_messages.to_sentence end respond_to do |format| format.html do @@ -265,7 +265,7 @@ class DmsfController < ApplicationController if @folder.restore flash[:notice] = l(:notice_dmsf_folder_restored) else - flash[:error] = @folder.errors.full_messages.to_sentence + flash[:errors] = @folder.errors.full_messages.to_sentence end redirect_to :back end @@ -279,7 +279,7 @@ class DmsfController < ApplicationController if @project.save flash[:notice] = l(:notice_folder_details_were_saved) else - flash[:error] = @project.errors.full_messages.to_sentence + flash[:errors] = @project.errors.full_messages.to_sentence end end redirect_to dmsf_folder_path(:id => @project) @@ -337,7 +337,7 @@ class DmsfController < ApplicationController @folder.unlock! flash[:notice] = l(:notice_folder_unlocked) else - flash[:error] = l(:error_only_user_that_locked_folder_can_unlock_it) + flash[:errors] = l(:error_only_user_that_locked_folder_can_unlock_it) end end redirect_to :back @@ -366,15 +366,16 @@ class DmsfController < ApplicationController end def email_entries(selected_folders, selected_files) - zip = DmsfZip.new + zip = Zip.new zip_entries(zip, selected_folders, selected_files) zipped_content = DmsfHelper.temp_dir.join(DmsfHelper.temp_filename('dmsf_email_sent_documents.zip')) File.open(zipped_content, 'wb') do |f| - zip_file = File.open(zip.finish, 'rb') - while (buffer = zip_file.read(8192)) - f.write(buffer) + File.open(zip.finish, 'rb') do |zip_file| + while (buffer = zip_file.read(8192)) + f.write(buffer) + end end end @@ -396,8 +397,8 @@ class DmsfController < ApplicationController :folders => selected_folders, :files => selected_files, :subject => "#{@project.name} #{l(:label_dmsf_file_plural).downcase}", - :from => Setting.plugin_redmine_dmsf['dmsf_documents_email_from'].blank? ? - "#{User.current.name} <#{User.current.mail}>" : Setting.plugin_redmine_dmsf['dmsf_documents_email_from'], + :from => Setting.plugin_redmine_dmsf['dmsf_documents_email_from'].presence || + "#{User.current.name} <#{User.current.mail}>", :reply_to => Setting.plugin_redmine_dmsf['dmsf_documents_email_reply_to'] } render :action => 'email_entries' @@ -408,7 +409,7 @@ class DmsfController < ApplicationController end def download_entries(selected_folders, selected_files) - zip = DmsfZip.new + zip = Zip.new zip_entries(zip, selected_folders, selected_files) zip.files.each do |f| audit = DmsfFileRevisionAccess.new @@ -428,7 +429,7 @@ class DmsfController < ApplicationController end def zip_entries(zip, selected_folders, selected_files) - member = Member.where(user_id: User.current.id, project_id: @project.id).first + member = Member.find_by(user_id: User.current.id, project_id: @project.id) selected_folders.each do |selected_folder_id| folder = DmsfFolder.visible.find_by(id: selected_folder_id) if folder @@ -460,7 +461,7 @@ class DmsfController < ApplicationController folder = DmsfFolder.find_by(id: id) if folder unless folder.restore - flash[:error] = folder.errors.full_messages.to_sentence + flash[:errors] = folder.errors.full_messages.to_sentence end else raise FileNotFound @@ -471,7 +472,7 @@ class DmsfController < ApplicationController file = DmsfFile.find_by(id: id) if file unless file.restore - flash[:error] = file.errors.full_messages.to_sentence + flash[:errors] = file.errors.full_messages.to_sentence end else raise FileNotFound @@ -482,7 +483,7 @@ class DmsfController < ApplicationController link = DmsfLink.find_by(id: id) if link unless link.restore - flash[:error] = link.errors.full_messages.to_sentence + flash[:errors] = link.errors.full_messages.to_sentence end else raise FileNotFound @@ -493,10 +494,11 @@ class DmsfController < ApplicationController def delete_entries(selected_folders, selected_files, selected_dir_links, selected_file_links, selected_url_links, commit) # Folders selected_folders.each do |id| + raise DmsfAccessError unless User.current.allowed_to?(:folder_manipulation, @project) folder = DmsfFolder.find_by(id: id) if folder unless folder.delete commit - flash[:error] = folder.errors.full_messages.to_sentence + flash[:errors] = folder.errors.full_messages.to_sentence return end elsif !commit @@ -521,12 +523,9 @@ class DmsfController < ApplicationController # Activities unless deleted_files.empty? begin - recipients = DmsfMailer.get_notify_users(@project, deleted_files) - recipients.each do |u| - DmsfMailer.files_deleted(u, @project, deleted_files).deliver - end + recipients = DmsfMailer.deliver_files_deleted(@project, deleted_files) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] - unless recipients.empty? + if recipients.any? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') flash[:warning] = l(:warning_email_notifications, :to => to) @@ -544,7 +543,7 @@ class DmsfController < ApplicationController link = DmsfLink.find_by(id: id) link.delete commit if link end - if flash[:error].blank? && flash[:warning].blank? + if flash[:errors].blank? && flash[:warning].blank? flash[:notice] = l(:notice_entries_deleted) end end @@ -681,7 +680,7 @@ class DmsfController < ApplicationController @subfolders = DmsfHelper.visible_folders(@subfolders, @project) end - @ajax_upload_size = Setting.plugin_redmine_dmsf['dmsf_max_ajax_upload_filesize'].present? ? Setting.plugin_redmine_dmsf['dmsf_max_ajax_upload_filesize'] : 100 + @ajax_upload_size = Setting.plugin_redmine_dmsf['dmsf_max_ajax_upload_filesize'].presence || 100 # Trash @trash_visible = @folder_manipulation_allowed && @file_manipulation_allowed && diff --git a/app/controllers/dmsf_files_controller.rb b/app/controllers/dmsf_files_controller.rb index 61b19bfb..c95e9f1a 100644 --- a/app/controllers/dmsf_files_controller.rb +++ b/app/controllers/dmsf_files_controller.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -57,7 +57,7 @@ class DmsfFilesController < ApplicationController access.dmsf_file_revision = @revision access.action = DmsfFileRevisionAccess::DownloadAction access.save! - member = Member.where(user_id: User.current.id, project_id: @file.project.id).first + member = Member.find_by(user_id: User.current.id, project_id: @file.project.id) if member && !member.dmsf_title_format.nil? && !member.dmsf_title_format.empty? title_format = member.dmsf_title_format else @@ -95,7 +95,7 @@ class DmsfFilesController < ApplicationController def create_revision if params[:dmsf_file_revision] if @file.locked_for_user? - flash[:error] = l(:error_file_is_locked) + flash[:errors] = l(:error_file_is_locked) else revision = DmsfFileRevision.new revision.title = params[:dmsf_file_revision][:title] @@ -139,8 +139,10 @@ class DmsfFilesController < ApplicationController # Custom fields if params[:dmsf_file_revision][:custom_field_values].present? - params[:dmsf_file_revision][:custom_field_values].each_with_index do |v, i| - revision.custom_field_values[i].value = v[1] + i = 0 + params[:dmsf_file_revision][:custom_field_values].each do |_, v| + revision.custom_field_values[i].value = v + i = i + 1 end end @@ -149,39 +151,44 @@ class DmsfFilesController < ApplicationController if revision.save revision.assign_workflow(params[:dmsf_workflow_id]) if upload - FileUtils.mv(upload.tempfile_path, revision.disk_file(false)) + begin + FileUtils.mv(upload.tempfile_path, revision.disk_file(false)) + rescue StandardError => e + Rails.logger.error e.message + flash[:error] = e.message + revision.destroy + redirect_to :back + return + end end if @file.locked? && !@file.locks.empty? begin @file.unlock! flash[:notice] = "#{l(:notice_file_unlocked)}, " rescue Exception => e - logger.error "Cannot unlock the file: #{e.message}" + Rails.logger.error "Cannot unlock the file: #{e.message}" end end if @file.save @file.set_last_revision revision flash[:notice] = (flash[:notice].nil? ? '' : flash[:notice]) + l(:notice_file_revision_created) begin - recipients = DmsfMailer.get_notify_users(@project, [@file]) - recipients.each do |u| - DmsfMailer.files_updated(u, @project, [@file]).deliver - end + recipients = DmsfMailer.deliver_files_updated(@project, [@file]) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] - unless recipients.empty? + if recipients.any? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') flash[:warning] = l(:warning_email_notifications, :to => to) end end rescue Exception => e - logger.error "Could not send email notifications: #{e.message}" + Rails.logger.error "Could not send email notifications: #{e.message}" end else - flash[:error] = @file.errors.full_messages.join(', ') + flash[:errors] = @file.errors.full_messages.join(', ') end else - flash[:error] = revision.errors.full_messages.join(', ') + flash[:errors] = revision.errors.full_messages.join(', ') end end end @@ -196,12 +203,9 @@ class DmsfFilesController < ApplicationController flash[:notice] = l(:notice_file_deleted) unless commit begin - recipients = DmsfMailer.get_notify_users(@project, [@file]) - recipients.each do |u| - DmsfMailer.files_deleted(u, @project, [@file]).deliver - end + recipients = DmsfMailer.deliver_files_deleted(@project, [@file]) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] - unless recipients.empty? + if recipients.any? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') flash[:warning] = l(:warning_email_notifications, :to => to) @@ -213,7 +217,7 @@ class DmsfFilesController < ApplicationController end else msg = @file.errors.full_messages.join(', ') - flash[:error] = msg + flash[:errors] = msg Rails.logger.error msg end end @@ -238,7 +242,7 @@ class DmsfFilesController < ApplicationController end flash[:notice] = l(:notice_revision_deleted) else - flash[:error] = @revision.errors.full_messages.join(', ') + flash[:errors] = @revision.errors.full_messages.join(', ') end end redirect_to :action => 'show', :id => @file @@ -249,7 +253,7 @@ class DmsfFilesController < ApplicationController if @revision.obsolete flash[:notice] = l(:notice_revision_obsoleted) else - flash[:error] = @revision.errors.full_messages.join(', ') + flash[:errors] = @revision.errors.full_messages.join(', ') end end redirect_to :action => 'show', :id => @file @@ -263,7 +267,7 @@ class DmsfFilesController < ApplicationController @file.lock! flash[:notice] = l(:notice_file_locked) rescue Exception => e - flash[:error] = e.message + flash[:errors] = e.message end end redirect_to :back @@ -278,10 +282,10 @@ class DmsfFilesController < ApplicationController @file.unlock! flash[:notice] = l(:notice_file_unlocked) rescue Exception => e - flash[:error] = e.message + flash[:errors] = e.message end else - flash[:error] = l(:error_only_user_that_locked_file_can_unlock_it) + flash[:errors] = l(:error_only_user_that_locked_file_can_unlock_it) end end redirect_to :back @@ -311,7 +315,7 @@ class DmsfFilesController < ApplicationController if @file.restore flash[:notice] = l(:notice_dmsf_file_restored) else - flash[:error] = @file.errors.full_messages.to_sentence + flash[:errors] = @file.errors.full_messages.to_sentence end redirect_to :back end diff --git a/app/controllers/dmsf_files_copy_controller.rb b/app/controllers/dmsf_files_copy_controller.rb index 60f085ce..03f710ad 100644 --- a/app/controllers/dmsf_files_copy_controller.rb +++ b/app/controllers/dmsf_files_copy_controller.rb @@ -1,7 +1,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -36,7 +36,7 @@ class DmsfFilesCopyController < ApplicationController def copy new_file = @file.copy_to(@target_project, @target_folder) unless new_file.errors.empty? - flash[:error] = new_file.errors.full_messages.join(', ') + flash[:errors] = new_file.errors.full_messages.join(', ') redirect_to :action => 'new', :id => @file, :target_project_id => @target_project, :target_folder_id => @target_folder return @@ -47,7 +47,7 @@ class DmsfFilesCopyController < ApplicationController def move unless @file.move_to(@target_project, @target_folder) - flash[:error] = @file.errors.full_messages.join(', ') + flash[:errors] = @file.errors.full_messages.join(', ') redirect_to :action => 'new', :id => @file, :target_project_id => @target_project, :target_folder_id => @target_folder return @@ -89,7 +89,7 @@ private def check_target_folder if (@target_folder && @target_folder == @file.dmsf_folder) || (@target_folder.nil? && @file.dmsf_folder.nil? && @target_project == @file.project) - flash[:error] = l(:error_target_folder_same) + flash[:errors] = l(:error_target_folder_same) redirect_to :action => :new, :id => @file, :target_project_id => @target_project.id, :target_folder_id => @target_folder return diff --git a/app/controllers/dmsf_folder_permissions_controller.rb b/app/controllers/dmsf_folder_permissions_controller.rb index 8d58d61f..cae91564 100644 --- a/app/controllers/dmsf_folder_permissions_controller.rb +++ b/app/controllers/dmsf_folder_permissions_controller.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -20,7 +20,7 @@ class DmsfFolderPermissionsController < ApplicationController - before_action :find_folder, :only => [:destroy] + before_action :find_folder, only: [:destroy, :new, :autocomplete_for_user] before_action :find_project before_action :authorize before_action :permissions @@ -49,7 +49,10 @@ class DmsfFolderPermissionsController < ApplicationController private def users_for_new_users - Principal.active.visible.member_of(@project).like(params[:q]).order(:type, :lastname).to_a + users = @dmsf_folder.permissions_users + ids = users.collect{ |u| u[0].id } + Principal.active.visible.member_of(@project).like(params[:q]).where(['id NOT IN (?)', ids.join(',')]).order( + :type, :lastname).to_a end def find_project diff --git a/app/controllers/dmsf_folders_copy_controller.rb b/app/controllers/dmsf_folders_copy_controller.rb index acc5f1e4..bca88feb 100644 --- a/app/controllers/dmsf_folders_copy_controller.rb +++ b/app/controllers/dmsf_folders_copy_controller.rb @@ -1,7 +1,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -36,7 +36,7 @@ class DmsfFoldersCopyController < ApplicationController def copy new_folder = @folder.copy_to(@target_project, @target_folder) unless new_folder.errors.empty? - flash[:error] = new_folder.errors.full_messages.join(', ') + flash[:errors] = new_folder.errors.full_messages.join(', ') redirect_to :action => 'new', :id => @folder, :target_project_id => @target_project, :target_folder_id => @target_folder return @@ -52,7 +52,7 @@ class DmsfFoldersCopyController < ApplicationController flash[:notice] = l(:notice_successful_update) redirect_to dmsf_folder_path(:id => @target_project, :folder_id => @folder) else - flash[:error] = @folder.errors.full_messages.join(', ') + flash[:errors] = @folder.errors.full_messages.join(', ') redirect_to :action => 'new', :id => @folder, :target_project_id => @target_project, :target_folder_id => @target_folder end @@ -91,7 +91,7 @@ class DmsfFoldersCopyController < ApplicationController def check_target_folder if (@target_folder && @target_folder == @folder.dmsf_folder) || (@target_folder.nil? && @folder.dmsf_folder.nil? && @target_project == @folder.project) - flash[:error] = l(:error_target_folder_same) + flash[:errors] = l(:error_target_folder_same) redirect_to :action => :new, :id => @folder, :target_project_id => @target_project.id, :target_folder_id => @target_folder return diff --git a/app/controllers/dmsf_links_controller.rb b/app/controllers/dmsf_links_controller.rb index 4e7e4304..256491d3 100644 --- a/app/controllers/dmsf_links_controller.rb +++ b/app/controllers/dmsf_links_controller.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -112,7 +112,9 @@ class DmsfLinksController < ApplicationController if result flash[:notice] = l(:notice_successful_create) else - flash[:error] = @dmsf_link.errors.full_messages.to_sentence + msg = @dmsf_link.errors.full_messages.to_sentence + flash[:errors] = msg + Rails.logger.error msg end else # Link to @@ -121,12 +123,12 @@ class DmsfLinksController < ApplicationController if params[:dmsf_link][:target_project_id].present? @dmsf_link.project_id = params[:dmsf_link][:target_project_id] else - project_id = DmsfFolder.find_by(id: params[:dmsf_link][:target_folder_id]).pluck(:project_id).first - unless project_id + project_ids = DmsfFolder.where(id: params[:dmsf_link][:target_folder_id]).pluck(:project_id) + unless project_ids.any? render_404 return end - @dmsf_link.project_id = project_id + @dmsf_link.project_id = project_ids.first end @dmsf_link.target_project_id = params[:dmsf_link][:project_id] if params[:dmsf_link][:dmsf_file_id].present? @@ -141,7 +143,7 @@ class DmsfLinksController < ApplicationController if result flash[:notice] = l(:notice_successful_create) else - flash[:error] = @dmsf_link.errors.full_messages.to_sentence + flash[:errors] = @dmsf_link.errors.full_messages.to_sentence end end respond_to do |format| @@ -169,7 +171,7 @@ class DmsfLinksController < ApplicationController flash[:notice] = l(:notice_successful_delete) else @dmsf_link.errors.each do |e, msg| - flash[:error] = msg + flash[:errors] = msg end end end diff --git a/app/controllers/dmsf_public_urls_controller.rb b/app/controllers/dmsf_public_urls_controller.rb index 7b76fa2e..e26e1db8 100644 --- a/app/controllers/dmsf_public_urls_controller.rb +++ b/app/controllers/dmsf_public_urls_controller.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/controllers/dmsf_state_controller.rb b/app/controllers/dmsf_state_controller.rb index d5c42cd6..60c7f5b6 100644 --- a/app/controllers/dmsf_state_controller.rb +++ b/app/controllers/dmsf_state_controller.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -27,7 +27,7 @@ class DmsfStateController < ApplicationController before_action :authorize def user_pref_save - member = @project.members.where(user_id: User.current.id).first + member = @project.members.find_by(user_id: User.current.id) if member member.dmsf_mail_notification = params[:email_notify] member.dmsf_title_format = params[:title_format] @@ -35,7 +35,7 @@ class DmsfStateController < ApplicationController if format_valid?(member.dmsf_title_format) && member.save flash[:notice] = l(:notice_your_preferences_were_saved) else - flash[:error] = l(:notice_your_preferences_were_not_saved) + flash[:errors] = l(:notice_your_preferences_were_not_saved) end else flash[:warning] = l(:user_is_not_project_member) @@ -49,7 +49,7 @@ class DmsfStateController < ApplicationController private def format_valid?(format) - format.blank? || ((format =~ /%(t|d|v|i|r)/) && format.length < 256) + format.blank? || ((/%(t|d|v|i|r)/.match?(format)) && format.length < 256) end end \ No newline at end of file diff --git a/app/controllers/dmsf_upload_controller.rb b/app/controllers/dmsf_upload_controller.rb index 5193b6b3..b6403e0e 100644 --- a/app/controllers/dmsf_upload_controller.rb +++ b/app/controllers/dmsf_upload_controller.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -42,17 +42,17 @@ class DmsfUploadController < ApplicationController def upload_files uploaded_files = params[:dmsf_attachments] @uploads = [] - if uploaded_files && uploaded_files.is_a?(Hash) + if uploaded_files # standard file input uploads - uploaded_files.each_value do |uploaded_file| + uploaded_files.each do |_, uploaded_file| upload = DmsfUpload.create_from_uploaded_attachment(@project, @folder, uploaded_file) @uploads.push(upload) if upload end else # plupload multi upload completed uploaded = params[:uploaded] - if uploaded && uploaded.is_a?(Hash) - uploaded.each_value do |uploaded_file| + if uploaded + uploaded.each do |_, uploaded_file| @uploads.push(DmsfUpload.new(@project, @folder, uploaded_file)) end end @@ -113,11 +113,11 @@ class DmsfUploadController < ApplicationController def commit @files = [] attachments = params[:attachments] - if attachments && attachments.is_a?(Hash) + if attachments @folder = DmsfFolder.visible.find_by(id: attachments[:folder_id]) if attachments[:folder_id].present? # standard file input uploads uploaded_files = attachments.select { |key, value| key == 'uploaded_file'} - uploaded_files.each_value do |uploaded_file| + uploaded_files.each do |_, uploaded_file| upload = DmsfUpload.create_from_uploaded_attachment(@project, @folder, uploaded_file) if upload uploaded_file[:disk_filename] = upload.disk_filename diff --git a/app/controllers/dmsf_workflows_controller.rb b/app/controllers/dmsf_workflows_controller.rb index 14456a66..505d1bf8 100644 --- a/app/controllers/dmsf_workflows_controller.rb +++ b/app/controllers/dmsf_workflows_controller.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -73,15 +73,13 @@ class DmsfWorkflowsController < ApplicationController if revision.workflow == DmsfWorkflow::STATE_APPROVED # Just approved recipients = DmsfMailer.get_notify_users(@project, [revision.dmsf_file], true) - recipients.each do |user| - DmsfMailer.workflow_notification( - user, + DmsfMailer.deliver_workflow_notification( + recipients, @dmsf_workflow, revision, :text_email_subject_approved, :text_email_finished_approved, - :text_email_to_see_history).deliver if user - end + :text_email_to_see_history) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] unless recipients.blank? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') @@ -95,16 +93,14 @@ class DmsfWorkflowsController < ApplicationController recipients.push User.find_by(id: revision.dmsf_workflow_assigned_by) recipients.uniq! recipients = recipients & DmsfMailer.get_notify_users(@project, [revision.dmsf_file], true) - recipients.each do |user| - DmsfMailer.workflow_notification( - user, + DmsfMailer.deliver_workflow_notification( + recipients, @dmsf_workflow, revision, :text_email_subject_rejected, :text_email_finished_rejected, :text_email_to_see_history, - action.note).deliver - end + action.note) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] unless recipients.blank? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') @@ -118,14 +114,14 @@ class DmsfWorkflowsController < ApplicationController # Delegation delegate = User.find_by(id: params[:step_action].to_i / 10) if DmsfMailer.get_notify_users(@project, [revision.dmsf_file], true).include?(delegate) - DmsfMailer.workflow_notification( - delegate, + DmsfMailer.deliver_workflow_notification( + [delegate], @dmsf_workflow, revision, :text_email_subject_delegated, :text_email_finished_delegated, :text_email_to_proceed, - action.note).deliver + action.note) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] flash[:warning] = l(:warning_email_notifications, :to => delegate.name) end @@ -138,24 +134,24 @@ class DmsfWorkflowsController < ApplicationController # Next step assignments.each do |assignment| if assignment.user && DmsfMailer.get_notify_users(@project, [revision.dmsf_file], true).include?(assignment.user) - DmsfMailer.workflow_notification( - assignment.user, + DmsfMailer.deliver_workflow_notification( + [assignment.user], @dmsf_workflow, revision, :text_email_subject_requires_approval, :text_email_finished_step, - :text_email_to_proceed).deliver + :text_email_to_proceed) end end to = User.find_by(id: revision.dmsf_workflow_assigned_by) if to && DmsfMailer.get_notify_users(@project, [revision.dmsf_file], true).include?(to) - DmsfMailer.workflow_notification( - to, + DmsfMailer.deliver_workflow_notification( + [to], @dmsf_workflow, revision, :text_email_subject_updated, :text_email_finished_step_short, - :text_email_to_see_status).deliver + :text_email_to_see_status) end if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] recipients = assignments.collect{ |a| a.user } @@ -175,7 +171,7 @@ class DmsfWorkflowsController < ApplicationController end flash[:notice] = l(:notice_successful_update) elsif action.action != DmsfWorkflowStepAction::ACTION_APPROVE && action.note.blank? - flash[:error] = l(:error_empty_note) + flash[:errors] = l(:error_empty_note) end end end @@ -207,12 +203,12 @@ class DmsfWorkflowsController < ApplicationController flash[:notice] = l(:notice_successful_update) end else - flash[:error] = l(:error_workflow_assign) + flash[:errors] = l(:error_workflow_assign) end end end rescue StandardError => e - flash[:error] = e.message + flash[:errors] = e.message end redirect_to :back return @@ -297,7 +293,7 @@ class DmsfWorkflowsController < ApplicationController redirect_to dmsf_workflows_path end else - flash[:error] = @dmsf_workflow.errors.full_messages.to_sentence + flash[:errors] = @dmsf_workflow.errors.full_messages.to_sentence redirect_to dmsf_workflow_path(@dmsf_workflow) end else @@ -310,7 +306,7 @@ class DmsfWorkflowsController < ApplicationController @dmsf_workflow.destroy flash[:notice] = l(:notice_successful_delete) rescue - flash[:error] = l(:error_unable_delete_dmsf_workflow) + flash[:errors] = l(:error_unable_delete_dmsf_workflow) end if @project redirect_to settings_project_path(@project, :tab => 'dmsf_workflow') @@ -343,7 +339,7 @@ class DmsfWorkflowsController < ApplicationController end operator = (params[:commit] == l(:dmsf_and)) ? DmsfWorkflowStep::OPERATOR_AND : DmsfWorkflowStep::OPERATOR_OR user_ids = User.where(id: params[:user_ids]).ids - if user_ids.count > 0 + if user_ids.any? user_ids.each do |user_id| ws = DmsfWorkflowStep.new ws.dmsf_workflow_id = @dmsf_workflow.id @@ -354,11 +350,11 @@ class DmsfWorkflowsController < ApplicationController if ws.save @dmsf_workflow.dmsf_workflow_steps << ws else - flash[:error] = ws.errors.full_messages.to_sentence + flash[:errors] = ws.errors.full_messages.to_sentence end end else - flash[:error] = l(:error_workflow_assign) + flash[:errors] = l(:error_workflow_assign) end end respond_to do |format| @@ -376,7 +372,7 @@ class DmsfWorkflowsController < ApplicationController if n > params[:step].to_i ws.step = n - 1 unless ws.save - flash[:error] = l(:notice_cannot_renumber_steps) + flash[:errors] = l(:notice_cannot_renumber_steps) end end end @@ -387,7 +383,7 @@ class DmsfWorkflowsController < ApplicationController def reorder_steps if request.put? unless @dmsf_workflow.reorder_steps(params[:step].to_i, params[:dmsf_workflow][:position].to_i) - flash[:error] = l(:notice_cannot_renumber_steps) + flash[:errors] = l(:notice_cannot_renumber_steps) end end respond_to do |format| @@ -406,7 +402,7 @@ class DmsfWorkflowsController < ApplicationController @dmsf_workflow.notify_users(@project, revision, self) flash[:notice] = l(:notice_workflow_started) else - flash[:error] = l(:notice_cannot_start_workflow) + flash[:errors] = l(:notice_cannot_start_workflow) end end redirect_to :back @@ -422,11 +418,11 @@ class DmsfWorkflowsController < ApplicationController @dmsf_workflow.dmsf_workflow_steps.where(step: step.step).find_each do |s| s.name = step.name unless s.save - flash[:error] = s.errors.full_messages.to_sentence + flash[:errors] = s.errors.full_messages.to_sentence end end else - flash[:error] = step.errors.full_messages.to_sentence + flash[:errors] = step.errors.full_messages.to_sentence end end # Operators/Assignees @@ -437,7 +433,7 @@ class DmsfWorkflowsController < ApplicationController step.operator = operator.to_i step.user_id = params[:assignee][id] unless step.save - flash[:error] = step.errors.full_messages.to_sentence + flash[:errors] = step.errors.full_messages.to_sentence Rails.logger.error step.errors.full_messages.to_sentence end end diff --git a/app/helpers/dmsf_folder_permissions_helper.rb b/app/helpers/dmsf_folder_permissions_helper.rb index 8ada6ed6..46a3f420 100644 --- a/app/helpers/dmsf_folder_permissions_helper.rb +++ b/app/helpers/dmsf_folder_permissions_helper.rb @@ -1,15 +1,35 @@ +# encoding: utf-8 +# +# Redmine plugin for Document Management System "Features" +# +# Copyright © 2011 Vít Jonáš +# Copyright © 2011-19 Karel Pičman +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + module DmsfFolderPermissionsHelper def users_checkboxes(users) s = '' - if users - users.each do |user| - content = check_box_tag('permissions[user_ids][]', user.id, true, :id => nil) + user.name - s << content_tag(:label, content, :id => "user_permission_ids_#{user.id}", :class => 'inline') - end - end - s.html_safe - end + users.each do |user| + user = [user, false] unless user.is_a?(Array) + content = check_box_tag('permissions[user_ids][]', user[0].id, true, disabled: user[1], id: nil) + user[0].name + s << content_tag(:label, content, id: "user_permission_ids_#{user[0].id}", class: 'inline') + end + s.html_safe + end def render_principals_for_new_folder_permissions(users) principals_check_box_tags 'user_ids[]', users diff --git a/app/helpers/dmsf_helper.rb b/app/helpers/dmsf_helper.rb index 0f7ec4e3..c40cedf4 100644 --- a/app/helpers/dmsf_helper.rb +++ b/app/helpers/dmsf_helper.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -48,11 +48,13 @@ module DmsfHelper # get only the filename, not the whole path just_filename = File.basename(filename.gsub('\\\\', '/')) # replace all non alphanumeric, hyphens or periods with underscore - just_filename = just_filename.gsub(/[^\w\.\-]/,'_') - unless just_filename =~ %r{^[a-zA-Z0-9_\.\-]*$} + just_filename.gsub!(/[^\w\.\-]/, '_') + unless %r{^[a-zA-Z0-9_\.\-]*$}.match?(just_filename) # keep the extension if any - extension = $1 if just_filename =~ %r{(\.[a-zA-Z0-9]+)$} - just_filename = Digest::SHA256.hexdigest(just_filename) << extension + if just_filename =~ %r{(\.[a-zA-Z0-9]+)$} + extension = $1 + just_filename = Digest::SHA256.hexdigest(just_filename) << extension + end end just_filename end @@ -99,7 +101,7 @@ module DmsfHelper allowed = Setting.plugin_redmine_dmsf['dmsf_act_as_attachable'] && (project.dmsf_act_as_attachable == Project::ATTACHABLE_DMS_AND_ATTACHMENTS) && User.current.allowed_to?(:display_system_folders, project) - folders.reject{ |folder| + folders.reject do |folder| if folder.system if allowed issue_id = folder.title.to_i @@ -115,7 +117,7 @@ module DmsfHelper else false end - } + end end def self.all_children_sorted(parent, pos, ident) diff --git a/app/helpers/dmsf_links_helper.rb b/app/helpers/dmsf_links_helper.rb index d4e4a9bf..2942dc17 100644 --- a/app/helpers/dmsf_links_helper.rb +++ b/app/helpers/dmsf_links_helper.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/helpers/dmsf_upload_helper.rb b/app/helpers/dmsf_upload_helper.rb index 4c148a7e..2ee242e6 100644 --- a/app/helpers/dmsf_upload_helper.rb +++ b/app/helpers/dmsf_upload_helper.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -24,9 +24,9 @@ module DmsfUploadHelper def self.commit_files_internal(commited_files, project, folder, controller = nil) failed_uploads = [] files = [] - if commited_files && commited_files.is_a?(Hash) + if commited_files failed_uploads = [] - commited_files.each_value do |commited_file| + commited_files.each do |_, commited_file| name = commited_file[:name] new_revision = DmsfFileRevision.new file = DmsfFile.visible.find_file_by_name(project, folder, name) @@ -82,8 +82,10 @@ module DmsfUploadHelper new_revision.digest = DmsfFileRevision.create_digest commited_file[:tempfile_path] if commited_file[:custom_field_values].present? - commited_file[:custom_field_values].each_with_index do |v, i| - new_revision.custom_field_values[i].value = v[1] + i = 0 + commited_file[:custom_field_values].each do |_, v| + new_revision.custom_field_values[i].value = v + i = i + 1 end end @@ -109,7 +111,7 @@ module DmsfUploadHelper end rescue Exception => e Rails.logger.error e.message - controller.flash[:error] = e.message if controller + controller.flash[:errors] = e.message if controller failed_uploads.push(file) end else @@ -140,10 +142,7 @@ module DmsfUploadHelper # Notifications if (folder && folder.notification?) || (!folder && project.dmsf_notification?) begin - recipients = DmsfMailer.get_notify_users(project, files) - recipients.each do |u| - DmsfMailer.files_updated(u, project, files).deliver - end + recipients = DmsfMailer.deliver_files_updated(project, files) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] unless recipients.empty? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') diff --git a/app/helpers/dmsf_workflows_helper.rb b/app/helpers/dmsf_workflows_helper.rb index 01509f6c..859052bf 100644 --- a/app/helpers/dmsf_workflows_helper.rb +++ b/app/helpers/dmsf_workflows_helper.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -51,7 +51,7 @@ module DmsfWorkflowsHelper options = Array.new options << [l(:dmsf_new_step), 0] steps.each do |step| - options << [step.name.present? ? step.name : step.step.to_s, step.step] + options << [step.name.presence || step.step.to_s, step.step] end options_for_select(options, 0) end diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index 2917abd5..801649dd 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -85,7 +85,7 @@ class DmsfFile < ActiveRecord::Base end end - def initialize + def initialize(*args) @project = nil super end @@ -391,7 +391,7 @@ class DmsfFile < ActiveRecord::Base next if dmsf_attrs.length == 0 || id_attribute == 0 next unless results.select{|f| f.id.to_s == id_attribute}.empty? - dmsf_file = DmsfFile.visible.where(limit_options).where(id: id_attribute).first + dmsf_file = DmsfFile.visible.where(limit_options).find_by(id: id_attribute) if dmsf_file && DmsfFolder.permissions?(dmsf_file.dmsf_folder) if user.allowed_to?(:view_dmsf_files, dmsf_file.project) && @@ -417,7 +417,7 @@ class DmsfFile < ActiveRecord::Base end def display_name - member = Member.where(user_id: User.current.id, project_id: project_id).first + member = Member.find_by(user_id: User.current.id, project_id: project_id) if member && !member.dmsf_title_format.nil? && !member.dmsf_title_format.empty? title_format = member.dmsf_title_format else diff --git a/app/models/dmsf_file_revision.rb b/app/models/dmsf_file_revision.rb index ae914700..cd5c08fb 100644 --- a/app/models/dmsf_file_revision.rb +++ b/app/models/dmsf_file_revision.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -133,7 +133,7 @@ class DmsfFileRevision < ActiveRecord::Base end if Setting.plugin_redmine_dmsf['dmsf_really_delete_files'] dependencies = DmsfFileRevision.where(disk_filename: disk_filename).all.size - File.delete(disk_file) if dependencies <= 1 && File.exist?(disk_file) + FileUtils.rm_f(disk_file) if dependencies <= 1 end super end diff --git a/app/models/dmsf_file_revision_access.rb b/app/models/dmsf_file_revision_access.rb index eca301b8..c3c9240f 100644 --- a/app/models/dmsf_file_revision_access.rb +++ b/app/models/dmsf_file_revision_access.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/models/dmsf_file_revision_custom_field.rb b/app/models/dmsf_file_revision_custom_field.rb index f25f0873..7572ecea 100644 --- a/app/models/dmsf_file_revision_custom_field.rb +++ b/app/models/dmsf_file_revision_custom_field.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/models/dmsf_folder.rb b/app/models/dmsf_folder.rb index bcaec122..016f49de 100644 --- a/app/models/dmsf_folder.rb +++ b/app/models/dmsf_folder.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -51,17 +51,19 @@ class DmsfFolder < ActiveRecord::Base def self.visible_condition(system=true) Project.allowed_to_condition(User.current, :view_dmsf_folders) do |role, user| - permissions = "#{DmsfFolderPermission.table_name}" - folders = "#{DmsfFolder.table_name}" - group_ids = user.group_ids.join(',') - group_ids = -1 if group_ids.blank? - allowed = (system && role.allowed_to?(:display_system_folders)) ? 1 : 0 - %{ - ((#{permissions}.object_id IS NULL) OR - (#{permissions}.object_id = #{role.id} AND #{permissions}.object_type = 'Role') OR - ((#{permissions}.object_id = #{user.id} OR #{permissions}.object_id IN (#{group_ids})) AND #{permissions}.object_type = 'User')) AND - (#{folders}.system = #{DmsfFolder.connection.quoted_false} OR 1 = #{allowed}) - } + if role.member? + permissions = "#{DmsfFolderPermission.table_name}" + folders = "#{DmsfFolder.table_name}" + group_ids = user.group_ids.join(',') + group_ids = -1 if group_ids.blank? + allowed = (system && role.allowed_to?(:display_system_folders)) ? 1 : 0 + %{ + ((#{permissions}.object_id IS NULL) OR + (#{permissions}.object_id = #{role.id} AND #{permissions}.object_type = 'Role') OR + ((#{permissions}.object_id = #{user.id} OR #{permissions}.object_id IN (#{group_ids})) AND #{permissions}.object_type = 'User')) AND + (#{folders}.system = #{DmsfFolder.connection.quoted_false} OR 1 = #{allowed}) + } + end end end @@ -73,7 +75,7 @@ class DmsfFolder < ActiveRecord::Base "LEFT JOIN #{DmsfFolderPermission.table_name} ON #{DmsfFolder.table_name}.id = #{DmsfFolderPermission.table_name}.dmsf_folder_id").where( deleted: STATUS_DELETED).where(DmsfFolder.visible_condition).distinct } - scope :system, -> { where(system: true) } + scope :issystem, -> { where(system: true) } scope :notsystem, -> { where(system: false) } acts_as_customizable @@ -130,9 +132,9 @@ class DmsfFolder < ActiveRecord::Base def self.find_by_title(project, folder, title) if folder - visible.where(project_id: project.id, dmsf_folder_id: nil, title: title).first + visible.find_by(project_id: project.id, dmsf_folder_id: nil, title: title) else - visible.where(project_id: project.id, dmsf_folder_id: folder.id, title: title).first + visible.find_by(project_id: project.id, dmsf_folder_id: folder.id, title: title) end end @@ -506,8 +508,10 @@ class DmsfFolder < ActiveRecord::Base self.dmsf_folder_id = params[:parent_id] # Custom fields if params[:dmsf_folder][:custom_field_values].present? - params[:dmsf_folder][:custom_field_values].each_with_index do |v, i| - custom_field_values[i].value = v[1] + i = 0 + params[:dmsf_folder][:custom_field_values].each do |param| + custom_field_values[i].value = param[1] + i += 1 end end # Permissions @@ -541,8 +545,43 @@ class DmsfFolder < ActiveRecord::Base title.gsub(/[#{INVALID_CHARACTERS}]/, '.').gsub(/\.{2,}/, '.').chomp('.') end + def permission_for_role(role) + options = Hash.new + options[:checked] = false + options[:disabled] = false + permission_for_role_recursive(self, role, options) + options[:disabled] = false unless options[:checked] + options.values + end + + def permissions_users + users = Array.new + permissions_users_recursive(self, users, false) + users + end + private + def permission_for_role_recursive(folder, role, options) + options[:checked] = folder.dmsf_folder_permissions.roles.exists?(object_id: role.id) + if !options[:checked] && folder.dmsf_folder && !folder.dmsf_folder.deleted? + options[:disabled] = true + # TODO: No inheritance + #permission_for_role_recursive(folder.dmsf_folder, role, options) + end + end + + def permissions_users_recursive(folder, users, disabled) + if folder + usrs = Principal.active.where(id: folder.dmsf_folder_permissions.users.map{ |p| p.object_id }) + usrs.each do |u| + users << [u, disabled] + end + # TODO: No inheritance + #permissions_users_recursive(folder.dmsf_folder, users, true) + end + end + def self.directory_subtree(tree, folder, level, current_folder) folders = DmsfFolder.where(project_id: folder.project_id, dmsf_folder_id: folder.id).notsystem.visible(false).to_a folders.delete(current_folder) diff --git a/app/models/dmsf_folder_permission.rb b/app/models/dmsf_folder_permission.rb index 84475d75..be29d43b 100644 --- a/app/models/dmsf_folder_permission.rb +++ b/app/models/dmsf_folder_permission.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/models/dmsf_link.rb b/app/models/dmsf_link.rb index 3e4331df..80b24b51 100644 --- a/app/models/dmsf_link.rb +++ b/app/models/dmsf_link.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -28,7 +28,9 @@ class DmsfLink < ActiveRecord::Base belongs_to :user validates :name, presence: true, length: { maximum: 255 } - validates :project, presence: true + # There can be project_id = -1 when attaching links to an issue. The project_id is assigned later when saving the + # issue. + #validates :project, presence: true validates :external_url, length: { maximum: 255 } validates :external_url, dmsf_url: true @@ -196,4 +198,4 @@ class DmsfLink < ActiveRecord::Base csv end -end \ No newline at end of file +end diff --git a/app/models/dmsf_lock.rb b/app/models/dmsf_lock.rb index 04c29cb7..386bb4d5 100644 --- a/app/models/dmsf_lock.rb +++ b/app/models/dmsf_lock.rb @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/models/dmsf_mailer.rb b/app/models/dmsf_mailer.rb index eee3ebdc..cf2cda02 100644 --- a/app/models/dmsf_mailer.rb +++ b/app/models/dmsf_mailer.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -24,33 +24,52 @@ require 'mailer' class DmsfMailer < Mailer layout 'mailer' + def self.deliver_files_updated(project, files) + files = files.select { |file| file.notify? } + users = get_notify_users(project, files) + users.each do |user| + files_updated(user, project, files).deliver_later + end + users + end + def files_updated(user, project, files) - if user && project && files.count > 0 - files = files.select { |file| file.notify? } + if user && project && files.size > 0 redmine_headers 'Project' => project.identifier if project @files = files @project = project message_id project set_language_if_valid user.language - mail :to => user.mail, - :subject => "[#{@project.name} - #{l(:menu_dmsf)}] #{l(:text_email_doc_updated_subject)}" + mail :to => user.mail, subject: "[#{@project.name} - #{l(:menu_dmsf)}] #{l(:text_email_doc_updated_subject)}" end end + def self.deliver_files_deleted(project, files) + files = files.select { |file| file.notify? } + users = get_notify_users(project, files) + users.each do |user| + files_deleted(user, project, files).deliver_later + end + users + end + def files_deleted(user, project, files) - if user && files.count > 0 - files = files.select { |file| file.notify? } + if user && files.any? redmine_headers 'Project' => project.identifier if project @files = files @project = project message_id project set_language_if_valid user.language mail :to => user.mail, - :subject => "[#{@project.name} - #{l(:menu_dmsf)}] #{l(:text_email_doc_deleted_subject)}" + :subject => "[#{@project.name} - #{l(:menu_dmsf)}] #{l(:text_email_doc_deleted_subject)}" end end - def send_documents(project, email_params) + def self.deliver_send_documents(project, email_params) + send_documents(User.current, project, email_params).deliver_later + end + + def send_documents(_, project, email_params) redmine_headers 'Project' => project.identifier if project @body = email_params[:body] @links_only = email_params[:links_only] == '1' @@ -63,8 +82,14 @@ class DmsfMailer < Mailer zipped_content_data = open(email_params[:zipped_content], 'rb') { |io| io.read } attachments['Documents.zip'] = { :content_type => 'application/zip', :content => zipped_content_data } end - mail :to => email_params[:to], :cc => email_params[:cc], - :subject => email_params[:subject], 'From' => email_params[:from], 'Reply-To' => email_params[:reply_to] + mail to: email_params[:to], cc: email_params[:cc], subject: email_params[:subject], 'From' => email_params[:from], + 'Reply-To' => email_params[:reply_to] + end + + def self.deliver_workflow_notification(users, workflow, revision, subject_id, text1_id, text2_id, notice = nil) + users.each do |user| + workflow_notification(user, workflow, revision, subject_id.to_s, text1_id.to_s, text2_id.to_s, notice).deliver_now + end end def workflow_notification(user, workflow, revision, subject_id, text1_id, text2_id, notice = nil) @@ -82,7 +107,7 @@ class DmsfMailer < Mailer @text2 = l(text2_id) @notice = notice mail :to => user.mail, - :subject => "[#{@project.name} - #{l(:field_label_dmsf_workflow)}] #{@workflow.name} #{l(subject_id)}" + :subject => "[#{@project.name} - #{l(:field_label_dmsf_workflow)}] #{@workflow.name} #{l(subject_id)}" end end diff --git a/app/models/dmsf_public_url.rb b/app/models/dmsf_public_url.rb index dd12562f..6a1b39c4 100644 --- a/app/models/dmsf_public_url.rb +++ b/app/models/dmsf_public_url.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/models/dmsf_upload.rb b/app/models/dmsf_upload.rb index 5fe6a233..5fcdbdec 100644 --- a/app/models/dmsf_upload.rb +++ b/app/models/dmsf_upload.rb @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/models/dmsf_workflow.rb b/app/models/dmsf_workflow.rb index 8195ea7a..22bf02d2 100644 --- a/app/models/dmsf_workflow.rb +++ b/app/models/dmsf_workflow.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -195,15 +195,13 @@ class DmsfWorkflow < ActiveRecord::Base recipients = assignments.collect{ |a| a.user } recipients.uniq! recipients = recipients & DmsfMailer.get_notify_users(project, [revision.dmsf_file], true) - recipients.each do |user| - DmsfMailer.workflow_notification( - user, + DmsfMailer.deliver_workflow_notification( + recipients, self, revision, :text_email_subject_started, :text_email_started, - :text_email_to_proceed).deliver - end + :text_email_to_proceed) if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] unless recipients.blank? to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') diff --git a/app/models/dmsf_workflow_step.rb b/app/models/dmsf_workflow_step.rb index 86ebf8a1..621f204a 100644 --- a/app/models/dmsf_workflow_step.rb +++ b/app/models/dmsf_workflow_step.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/models/dmsf_workflow_step_action.rb b/app/models/dmsf_workflow_step_action.rb index ca2d7e7d..3d5787fd 100644 --- a/app/models/dmsf_workflow_step_action.rb +++ b/app/models/dmsf_workflow_step_action.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/models/dmsf_workflow_step_assignment.rb b/app/models/dmsf_workflow_step_assignment.rb index 340725b5..e8971a47 100644 --- a/app/models/dmsf_workflow_step_assignment.rb +++ b/app/models/dmsf_workflow_step_assignment.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/models/easy_page_modules/easy_dms/epm_dmsf_locked_documents.rb b/app/models/easy_page_modules/easy_dms/epm_dmsf_locked_documents.rb index 4390af5f..180ed7c4 100644 --- a/app/models/easy_page_modules/easy_dms/epm_dmsf_locked_documents.rb +++ b/app/models/easy_page_modules/easy_dms/epm_dmsf_locked_documents.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,22 +18,26 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class EpmDmsfLockedDocuments < EasyPageModule +if defined?(EasyExtensions) - def category_name - @category_name ||= 'easy_dms' - end + class EpmDmsfLockedDocuments < EasyPageModule - def get_show_data(settings, user, page_context = {}) - {} - end + def category_name + @category_name ||= 'easy_dms' + end - def get_edit_data(settings, user, page_context = {}) - {} - end + def get_show_data(settings, user, page_context = {}) + {} + end + + def get_edit_data(settings, user, page_context = {}) + {} + end + + def registered_in_plugin + 'redmine_dmsf' + end - def registered_in_plugin - 'redmine_dmsf' end end \ No newline at end of file diff --git a/app/models/easy_page_modules/easy_dms/epm_dmsf_open_approvals.rb b/app/models/easy_page_modules/easy_dms/epm_dmsf_open_approvals.rb index abaf2715..425618a6 100644 --- a/app/models/easy_page_modules/easy_dms/epm_dmsf_open_approvals.rb +++ b/app/models/easy_page_modules/easy_dms/epm_dmsf_open_approvals.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,18 +18,22 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class EpmDmsfOpenApprovals < EasyPageModule +if defined?(EasyExtensions) - def category_name - @category_name ||= 'easy_dms' - end + class EpmDmsfOpenApprovals < EasyPageModule - def get_show_data(settings, user, page_context = {}) - {} - end + def category_name + @category_name ||= 'easy_dms' + end + + def get_show_data(settings, user, page_context = {}) + {} + end + + def registered_in_plugin + 'redmine_dmsf' + end - def registered_in_plugin - 'redmine_dmsf' end end \ No newline at end of file diff --git a/app/validators/dmsf_file_name_validator.rb b/app/validators/dmsf_file_name_validator.rb index 5996dbc7..697d0f09 100644 --- a/app/validators/dmsf_file_name_validator.rb +++ b/app/validators/dmsf_file_name_validator.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -22,7 +22,7 @@ class DmsfFileNameValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) - unless value =~ /\A[^#{DmsfFolder::INVALID_CHARACTERS}]*\z/ + unless /\A[^#{DmsfFolder::INVALID_CHARACTERS}]*\z/.match?(value) record.errors.add attribute, :error_contains_invalid_character end end diff --git a/app/validators/dmsf_url_validator.rb b/app/validators/dmsf_url_validator.rb index c1494cb2..c29f1f9c 100644 --- a/app/validators/dmsf_url_validator.rb +++ b/app/validators/dmsf_url_validator.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -25,12 +25,14 @@ class DmsfUrlValidator < ActiveModel::EachValidator if record.target_type == 'DmsfUrl' begin if value.present? - URI.parse value + # https://www.google.com/search?q=寿司 + URI.parse value.split('?').first else record.errors.add attribute, :invalid end - rescue URI::InvalidURIError + rescue URI::InvalidURIError => e record.errors.add attribute, :invalid + Rails.logger.error e.message end end end diff --git a/app/validators/dmsf_workflow_name_validator.rb b/app/validators/dmsf_workflow_name_validator.rb index 7f0cf40c..f563a173 100644 --- a/app/validators/dmsf_workflow_name_validator.rb +++ b/app/validators/dmsf_workflow_name_validator.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf/_add_email.html.erb b/app/views/dmsf/_add_email.html.erb index 1f28a32f..af372982 100644 --- a/app/views/dmsf/_add_email.html.erb +++ b/app/views/dmsf/_add_email.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf/_custom_fields.html.erb b/app/views/dmsf/_custom_fields.html.erb index becebba1..27362a39 100644 --- a/app/views/dmsf/_custom_fields.html.erb +++ b/app/views/dmsf/_custom_fields.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf/_dir.html.erb b/app/views/dmsf/_dir.html.erb index d554b53a..5085a21f 100644 --- a/app/views/dmsf/_dir.html.erb +++ b/app/views/dmsf/_dir.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf/_dir_trash.html.erb b/app/views/dmsf/_dir_trash.html.erb index 9e49423a..add594ef 100644 --- a/app/views/dmsf/_dir_trash.html.erb +++ b/app/views/dmsf/_dir_trash.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf/_dmsf_rows.erb b/app/views/dmsf/_dmsf_rows.erb index 45540ab1..9bdd2ca8 100644 --- a/app/views/dmsf/_dmsf_rows.erb +++ b/app/views/dmsf/_dmsf_rows.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -23,7 +23,7 @@ <% parent = @folder ? @folder : @project %> <% DmsfHelper.all_children_sorted(parent, @pos, @idnt).each do |obj, position| %> <% classes = "dmsf_tree idnt-#{@idnt} hascontextmenu" %> - <% if obj.is_a?(DmsfFolder) && ((obj.dmsf_folders.visible.count > 0) || (obj.dmsf_files.visible.count > 0) || (obj.dmsf_links.visible.count > 0)) %> + <% if obj.is_a?(DmsfFolder) && ((obj.dmsf_folders.visible.any?) || (obj.dmsf_files.visible.any?) || (obj.dmsf_links.visible.any?)) %> <% classes += ' idnt dmsf_collapsed dmsf-not-loaded' %> <% id = "id='#{obj.id}span'".html_safe %> <% onclick = "onclick=\"dmsfToggle('#{obj.id}','#{obj.id}span','#{escape_javascript(expand_folder_dmsf_path)}')\"" %> diff --git a/app/views/dmsf/_file.html.erb b/app/views/dmsf/_file.html.erb index 72d0c4fc..680e58e0 100644 --- a/app/views/dmsf/_file.html.erb +++ b/app/views/dmsf/_file.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf/_file_trash.html.erb b/app/views/dmsf/_file_trash.html.erb index 0f120fe7..7159093b 100644 --- a/app/views/dmsf/_file_trash.html.erb +++ b/app/views/dmsf/_file_trash.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf/_list_view.erb b/app/views/dmsf/_list_view.erb index b0599fd9..aca56fea 100644 --- a/app/views/dmsf/_list_view.erb +++ b/app/views/dmsf/_list_view.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf/_path.html.erb b/app/views/dmsf/_path.html.erb index 53420dd9..1815f8d4 100644 --- a/app/views/dmsf/_path.html.erb +++ b/app/views/dmsf/_path.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf/_tree_view.erb b/app/views/dmsf/_tree_view.erb index 19740b08..70e342e2 100644 --- a/app/views/dmsf/_tree_view.erb +++ b/app/views/dmsf/_tree_view.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf/_url.html.erb b/app/views/dmsf/_url.html.erb index 5b9a7a98..263b15b8 100644 --- a/app/views/dmsf/_url.html.erb +++ b/app/views/dmsf/_url.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -34,7 +34,11 @@ :target => '_blank', :class => 'icon icon-link') %>
- <%= link.external_url %> + <% if link.external_url && link.external_url.length > 50 %> + <%= "#{link.external_url[0, 25]}...#{link.external_url[-25, 25]}" %> + <% else %> + <%= link.external_url %> + <% end %>
<%= ''.html_safe if @tree_view %> diff --git a/app/views/dmsf/_url_trash.html.erb b/app/views/dmsf/_url_trash.html.erb index 1fe04cf8..0cace384 100644 --- a/app/views/dmsf/_url_trash.html.erb +++ b/app/views/dmsf/_url_trash.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -30,7 +30,13 @@ link.external_url, :target => '_blank', :class => 'icon icon-link') %> -
<%= link.external_url %>
+
+ <% if link.external_url && link.external_url.length > 50 %> + <%= "#{link.external_url[0, 25]}...#{link.external_url[-25, 25]}" %> + <% else %> + <%= link.external_url %> + <% end %> +
<% end %> <% if DmsfFolder.is_column_on?('extension') %> diff --git a/app/views/dmsf/add_email.js.erb b/app/views/dmsf/add_email.js.erb index 93e05385..9ebf731e 100644 --- a/app/views/dmsf/add_email.js.erb +++ b/app/views/dmsf/add_email.js.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf/append_email.js.erb b/app/views/dmsf/append_email.js.erb index 2455cc56..d2d50d7e 100644 --- a/app/views/dmsf/append_email.js.erb +++ b/app/views/dmsf/append_email.js.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf/autocomplete_for_user.js.erb b/app/views/dmsf/autocomplete_for_user.js.erb index 68433729..57277d95 100644 --- a/app/views/dmsf/autocomplete_for_user.js.erb +++ b/app/views/dmsf/autocomplete_for_user.js.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf/edit.html.erb b/app/views/dmsf/edit.html.erb index 023b8e58..519a4fb7 100644 --- a/app/views/dmsf/edit.html.erb +++ b/app/views/dmsf/edit.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -77,12 +77,16 @@

<%= label_tag '', l(:label_permissions) %> <% User.current.managed_roles(@project).each do |role| %> - <% checked = @folder.dmsf_folder_permissions.roles.exists?(object_id: role.id) %> - + <% checked, disabled = @folder.permission_for_role(role) %> + <% end %>
- <% checkboxes = users_checkboxes(@users) %> + <% users = @folder.permissions_users %> + <% checkboxes = users_checkboxes(users) %> <%= checkboxes %>
<% if checkboxes.present? %> diff --git a/app/views/dmsf/edit_root.html.erb b/app/views/dmsf/edit_root.html.erb index 69c8bb5b..eba46647 100644 --- a/app/views/dmsf/edit_root.html.erb +++ b/app/views/dmsf/edit_root.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf/email_entries.html.erb b/app/views/dmsf/email_entries.html.erb index 7b4a85b1..a98e1e57 100644 --- a/app/views/dmsf/email_entries.html.erb +++ b/app/views/dmsf/email_entries.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf/show.html.erb b/app/views/dmsf/show.html.erb index 9c10ea1f..993fd5a2 100644 --- a/app/views/dmsf/show.html.erb +++ b/app/views/dmsf/show.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -68,8 +68,13 @@ :title => l(:link_create_folder), :class => 'icon icon-add') unless @locked_for_user %> <% end %> - <%= link_to_if(@trash_enabled, l(:link_trash_bin), trash_dmsf_path(@project), - :title => l(:link_trash_bin), :class => 'icon icon-del') if @trash_visible %> + <% if @trash_enabled %> + <%= link_to l(:link_trash_bin), trash_dmsf_path(@project), title: l(:link_trash_bin), class: 'icon icon-del' %> + <% else %> + + <%= l(:link_trash_bin) %> + + <% end %> <%= render(:partial => 'path', diff --git a/app/views/dmsf/trash.html.erb b/app/views/dmsf/trash.html.erb index 84f2ffac..ce840392 100644 --- a/app/views/dmsf/trash.html.erb +++ b/app/views/dmsf/trash.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_context_menus/dmsf.html.erb b/app/views/dmsf_context_menus/dmsf.html.erb index 220a04f9..f22599f5 100644 --- a/app/views/dmsf_context_menus/dmsf.html.erb +++ b/app/views/dmsf_context_menus/dmsf.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -23,17 +23,17 @@

  • <%= context_menu_link l(:button_download), entries_operations_dmsf_path(:id => @project, :folder_id => @folder, - :ids => params[:ids], :download_entries => true), :method => :post, :class => 'icon-download', + :ids => params[:ids], :download_entries => true), :method => :post, :class => 'icon icon-download', :id => 'dmsf-cm-download', :disabled => @disabled %>
  • <%= context_menu_link l(:field_mail), entries_operations_dmsf_path(:id => @project, :folder_id => @folder, - :ids => params[:ids], :email_entries => true), :method => :post, :class => 'icon-email', + :ids => params[:ids], :email_entries => true), :method => :post, :class => 'icon icon-email', :disabled => @disabled %>
  • <%= context_menu_link l(:button_delete), entries_operations_dmsf_path(:id => @project, :folder_id => @folder, - :ids => params[:ids], :delete_entries => true), :method => :post, :class => 'icon-del', + :ids => params[:ids], :delete_entries => true), :method => :post, :class => 'icon icon-del', :data => { :confirm => l(:text_are_you_sure) }, :id => 'dmsf-cm-delete', :disabled => @disabled %>
  • <% if @file %> @@ -45,7 +45,7 @@ <% end %> <% url << @file.name %> <% end %> - <%= context_menu_link l(:button_edit), url, :class => 'icon-edit', :disabled => url.blank? %> + <%= context_menu_link l(:button_edit), url, :class => 'icon icon-edit', :disabled => url.blank? %> <% end %>
diff --git a/app/views/dmsf_context_menus/trash.html.erb b/app/views/dmsf_context_menus/trash.html.erb index 44f01e91..858c6cca 100644 --- a/app/views/dmsf_context_menus/trash.html.erb +++ b/app/views/dmsf_context_menus/trash.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_files/_file_new_revision.html.erb b/app/views/dmsf_files/_file_new_revision.html.erb index f264e787..640094e5 100644 --- a/app/views/dmsf_files/_file_new_revision.html.erb +++ b/app/views/dmsf_files/_file_new_revision.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_files/_link.html.erb b/app/views/dmsf_files/_link.html.erb index c0472ce8..f70582c5 100644 --- a/app/views/dmsf_files/_link.html.erb +++ b/app/views/dmsf_files/_link.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_files/_links.html.erb b/app/views/dmsf_files/_links.html.erb index 14ef34a2..48ce2830 100644 --- a/app/views/dmsf_files/_links.html.erb +++ b/app/views/dmsf_files/_links.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_files/_revision_access.html.erb b/app/views/dmsf_files/_revision_access.html.erb index f4a34961..446d4012 100644 --- a/app/views/dmsf_files/_revision_access.html.erb +++ b/app/views/dmsf_files/_revision_access.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_files/_thumbnails.html.erb b/app/views/dmsf_files/_thumbnails.html.erb index 4840bb56..9d7fe997 100644 --- a/app/views/dmsf_files/_thumbnails.html.erb +++ b/app/views/dmsf_files/_thumbnails.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_files/show.api.rsb b/app/views/dmsf_files/show.api.rsb index 7a5f5407..86e77053 100644 --- a/app/views/dmsf_files/show.api.rsb +++ b/app/views/dmsf_files/show.api.rsb @@ -4,12 +4,32 @@ api.dmsf_file do api.name @file.name api.project_id @file.project_id api.dmsf_folder_id @file.dmsf_folder_id if @file.dmsf_folder_id - if @file.last_revision - api.version "#{@file.last_revision.version}" - api.mime_type @file.last_revision.mime_type - api.digest @file.last_revision.digest - api.size @file.last_revision.size - api.description @file.last_revision.description - end api.content_url download_dmsf_file_url(@file) -end \ No newline at end of file + api.array :dmsf_file_revisions do + @file.dmsf_file_revisions.each do |r| + api.dmsf_file_revision do + api.id r.id + api.source_dmsf_file_revision_id r.source_dmsf_file_revision_id + api.name r.name + api.dmsf_string "{{dmsf(#{@file.id},#{@file.name},#{r.id})}}" + api.content_url view_dmsf_file_url(@file, download: r) + api.size r.size + api.mime_type r.mime_type + api.title r.title + api.description r.description + api.workflow r.workflow + api.version "#{r.major_version}.#{r.minor_version}" + api.comment r.comment + api.user_id r.user_id + api.created_at r.created_at + api.updated_at r.updated_at + api.dmsf_workflow_id r.dmsf_workflow_id + api.dmsf_workflow_assigned_by r.dmsf_workflow_assigned_by + api.dmsf_workflow_assigned_at r.dmsf_workflow_assigned_at + api.dmsf_workflow_started_by r.dmsf_workflow_started_by + api.dmsf_workflow_started_at r.dmsf_workflow_started_at + api.digest r.digest + end + end + end +end diff --git a/app/views/dmsf_files/show.html.erb b/app/views/dmsf_files/show.html.erb index ccfc3d19..e2ee93cd 100644 --- a/app/views/dmsf_files/show.html.erb +++ b/app/views/dmsf_files/show.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_files_copy/new.html.erb b/app/views/dmsf_files_copy/new.html.erb index c96c1da9..e3e3ccc2 100644 --- a/app/views/dmsf_files_copy/new.html.erb +++ b/app/views/dmsf_files_copy/new.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_folder_permissions/_new.html.erb b/app/views/dmsf_folder_permissions/_new.html.erb index dc639fc7..c6f4099b 100644 --- a/app/views/dmsf_folder_permissions/_new.html.erb +++ b/app/views/dmsf_folder_permissions/_new.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -22,22 +22,20 @@

<%= l(:label_user_search) %>

-<%= form_tag(append_dmsf_folder_permissions_path, - :remote => true, - :method => :post, - :id => 'new-user-form') do %> +<%= form_tag(append_dmsf_folder_permissions_path, remote: true, method: :post, id: 'new-user-form') do %> <%= hidden_field_tag :project_id, @project.id %>

<%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %>

<%= late_javascript_tag "observeSearchfield('user_search', 'users_for_users', '#{ escape_javascript url_for( - :controller => 'dmsf_folder_permissions', :action => 'autocomplete_for_user', :project_id => @project) }')" %> + controller: 'dmsf_folder_permissions', action: 'autocomplete_for_user', project_id: @project, + dmsf_folder_id: @dmsf_folder) }')" %>
<%= render_principals_for_new_folder_permissions(@principals) %>

- <%= submit_tag l(:button_add), :name => nil, :onclick => "hideModal(this);" %> - <%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %> + <%= submit_tag l(:button_add), name: nil, onclick: 'hideModal(this);' %> + <%= submit_tag l(:button_cancel), name: nil, onclick: 'hideModal(this);', type: 'button' %>

<% end %> diff --git a/app/views/dmsf_folder_permissions/append.js.erb b/app/views/dmsf_folder_permissions/append.js.erb index 4d9255d2..8b11fd1a 100644 --- a/app/views/dmsf_folder_permissions/append.js.erb +++ b/app/views/dmsf_folder_permissions/append.js.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_folder_permissions/autocomplete_for_user.js.erb b/app/views/dmsf_folder_permissions/autocomplete_for_user.js.erb index a43d2d5a..c4976f17 100644 --- a/app/views/dmsf_folder_permissions/autocomplete_for_user.js.erb +++ b/app/views/dmsf_folder_permissions/autocomplete_for_user.js.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_folder_permissions/new.js.erb b/app/views/dmsf_folder_permissions/new.js.erb index 5c302c70..68de6c5b 100644 --- a/app/views/dmsf_folder_permissions/new.js.erb +++ b/app/views/dmsf_folder_permissions/new.js.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_folders_copy/_form.html.erb b/app/views/dmsf_folders_copy/_form.html.erb index 806782c4..74690914 100644 --- a/app/views/dmsf_folders_copy/_form.html.erb +++ b/app/views/dmsf_folders_copy/_form.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_folders_copy/new.html.erb b/app/views/dmsf_folders_copy/new.html.erb index fbd58fd2..3dbb7808 100644 --- a/app/views/dmsf_folders_copy/new.html.erb +++ b/app/views/dmsf_folders_copy/new.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_links/_form.html.erb b/app/views/dmsf_links/_form.html.erb index 3d281f8d..a48019d5 100644 --- a/app/views/dmsf_links/_form.html.erb +++ b/app/views/dmsf_links/_form.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_links/autocomplete_for_project.js.erb b/app/views/dmsf_links/autocomplete_for_project.js.erb index 2e527478..2c30f206 100644 --- a/app/views/dmsf_links/autocomplete_for_project.js.erb +++ b/app/views/dmsf_links/autocomplete_for_project.js.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_links/create.js.erb b/app/views/dmsf_links/create.js.erb index dc87fb4f..0bf3ad15 100644 --- a/app/views/dmsf_links/create.js.erb +++ b/app/views/dmsf_links/create.js.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_links/new.html.erb b/app/views/dmsf_links/new.html.erb index cfbb9a58..aa909f0a 100644 --- a/app/views/dmsf_links/new.html.erb +++ b/app/views/dmsf_links/new.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_links/new.js.erb b/app/views/dmsf_links/new.js.erb index b062fe5c..fcdaaf65 100644 --- a/app/views/dmsf_links/new.js.erb +++ b/app/views/dmsf_links/new.js.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_mailer/files_deleted.html.erb b/app/views/dmsf_mailer/files_deleted.html.erb index 65e3fc53..dd2d3bef 100644 --- a/app/views/dmsf_mailer/files_deleted.html.erb +++ b/app/views/dmsf_mailer/files_deleted.html.erb @@ -2,7 +2,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_mailer/files_deleted.text.erb b/app/views/dmsf_mailer/files_deleted.text.erb index 456ad891..fe62eee3 100644 --- a/app/views/dmsf_mailer/files_deleted.text.erb +++ b/app/views/dmsf_mailer/files_deleted.text.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_mailer/files_updated.html.erb b/app/views/dmsf_mailer/files_updated.html.erb index 83337e92..33f82505 100644 --- a/app/views/dmsf_mailer/files_updated.html.erb +++ b/app/views/dmsf_mailer/files_updated.html.erb @@ -2,7 +2,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_mailer/send_documents.html.erb b/app/views/dmsf_mailer/send_documents.html.erb index 83c380cc..054ebb33 100644 --- a/app/views/dmsf_mailer/send_documents.html.erb +++ b/app/views/dmsf_mailer/send_documents.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_mailer/send_documents.text.erb b/app/views/dmsf_mailer/send_documents.text.erb index 89ee5cc8..1cc6935a 100644 --- a/app/views/dmsf_mailer/send_documents.text.erb +++ b/app/views/dmsf_mailer/send_documents.text.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_mailer/workflow_notification.html.erb b/app/views/dmsf_mailer/workflow_notification.html.erb index baea1ee3..0980c394 100644 --- a/app/views/dmsf_mailer/workflow_notification.html.erb +++ b/app/views/dmsf_mailer/workflow_notification.html.erb @@ -1,6 +1,6 @@ <%# Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_mailer/workflow_notification.text.erb b/app/views/dmsf_mailer/workflow_notification.text.erb index a4500d07..60891fac 100644 --- a/app/views/dmsf_mailer/workflow_notification.text.erb +++ b/app/views/dmsf_mailer/workflow_notification.text.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_public_urls/_new.html.erb b/app/views/dmsf_public_urls/_new.html.erb index 9485b632..d0b6b769 100644 --- a/app/views/dmsf_public_urls/_new.html.erb +++ b/app/views/dmsf_public_urls/_new.html.erb @@ -4,7 +4,7 @@ # Redmine plugin for Document Management System "Features" # # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_state/_user_pref.html.erb b/app/views/dmsf_state/_user_pref.html.erb index 6955f48f..75910580 100644 --- a/app/views/dmsf_state/_user_pref.html.erb +++ b/app/views/dmsf_state/_user_pref.html.erb @@ -2,7 +2,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_upload/_form.html.erb b/app/views/dmsf_upload/_form.html.erb index 1ec76a2f..bac951f9 100644 --- a/app/views/dmsf_upload/_form.html.erb +++ b/app/views/dmsf_upload/_form.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_upload/_multi_upload.html.erb b/app/views/dmsf_upload/_multi_upload.html.erb index 2833425d..30212712 100644 --- a/app/views/dmsf_upload/_multi_upload.html.erb +++ b/app/views/dmsf_upload/_multi_upload.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_upload/_upload_file.html.erb b/app/views/dmsf_upload/_upload_file.html.erb index 1e84d206..68b692f1 100644 --- a/app/views/dmsf_upload/_upload_file.html.erb +++ b/app/views/dmsf_upload/_upload_file.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_upload/_upload_file_locked.html.erb b/app/views/dmsf_upload/_upload_file_locked.html.erb index 54fc433a..84b4bad2 100644 --- a/app/views/dmsf_upload/_upload_file_locked.html.erb +++ b/app/views/dmsf_upload/_upload_file_locked.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_upload/upload.js.erb b/app/views/dmsf_upload/upload.js.erb index ce8002e6..8a18e5aa 100644 --- a/app/views/dmsf_upload/upload.js.erb +++ b/app/views/dmsf_upload/upload.js.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_upload/upload_file.html.erb b/app/views/dmsf_upload/upload_file.html.erb index d33aa842..fcddd741 100644 --- a/app/views/dmsf_upload/upload_file.html.erb +++ b/app/views/dmsf_upload/upload_file.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_upload/upload_files.html.erb b/app/views/dmsf_upload/upload_files.html.erb index e52f4e7e..1430747e 100644 --- a/app/views/dmsf_upload/upload_files.html.erb +++ b/app/views/dmsf_upload/upload_files.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/_action.html.erb b/app/views/dmsf_workflows/_action.html.erb index 9129f3fa..b2448b93 100644 --- a/app/views/dmsf_workflows/_action.html.erb +++ b/app/views/dmsf_workflows/_action.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/_approval_workflow_button.html.erb b/app/views/dmsf_workflows/_approval_workflow_button.html.erb index e886465e..b8a05756 100644 --- a/app/views/dmsf_workflows/_approval_workflow_button.html.erb +++ b/app/views/dmsf_workflows/_approval_workflow_button.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/_assign.html.erb b/app/views/dmsf_workflows/_assign.html.erb index 4216cb1f..dd4bb727 100644 --- a/app/views/dmsf_workflows/_assign.html.erb +++ b/app/views/dmsf_workflows/_assign.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/_log.html.erb b/app/views/dmsf_workflows/_log.html.erb index 6c292a12..096cefbb 100644 --- a/app/views/dmsf_workflows/_log.html.erb +++ b/app/views/dmsf_workflows/_log.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/_main.html.erb b/app/views/dmsf_workflows/_main.html.erb index 640228af..bfd50631 100644 --- a/app/views/dmsf_workflows/_main.html.erb +++ b/app/views/dmsf_workflows/_main.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/_new_step_form.html.erb b/app/views/dmsf_workflows/_new_step_form.html.erb index 23467144..9a0d3735 100644 --- a/app/views/dmsf_workflows/_new_step_form.html.erb +++ b/app/views/dmsf_workflows/_new_step_form.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/_new_step_modal.html.erb b/app/views/dmsf_workflows/_new_step_modal.html.erb index faa269c9..69f022c7 100644 --- a/app/views/dmsf_workflows/_new_step_modal.html.erb +++ b/app/views/dmsf_workflows/_new_step_modal.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/_steps.html.erb b/app/views/dmsf_workflows/_steps.html.erb index bc398cc0..fe0a1367 100644 --- a/app/views/dmsf_workflows/_steps.html.erb +++ b/app/views/dmsf_workflows/_steps.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/action.js.erb b/app/views/dmsf_workflows/action.js.erb index e92331fa..7fd80d99 100644 --- a/app/views/dmsf_workflows/action.js.erb +++ b/app/views/dmsf_workflows/action.js.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/add_step.html.erb b/app/views/dmsf_workflows/add_step.html.erb index 34a98679..10f587c8 100644 --- a/app/views/dmsf_workflows/add_step.html.erb +++ b/app/views/dmsf_workflows/add_step.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/assign.js.erb b/app/views/dmsf_workflows/assign.js.erb index dba9611c..9ed4cb20 100644 --- a/app/views/dmsf_workflows/assign.js.erb +++ b/app/views/dmsf_workflows/assign.js.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/assignment.js.erb b/app/views/dmsf_workflows/assignment.js.erb index 6ec9d4cc..3504dc4e 100644 --- a/app/views/dmsf_workflows/assignment.js.erb +++ b/app/views/dmsf_workflows/assignment.js.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/index.html.erb b/app/views/dmsf_workflows/index.html.erb index b108f535..8928452b 100644 --- a/app/views/dmsf_workflows/index.html.erb +++ b/app/views/dmsf_workflows/index.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/log.html.erb b/app/views/dmsf_workflows/log.html.erb index 9dc82d6d..bb317897 100644 --- a/app/views/dmsf_workflows/log.html.erb +++ b/app/views/dmsf_workflows/log.html.erb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/log.js.erb b/app/views/dmsf_workflows/log.js.erb index 358c86ed..ef96e94e 100644 --- a/app/views/dmsf_workflows/log.js.erb +++ b/app/views/dmsf_workflows/log.js.erb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/new.html.erb b/app/views/dmsf_workflows/new.html.erb index 1f444144..e8e6a29c 100644 --- a/app/views/dmsf_workflows/new.html.erb +++ b/app/views/dmsf_workflows/new.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/new_step.js.erb b/app/views/dmsf_workflows/new_step.js.erb index 8c062b43..a999d9dd 100644 --- a/app/views/dmsf_workflows/new_step.js.erb +++ b/app/views/dmsf_workflows/new_step.js.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/remove_step.html.erb b/app/views/dmsf_workflows/remove_step.html.erb index 1562a854..83906a9c 100644 --- a/app/views/dmsf_workflows/remove_step.html.erb +++ b/app/views/dmsf_workflows/remove_step.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/reorder_steps.html.erb b/app/views/dmsf_workflows/reorder_steps.html.erb index 40812734..37184bfc 100644 --- a/app/views/dmsf_workflows/reorder_steps.html.erb +++ b/app/views/dmsf_workflows/reorder_steps.html.erb @@ -1,6 +1,6 @@ <%# Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_workflows/show.html.erb b/app/views/dmsf_workflows/show.html.erb index a90de23d..afc7c9a3 100644 --- a/app/views/dmsf_workflows/show.html.erb +++ b/app/views/dmsf_workflows/show.html.erb @@ -2,7 +2,7 @@ # encoding: utf-8 # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/easy_page_modules/easy_dms/_dmsf_locked_documents_edit.html.erb b/app/views/easy_page_modules/easy_dms/_dmsf_locked_documents_edit.html.erb index 315dbe6a..44069b81 100644 --- a/app/views/easy_page_modules/easy_dms/_dmsf_locked_documents_edit.html.erb +++ b/app/views/easy_page_modules/easy_dms/_dmsf_locked_documents_edit.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/easy_page_modules/easy_dms/_dmsf_locked_documents_show.html.erb b/app/views/easy_page_modules/easy_dms/_dmsf_locked_documents_show.html.erb index a9587f5a..3dffc728 100644 --- a/app/views/easy_page_modules/easy_dms/_dmsf_locked_documents_show.html.erb +++ b/app/views/easy_page_modules/easy_dms/_dmsf_locked_documents_show.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/easy_page_modules/easy_dms/_dmsf_open_approvals_edit.html.erb b/app/views/easy_page_modules/easy_dms/_dmsf_open_approvals_edit.html.erb index 315dbe6a..44069b81 100644 --- a/app/views/easy_page_modules/easy_dms/_dmsf_open_approvals_edit.html.erb +++ b/app/views/easy_page_modules/easy_dms/_dmsf_open_approvals_edit.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/easy_page_modules/easy_dms/_dmsf_open_approvals_show.html.erb b/app/views/easy_page_modules/easy_dms/_dmsf_open_approvals_show.html.erb index 36168c5f..12ebb4e0 100644 --- a/app/views/easy_page_modules/easy_dms/_dmsf_open_approvals_show.html.erb +++ b/app/views/easy_page_modules/easy_dms/_dmsf_open_approvals_show.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/hooks/redmine_dmsf/_view_my_account.html.erb b/app/views/hooks/redmine_dmsf/_view_my_account.html.erb index c43fe103..8afeee52 100644 --- a/app/views/hooks/redmine_dmsf/_view_my_account.html.erb +++ b/app/views/hooks/redmine_dmsf/_view_my_account.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/hooks/redmine_dmsf/_view_projects_form.html.erb b/app/views/hooks/redmine_dmsf/_view_projects_form.html.erb index 46cf9ddc..142ac535 100644 --- a/app/views/hooks/redmine_dmsf/_view_projects_form.html.erb +++ b/app/views/hooks/redmine_dmsf/_view_projects_form.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/hooks/redmine_dmsf/_view_users_bulk_edit.html.erb b/app/views/hooks/redmine_dmsf/_view_users_bulk_edit.html.erb index 71505c75..2fb23f54 100644 --- a/app/views/hooks/redmine_dmsf/_view_users_bulk_edit.html.erb +++ b/app/views/hooks/redmine_dmsf/_view_users_bulk_edit.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/my/blocks/_locked_documents.html.erb b/app/views/my/blocks/_locked_documents.html.erb index 6bf1ec1c..a7ca959a 100644 --- a/app/views/my/blocks/_locked_documents.html.erb +++ b/app/views/my/blocks/_locked_documents.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/my/blocks/_open_approvals.html.erb b/app/views/my/blocks/_open_approvals.html.erb index c6351a61..1c7b40fa 100644 --- a/app/views/my/blocks/_open_approvals.html.erb +++ b/app/views/my/blocks/_open_approvals.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/search/_container.html.erb b/app/views/search/_container.html.erb index 40a35513..f7ff051d 100644 --- a/app/views/search/_container.html.erb +++ b/app/views/search/_container.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # - # Copyright © 2011-18 Karel Pičman + # Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/settings/_dmsf_columns.html.erb b/app/views/settings/_dmsf_columns.html.erb index 5afb2657..0a962738 100644 --- a/app/views/settings/_dmsf_columns.html.erb +++ b/app/views/settings/_dmsf_columns.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/settings/_dmsf_settings.html.erb b/app/views/settings/_dmsf_settings.html.erb index 7b12f713..d29ffb97 100644 --- a/app/views/settings/_dmsf_settings.html.erb +++ b/app/views/settings/_dmsf_settings.html.erb @@ -5,7 +5,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -78,17 +78,17 @@ <% end %> <% testfilename = DmsfFile.storage_path.join('test.test') %> <% if File.exist?(storage_dir) %> - <% begin %> - <% File.open(testfilename, 'wb') %> + <% begin %> + <% File.open(testfilename, 'wb') {} %> <% rescue %>

<%= l(:error_file_can_not_be_created) %>

- <% ensure %> - <% File.delete(testfilename) if File.exist?(testfilename) %> + <% ensure %> + <% FileUtils.rm_f(testfilename) %> <% end %> <% end %>

- <%= content_tag(:label, l(:label_tmpdir)) %> + <%= content_tag(:label, l(:label_tmpdir)) %> <% tmpdir = @settings['dmsf_tmpdir'].strip if @settings['dmsf_tmpdir'].present? tmpdir = Dir.tmpdir if tmpdir.blank? @@ -108,12 +108,12 @@ <% path = Pathname.new(tmpdir) %> <% testfilename = path.join('test.test') %> <% if File.exist?(tmpdir) %> - <% begin %> - <% File.open(testfilename, 'wb') %> + <% begin %> + <% File.open(testfilename, 'wb') {} %> <% rescue %>

<%= l(:error_tmpfile_can_not_be_created) %>

- <% ensure %> - <% File.delete(testfilename) if File.exist?(testfilename) %> + <% ensure %> + <% FileUtils.rm_f(testfilename) %> <% end %> <% end %> diff --git a/assets/images/bullet_arrow_down.png b/assets/images/bullet_arrow_down.png deleted file mode 100644 index cb819a7d..00000000 Binary files a/assets/images/bullet_arrow_down.png and /dev/null differ diff --git a/assets/javascripts/attachments_dmsf.js b/assets/javascripts/attachments_dmsf.js index dae3741a..daee4954 100644 --- a/assets/javascripts/attachments_dmsf.js +++ b/assets/javascripts/attachments_dmsf.js @@ -2,7 +2,7 @@ * * Redmine plugin for Document Management System "Features" * - * Copyright © 2011-18 Karel Pičman + * Copyright © 2011-19 Karel Pičman * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/assets/javascripts/redmine_dmsf.js b/assets/javascripts/redmine_dmsf.js index e110e793..6628f0a6 100644 --- a/assets/javascripts/redmine_dmsf.js +++ b/assets/javascripts/redmine_dmsf.js @@ -2,7 +2,7 @@ * * Redmine plugin for Document Management System "Features" * -* Copyright © 2011-18 Karel Pičman +* Copyright © 2011-19 Karel Pičman * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/assets/stylesheets/redmine_dmsf.css b/assets/stylesheets/redmine_dmsf.css index dee60b89..3eb9b36d 100644 --- a/assets/stylesheets/redmine_dmsf.css +++ b/assets/stylesheets/redmine_dmsf.css @@ -2,7 +2,7 @@ * Redmine plugin for Document Management System "Features" * * Copyright © 2011 Vit Jonas -* Copyright © 2011-18 Karel Pičman +* Copyright © 2011-19 Karel Pičman * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -285,12 +285,12 @@ div.dmsf_revision_inner_box .attribute .label { .dmsf_hidden { display:none; } .dmsf_tree span.dmsf_expander { cursor: pointer; } .dmsf_tree.dmsf_expanded td.dmsf_title span { - background: url(../images/bullet_arrow_down.png) no-repeat 0 50%; + background: url(../../../images/arrow_down.png) no-repeat 0 50%; padding-left: 16px; } .dmsf_tree.dmsf_child .dmsf_title span { padding-left: 16px; } .dmsf_tree.dmsf_collapsed .dmsf_title span { - background: url(../../../images/bullet_arrow_right.png) no-repeat 0 50%; + background: url(../../../images/arrow_right.png) no-repeat 0 50%; padding-left: 16px; } .dmsf_tree.idnt-1 .dmsf_title {padding-left: 1.5em;} diff --git a/config/locales/cs.yml b/config/locales/cs.yml index c9a29d44..81794e60 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # # This program is free software; you can redistribute it and/or @@ -309,6 +309,7 @@ cs: field_target_file: Zdrojový soubor title_download_entries: Historie stahování label_external: Externí + label_internal: Interní label_link_name: Název odkazu field_external_url: URL diff --git a/config/locales/de.yml b/config/locales/de.yml index 91e9daab..416af57c 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -4,7 +4,7 @@ # # Copyright © 2011 Terrence Miller # Copyright © 2013 Christian Wetting -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -309,6 +309,7 @@ de: field_target_file: Quelldatei title_download_entries: Download entries label_external: Extern + label_internal: Internal label_link_name: Name der Verknüpfung field_external_url: URL diff --git a/config/locales/en.yml b/config/locales/en.yml index 6b556592..f1c9a6ce 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -309,6 +309,7 @@ en: field_target_file: Source file title_download_entries: Download entries label_external: External + label_internal: Internal label_link_name: Link name field_external_url: URL diff --git a/config/locales/es.yml b/config/locales/es.yml index 744ed5fc..b65f96b8 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2015 Agustin Ivorra -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -309,6 +309,7 @@ es: field_target_file: Archivo fuente title_download_entries: Entradas de descarga label_external: External + label_internal: Internal label_link_name: Nombre de enlace field_external_url: URL diff --git a/config/locales/fr.yml b/config/locales/fr.yml index ad0d3ef8..7cb17967 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -5,7 +5,7 @@ # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn # Copyright © 2014 Atmis -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 @@ -309,6 +309,7 @@ fr: field_target_file: Fichier source title_download_entries: Historique des téléchargements label_external: Externe + label_internal: Internal label_link_name: Nom du lien field_external_url: Adresse Internet diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 76ea4a73..f667901b 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # # @@ -310,6 +310,7 @@ hu: field_target_file: Forrás file title_download_entries: Bejegyzések letöltése label_external: Külső + label_internal: Internal label_link_name: Link elnevezése field_external_url: URL diff --git a/config/locales/it.yml b/config/locales/it.yml index aa68189b..bcf1ca80 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -309,6 +309,7 @@ it: # Italian strings thx 2 Matteo Arceci! field_target_file: Scarica sorgente title_download_entries: Scarica documenti label_external: Esterno + label_internal: Internal label_link_name: Nome del collegamento field_external_url: URL diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 3c960522..476f11e0 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # # This program is free software; you can redistribute it and/or @@ -309,6 +309,7 @@ ja: field_target_file: リンク元ファイル title_download_entries: ダウンロード記録 label_external: 外部 + label_internal: Internal label_link_name: リンク名 field_external_url: URL diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 964c650a..9e2ca321 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011-18 Karel Pičman +# Copyright (C) 2011-19 Karel Pičman # # # This program is free software; you can redistribute it and/or @@ -309,6 +309,7 @@ ko: field_target_file: 소스 파일 title_download_entries: 다운로드 엔트리 label_external: 외부 + label_internal: Internal label_link_name: 링크 이름 field_external_url: URL diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 3f371347..7d4454cc 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011-18 Karel Pičman +# Copyright (C) 2011-19 Karel Pičman # # # @@ -309,6 +309,7 @@ nl: field_target_file: Bronbestand title_download_entries: Download indieningen label_external: Extern + label_internal: Internal label_link_name: Link naam field_external_url: URL diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 4b805690..ed2dcad0 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # Polish translation created by Sebastian Białas www.bs-it.pl # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -310,6 +310,7 @@ pl: field_target_file: Plik źródłowy title_download_entries: Pobrane label_external: External + label_internal: Internal label_link_name: Nazwa odnośnika field_external_url: URL diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index ac08ca6e..6ad58e5b 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -309,6 +309,7 @@ pt-BR: field_target_file: Arquivo fonte title_download_entries: Download entries label_external: External + label_internal: Internal label_link_name: Link name field_external_url: URL diff --git a/config/locales/ru.yml b/config/locales/ru.yml index c76574ea..4c5d4678 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # # This program is free software; you can redistribute it and/or @@ -21,8 +21,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ru: - dmsf: DMS # Custom fields tab title - label_dmsf_file_plural: DMS Файлы # Email subject & Search options + dmsf: СУД # Custom fields tab title + label_dmsf_file_plural: Файлы СУД # Email subject & Search options label_dmsf_file_revision_plural: Изменения документов label_dmsf_file_revision_access_plural: Доступы к документам warning_no_entries_selected: Файлы не выбраны @@ -48,11 +48,11 @@ ru: notice_file_deleted: Файл удален error_at_least_one_revision_must_be_present: По крайней мере, одна редакция должна присутствовать notice_revision_deleted: Редакция удалена - notice_revision_obsoleted: Revision obsoleted + notice_revision_obsoleted: Редакция устарела warning_one_of_files_locked: Один из файлов заблокирован notice_file_revision_created: Редакция файла создана notice_your_preferences_were_saved: Ваши настройки были сохранены - notice_your_preferences_were_not_saved: Your preferences were not saved + notice_your_preferences_were_not_saved: Ваши настройки не сохранены warning_folder_notifications_already_activated: Уведомления папки уже включены notice_folder_notifications_activated: Уведомления папки включены @@ -72,28 +72,28 @@ ru: link_title: Название link_size: Размер link_modified: Изменен - link_ver: Версия + link_ver: Редакция link_author: Автор title_check_for_zip_download_or_email: Выберите документы, которые нужно скачать или отправить их по электронной почте - title_check_for_restore_or_delete: Отметка удаления или восстановления + title_check_for_restore_or_delete: Выберите документы для удаления или восстановления title_delete: Удалить title_notifications_active_deactivate: "Уведомления включены: Отключить" title_notifications_not_active_activate: "Уведомления не включены: Включить" - title_title_version_version_download: "Скачать %{title} версию %{version}" + title_title_version_version_download: "Скачать %{title} редакции %{version}" title_locked_by_user: "Заблокировано пользователем %{user}" title_locked_by_you: Заблокировано Вами - title_waiting_for_approval: Ожидается на утверждение + title_waiting_for_approval: Ожидается утверждение title_approved: Утверждено - title_unlock_file: Разблокируйте файл, чтобы разрешить изменение его другими участниками + title_unlock_file: Разблокируйте файл, чтобы разрешить его изменение другими участниками title_lock_file: Заблокируйте файл, чтобы запретить его изменение другими участниками title_download_checked: Скачать выбранные файлы title_send_checked_by_email: Отправить выбранные файлы по электронной почте - link_user_preferences: Ваши настройки DMS проекта + link_user_preferences: Ваши настройки СУД для проекта heading_send_documents_by_email: Отправить документы по электронной почте label_email_from: От label_email_to: Кому - label_email_cc: CC + label_email_cc: Копия label_email_subject: Тема label_email_documents: Документы label_email_body: Содержание @@ -110,13 +110,13 @@ ru: select_option_deactivated: Отключено select_option_activated: Включено label_title_format: Формат заголовка - text_title_format: "Document title format for download (%t - title, %f - file, %d - date, %v - version, %i - ID, %r - - revision). Example: %t_%v" + text_title_format: "Формат названия при загрузке (%t - Название, %f - имя файла, %d - дата, %v - редакция, %i - ID, %r - + ID редакции). Пример: %t_%v" title_save_preferences: Сохранить настройки heading_revisions: Редакции title_download: Скачать title_delete_revision: Удалить редакцию - title_obsolete_revision: Obsolete revision + title_obsolete_revision: Устаревшая редакция label_created: Создан label_changed: Изменен info_changed_by_user: "%{changed} пользователем" @@ -135,7 +135,7 @@ ru: label_maximum_files_download: Максимальное количество файлов для скачивания note_maximum_number_of_files_downloaded: Ограничивает максимальное количество файлов, которое может быть скачано или отправлено по почте за один раз. 0 означает отсутствие ограничений. - label_file_storage_directory: Каталог для хранения файлов + label_file_storage_directory: Каталог хранения файлов label_index_database: Индексная база данных label_stemming_language: Язык для стемминга note_possible_values: Возможные значения @@ -156,25 +156,25 @@ ru: permission_view_dmsf_file_revision_accesses: Показывать загрзуки файлов в ленте активности permission_view_dmsf_file_revisions: Показывать изменение файлов в ленте активности permission_view_dmsf_folders: Просматривать папки - permission_user_preferences: Настройки пользователя + permission_user_preferences: Собственные настройки для проэкта permission_view_dmsf_files: Просматривать документы permission_folder_manipulation: Управление папками permission_file_manipulation: Управление файлами permission_force_file_unlock: Разблокировка любых файлов - permission_manage_workflows: Управление согласованиями + permission_manage_workflows: Управлять этапами согласования permission_file_delete: Удаление документов - permission_display_system_folders: Display system folders - permission_file_approval: File approval - permission_email_documents: Email documents + permission_display_system_folders: Просматривать скрытые папки + permission_file_approval: Назначать согласование + permission_email_documents: Отправлять документы label_file: Файл field_folder: Папка error_file_commit_require_uploaded_file: Чтобы зафиксировать файл нужно для начала его загрузить - warning_some_files_were_not_commited: "Некоторые файлы не были зафиксированы через ошибки валидации: %{files}" + warning_some_files_were_not_commited: "Некоторые файлы не были зафиксированы из-за ошибки валидации: %{files}" - error_user_has_not_right_delete_folder: Пользователь не имеет нужных прав для удаления папки + error_user_has_not_right_delete_folder: Пользователь не имеет прав для удаления папки - error_user_has_not_right_delete_file: Пользователь не имеет нужных прав для удаления файла + error_user_has_not_right_delete_file: Пользователь не имеет прав для удаления файла notice_entries_deleted: Файлы удалены warning_some_entries_were_not_deleted: "Некоторые файлы не были удалены: %{entries}" @@ -183,12 +183,12 @@ ru: title_filename_for_download: Имя файла для скачиваемого архива label_number_of_folders: Папок label_number_of_documents: Документов - error_file_storage_directory_does_not_exist: Каталог для хранения файлов не существует и не может быть создан + error_file_storage_directory_does_not_exist: Каталог хранения файлов не существует и не может быть создан error_file_can_not_be_created: Файл не может быть создан в каталоге хранения файлов error_wrong_zip_encoding: Неверная кодировка zip warning_xapian_not_available: Xapian не доступен - menu_dmsf: Документы # Project tab title + menu_dmsf: СУД # Project tab title label_physical_file_delete: Физическое удаление файла user_is_not_project_member: Вы не являетесь участником проекта heading_access_downloads_emails: Скачивание / Отправка по почте @@ -197,13 +197,13 @@ ru: label_dmsf_updated: Документ обновлен label_dmsf_downloaded: Документ скачан title_total_size_of_all_files: Общий размер всех файлов в этой папке - project_module_dmsf: DMS # Project module name + project_module_dmsf: СУД # Project module name warning_no_project_to_copy_file_to: Не выбран проект, в который нужно скопировать файл comment_copied_from: "Скопировано из %{source}" field_target_project: Целевой проект field_target_folder: Целевая папка title_copy_or_move: Копировать/Переместить - label_dmsf_folder_plural: DMS Папки # Search options + label_dmsf_folder_plural: Папки СУД # Search options comment_moved_from: "Перемещен из %{source}" error_target_folder_same: Целевая папка и проект совпадают с текущими title_copy: Копировать @@ -234,7 +234,7 @@ ru: label_webdav_strategy: "Стратегия WebDAV" note_webdav_strategy: "Позволяет администратору решить в каком режиме предоставить доступ к WebDAV для конечных - пользователей (Только для чтения или Чтение+Запись)." + пользователей (Только для Чтения или Чтение+Запись)." error_unable_delete_dmsf_workflow: Невозможно удалить процесс согласование error_empty_note: Примечание не может быть пустым @@ -259,20 +259,20 @@ ru: label_or: или label_action: Действие label_note: Примечание - title_none: Примечание + title_none: Отсутствует title_rejection: Отклонение title_delegation: Делегирование title_assignment: Назначение title_start: Запуск title_dmsf_workflow_log: Протокол процесса согласования title_assigned: Назначен - title_approval: Согласован + title_approval: Утвержден title_rejected: Отклонен - title_obsolete: Obsolete + title_obsolete: Устарел dmsf_and: AND dmsf_or: OR dmsf_new_step: Новый шаг - dmsf_new_step_or_approver: Новый шаг или Новый согласующ + dmsf_new_step_or_approver: Новый шаг или Новый согласующий message_dmsf_wokflow_note: Ваше примечание... info_revision: "r%{rev}" link_workflow: Согласование @@ -280,21 +280,21 @@ ru: text_email_subject_approved: успешно завершен text_email_subject_rejected: отклонен text_email_subject_delegated: делегирован - text_email_subject_requires_approval: ребует вашего участия + text_email_subject_requires_approval: требует Вашего рассмотрения text_email_subject_updated: обновлен text_email_subject_started: запущен text_email_finished_approved: "Процесс согласования '%{name}' документа '%{filename}' только что завершился и документ - был согласован." + был утвержден." text_email_finished_rejected: "Процесс согласования '%{name}' документа '%{filename}' только что завершился и документ был отклонен по причине '%{notice}'." text_email_finished_delegated: "Процесс согласования '%{name}' документа '%{filename}' только что был делегирован по - причине '%{notice}' и от Вас ожидается согласование." + причине '%{notice}' и и ожидает Вашего рассмотрения." text_email_finished_step: "Процесс согласования '%{name}' документа '%{filename}' только что завершил один из шагов - согласования и ожидает Вашего соглсования." + согласования и ожидает Вашего рассмотрения." text_email_finished_step_short: "Процесс согласования '%{name}' документа '%{filename}' только что завершил один из - шагов согласования." + шагов." text_email_started: "Процесс согласования '%{name}' документа '%{filename}' только что начался и ожидает Вашего - соглсования." + рассмотрения." text_email_to_proceed: Для продолжения поставьте отметку рядом с документом в text_email_to_see_history: Для просмотра истории согласования нажмите статус согласования документа в @@ -308,7 +308,8 @@ ru: label_notifications_off: Отключить уведоления field_target_file: Исходный файл title_download_entries: Скачать записи - label_external: Внешний + label_external: Внешнюю + label_internal: Internal label_link_name: Наименование ссылки field_external_url: URL @@ -340,7 +341,7 @@ ru: error_resource_or_parent_locked: Невозможно выполнить блокировку - ресурс (или родительская запись) заблокированы error_parent_locked: Невозможно выполнить блокировку - родительская запись заблокирована error_resource_locked: Невозможно выполнить блокировку - ресурс заблокирован - error_lock_exclusively: Невозможно эксклюзивно заблокировать уже забловированный ресурс + error_lock_exclusively: Невозможно эксклюзивно заблокировать уже заблокированный ресурс error_unlock_parent_locked: Разблокировка не удалась - родительская запись заблокирована field_dmsf_tree_view: Навигация по папкам в виде дерева @@ -350,7 +351,7 @@ ru: open_approvals: Открытые согласования label_maximum_ajax_upload_filesize: Максимальный размер файла, загружаемого посредством AJAX - note_maximum_ajax_upload_filesize: Превышает максимальный размер файла, загружаемого посредством интерфейса AJAX, для + note_maximum_ajax_upload_filesize: Максимальный размер файла, загружаемого посредством интерфейса AJAX, для загрузки можно использовать стандартную форму Redmine. Размер указан в MB. label_classic: Обычный @@ -358,41 +359,41 @@ ru: error_maximum_upload_filecount: "Не более %{filecount} файла(ов) может быть загружено." - label_public_urls: Public URLs valid to + label_public_urls: Ссылка действительна до label_webdav: WebDAV label_full_text: Full-text search - link_extension: Ext + link_extension: Внешняя - label_webdav_ignore: Ignored files patterns - note_webdav_ignore: A regular expresion with filenames to ignore by PUT requests. + label_webdav_ignore: Паттерн игнорируемых файлов + note_webdav_ignore: Файлы попадающие под регулярное выражение не будут загружены. label_document_url: Url - label_last_revision_id: Revision + label_last_revision_id: ID редакции - label_webdav_disable_versioning: No versioning files patterns - note_webdav_disable_versioning: A regular expression that disables versioning for matching files. The default pattern - matches temporary files created by MsOffice. + label_webdav_disable_versioning: Паттерн игнорирования версионности + note_webdav_disable_versioning: Файлы попадающие под регулярное выражение не будут иметь редакций. + По умолчанию временные файлы MsOffice. - label_dmsf_keep_documents_locked: Keep documents locked - note_dmsf_keep_documents_locked: Documents will be kept locked when approved - note_global: (global) - field_dmsf_not_inheritable: Not inheritable + label_dmsf_keep_documents_locked: Оставить документы заблокированными + note_dmsf_keep_documents_locked: Документы остануться заблокированными после утверждения + note_global: (Глобальный) + field_dmsf_not_inheritable: Не наследуемый - label_webdav_use_project_names: Use project name for project folder - note_webdav_use_project_names: Use project names instead of project identifier for project folders. + label_webdav_use_project_names: Имя проэкта вместо идентификатора + note_webdav_use_project_names: Использовать имя проэкта вместо идентификатора для папки в WebDAV. - label_last_approver: Last approver + label_last_approver: Последним рассматривал - label_act_as_attachable: Act as attachable - note_dmsf_act_as_attachable: Allows to attach documents to objects e.g. issues. + label_act_as_attachable: Разрешить вложения + note_dmsf_act_as_attachable: Разрешить прикреплять документы из СУД к задачам. - label_user_search_add: Search for user to add + label_user_search_add: Найти пользователя - label_dmsf_attachments: DMS Attachments - label_basic_attachments: Basic Attachments + label_dmsf_attachments: СУД вложения + label_basic_attachments: Базовые вложения - label_tmpdir: Temporary file path + label_tmpdir: Каталог временных файлов error_file_tmpdir_does_not_exist: "Temporary file path doesn't exist and can't be created" error_tmpfile_can_not_be_created: "Files can't be created in temporary file path directory" diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 78004bb9..0baa95a8 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Zdravko Balorda -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # # This program is free software; you can redistribute it and/or @@ -309,6 +309,7 @@ sl: field_target_file: Source file title_download_entries: Download entries label_external: External + label_internal: Internal label_link_name: Link name field_external_url: URL diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index ddc9b062..26de66b7 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # Copyright © 2013 Aecho Liu # # This program is free software; you can redistribute it and/or @@ -309,6 +309,7 @@ zh-TW: field_target_file: Source file title_download_entries: Download entries label_external: External + label_internal: Internal label_link_name: Link name field_external_url: URL diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 5b422dd5..b8b2202d 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # # This program is free software; you can redistribute it and/or @@ -310,6 +310,7 @@ zh: field_target_file: Source file title_download_entries: Download entries label_external: External + label_internal: Internal label_link_name: Link name field_external_url: URL diff --git a/config/routes.rb b/config/routes.rb index f9c4860a..385c4569 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/db/migrate/01_create_hierarchy.rb b/db/migrate/01_create_hierarchy.rb index a6317979..03e4e0b2 100644 --- a/db/migrate/01_create_hierarchy.rb +++ b/db/migrate/01_create_hierarchy.rb @@ -1,7 +1,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -17,7 +17,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class CreateHierarchy < ActiveRecord::Migration +class CreateHierarchy < ActiveRecord::Migration[4.2] def change create_table :dmsf_folders do |t| diff --git a/db/migrate/02_dmsf_normalization.rb b/db/migrate/02_dmsf_normalization.rb index 0fe7ae59..e39588d9 100644 --- a/db/migrate/02_dmsf_normalization.rb +++ b/db/migrate/02_dmsf_normalization.rb @@ -1,7 +1,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -17,7 +17,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class DmsfNormalization < ActiveRecord::Migration +class DmsfNormalization < ActiveRecord::Migration[4.2] def up rename_column :dmsf_folders, :name, :title diff --git a/db/migrate/03_dmsf_0_8_0.rb b/db/migrate/03_dmsf_0_8_0.rb index f9f9dfe2..19f07832 100644 --- a/db/migrate/03_dmsf_0_8_0.rb +++ b/db/migrate/03_dmsf_0_8_0.rb @@ -1,7 +1,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -17,7 +17,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class Dmsf080 < ActiveRecord::Migration +class Dmsf080 < ActiveRecord::Migration[4.2] def change add_column :projects, :dmsf_description, :text diff --git a/db/migrate/04_dmsf_0_9_0.rb b/db/migrate/04_dmsf_0_9_0.rb index 872b75ec..7018cb6f 100644 --- a/db/migrate/04_dmsf_0_9_0.rb +++ b/db/migrate/04_dmsf_0_9_0.rb @@ -1,7 +1,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -17,14 +17,14 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class Dmsf090 < ActiveRecord::Migration +class Dmsf090 < ActiveRecord::Migration[4.2] def up add_column :members, :dmsf_mail_notification, :boolean drop_table :dmsf_user_prefs end - def own + def down remove_column :members, :dmsf_mail_notification create_table :dmsf_user_prefs do |t| t.references :project, null: false diff --git a/db/migrate/05_dmsf_0_9_0_1.rb b/db/migrate/05_dmsf_0_9_0_1.rb index 1f9e5595..f8981a85 100644 --- a/db/migrate/05_dmsf_0_9_0_1.rb +++ b/db/migrate/05_dmsf_0_9_0_1.rb @@ -1,7 +1,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -17,7 +17,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class Dmsf0901 < ActiveRecord::Migration +class Dmsf0901 < ActiveRecord::Migration[4.2] def change create_table :dmsf_file_revision_accesses do |t| diff --git a/db/migrate/06_dmsf_1_2_0.rb b/db/migrate/06_dmsf_1_2_0.rb index bd7b8afe..b9154ba2 100644 --- a/db/migrate/06_dmsf_1_2_0.rb +++ b/db/migrate/06_dmsf_1_2_0.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -19,7 +19,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class Dmsf120 < ActiveRecord::Migration +class Dmsf120 < ActiveRecord::Migration[4.2] def up add_column :dmsf_file_revisions, :project_id, :integer, null: true diff --git a/db/migrate/07_dmsf_1_4_4.rb b/db/migrate/07_dmsf_1_4_4.rb index 6c5ad4b0..8d65f75c 100644 --- a/db/migrate/07_dmsf_1_4_4.rb +++ b/db/migrate/07_dmsf_1_4_4.rb @@ -1,7 +1,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -20,7 +20,7 @@ require 'fileutils' require 'uuidtools' -class Dmsf144 < ActiveRecord::Migration +class Dmsf144 < ActiveRecord::Migration[4.2] class DmsfFileLock < ActiveRecord::Base belongs_to :file, class_name: 'DmsfFile', foreign_key: 'dmsf_file_id' diff --git a/db/migrate/20120822100401_create_dmsf_workflows.rb b/db/migrate/20120822100401_create_dmsf_workflows.rb index 8fe30932..0f516dd4 100644 --- a/db/migrate/20120822100401_create_dmsf_workflows.rb +++ b/db/migrate/20120822100401_create_dmsf_workflows.rb @@ -2,8 +2,8 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -19,7 +19,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class CreateDmsfWorkflows < ActiveRecord::Migration +class CreateDmsfWorkflows < ActiveRecord::Migration[4.2] def up create_table :dmsf_workflows do |t| diff --git a/db/migrate/20120822100402_create_dmsf_workflow_steps.rb b/db/migrate/20120822100402_create_dmsf_workflow_steps.rb index b72236fd..bfe387b6 100644 --- a/db/migrate/20120822100402_create_dmsf_workflow_steps.rb +++ b/db/migrate/20120822100402_create_dmsf_workflow_steps.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class CreateDmsfWorkflowSteps < ActiveRecord::Migration +class CreateDmsfWorkflowSteps < ActiveRecord::Migration[4.2] def change create_table :dmsf_workflow_steps do |t| diff --git a/db/migrate/20120822100403_create_dmsf_workflow_step_assignments.rb b/db/migrate/20120822100403_create_dmsf_workflow_step_assignments.rb index 435b8a5c..c5691233 100644 --- a/db/migrate/20120822100403_create_dmsf_workflow_step_assignments.rb +++ b/db/migrate/20120822100403_create_dmsf_workflow_step_assignments.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class CreateDmsfWorkflowStepAssignments < ActiveRecord::Migration +class CreateDmsfWorkflowStepAssignments < ActiveRecord::Migration[4.2] def change create_table :dmsf_workflow_step_assignments do |t| diff --git a/db/migrate/20120822100404_create_dmsf_workflow_step_actions.rb b/db/migrate/20120822100404_create_dmsf_workflow_step_actions.rb index 69b6b510..53f812a0 100644 --- a/db/migrate/20120822100404_create_dmsf_workflow_step_actions.rb +++ b/db/migrate/20120822100404_create_dmsf_workflow_step_actions.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class CreateDmsfWorkflowStepActions < ActiveRecord::Migration +class CreateDmsfWorkflowStepActions < ActiveRecord::Migration[4.2] def change create_table :dmsf_workflow_step_actions do |t| diff --git a/db/migrate/20130819013955_update_projects.rb b/db/migrate/20130819013955_update_projects.rb index f93f3fc1..9024207d 100644 --- a/db/migrate/20130819013955_update_projects.rb +++ b/db/migrate/20130819013955_update_projects.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class UpdateProjects < ActiveRecord::Migration +class UpdateProjects < ActiveRecord::Migration[4.2] def change # DMSF - project's root folder notification diff --git a/db/migrate/20131108141401_add_index_to_dmsf_files.rb b/db/migrate/20131108141401_add_index_to_dmsf_files.rb index 917b7c2c..36fac7b6 100644 --- a/db/migrate/20131108141401_add_index_to_dmsf_files.rb +++ b/db/migrate/20131108141401_add_index_to_dmsf_files.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class AddIndexToDmsfFiles < ActiveRecord::Migration +class AddIndexToDmsfFiles < ActiveRecord::Migration[4.2] def change add_index :dmsf_files, :project_id diff --git a/db/migrate/20131108141402_add_index_to_dmsf_folders.rb b/db/migrate/20131108141402_add_index_to_dmsf_folders.rb index 8df3c40a..03b7c14d 100644 --- a/db/migrate/20131108141402_add_index_to_dmsf_folders.rb +++ b/db/migrate/20131108141402_add_index_to_dmsf_folders.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class AddIndexToDmsfFolders < ActiveRecord::Migration +class AddIndexToDmsfFolders < ActiveRecord::Migration[4.2] def change add_index :dmsf_folders, :project_id diff --git a/db/migrate/20131113141401_add_index_to_dmsf_file_revision.rb b/db/migrate/20131113141401_add_index_to_dmsf_file_revision.rb index e250fe69..5c815e11 100644 --- a/db/migrate/20131113141401_add_index_to_dmsf_file_revision.rb +++ b/db/migrate/20131113141401_add_index_to_dmsf_file_revision.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class AddIndexToDmsfFileRevision < ActiveRecord::Migration +class AddIndexToDmsfFileRevision < ActiveRecord::Migration[4.2] def change add_index :dmsf_file_revisions, :dmsf_file_id diff --git a/db/migrate/20131113141402_add_index_to_dmsf_lock.rb b/db/migrate/20131113141402_add_index_to_dmsf_lock.rb index 2184eb1b..310db5fb 100644 --- a/db/migrate/20131113141402_add_index_to_dmsf_lock.rb +++ b/db/migrate/20131113141402_add_index_to_dmsf_lock.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class AddIndexToDmsfLock < ActiveRecord::Migration +class AddIndexToDmsfLock < ActiveRecord::Migration[4.2] def change add_index :dmsf_locks, :entity_id diff --git a/db/migrate/20131113141403_create_dmsf_links.rb b/db/migrate/20131113141403_create_dmsf_links.rb index 70686ba6..62e98f37 100644 --- a/db/migrate/20131113141403_create_dmsf_links.rb +++ b/db/migrate/20131113141403_create_dmsf_links.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class CreateDmsfLinks < ActiveRecord::Migration +class CreateDmsfLinks < ActiveRecord::Migration[4.2] def change create_table :dmsf_links do |t| diff --git a/db/migrate/20140314132501_notifications_on.rb b/db/migrate/20140314132501_notifications_on.rb index 91973556..fef60903 100644 --- a/db/migrate/20140314132501_notifications_on.rb +++ b/db/migrate/20140314132501_notifications_on.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class NotificationsOn < ActiveRecord::Migration +class NotificationsOn < ActiveRecord::Migration[4.2] def up # Switch on the default notifications for new projects and folders diff --git a/db/migrate/20140519133201_trash_bin.rb b/db/migrate/20140519133201_trash_bin.rb index 0ceb8ea2..ba0aaad8 100644 --- a/db/migrate/20140519133201_trash_bin.rb +++ b/db/migrate/20140519133201_trash_bin.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class TrashBin < ActiveRecord::Migration +class TrashBin < ActiveRecord::Migration[4.2] def up # DMSF - project's root folder notification diff --git a/db/migrate/20141013102501_remove_project_from_revision.rb b/db/migrate/20141013102501_remove_project_from_revision.rb index 7a154bf9..c3ac23f7 100644 --- a/db/migrate/20141013102501_remove_project_from_revision.rb +++ b/db/migrate/20141013102501_remove_project_from_revision.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class RemoveProjectFromRevision < ActiveRecord::Migration +class RemoveProjectFromRevision < ActiveRecord::Migration[4.2] def up remove_column :dmsf_file_revisions, :project_id diff --git a/db/migrate/20141015132701_remove_folder_from_revision.rb b/db/migrate/20141015132701_remove_folder_from_revision.rb index 17d1df67..f0b7370b 100644 --- a/db/migrate/20141015132701_remove_folder_from_revision.rb +++ b/db/migrate/20141015132701_remove_folder_from_revision.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class RemoveFolderFromRevision < ActiveRecord::Migration +class RemoveFolderFromRevision < ActiveRecord::Migration[4.2] def up remove_column :dmsf_file_revisions, :dmsf_folder_id diff --git a/db/migrate/20141205143001_remove_uniqueness_from_wf.rb b/db/migrate/20141205143001_remove_uniqueness_from_wf.rb index 878d5c22..96f73318 100644 --- a/db/migrate/20141205143001_remove_uniqueness_from_wf.rb +++ b/db/migrate/20141205143001_remove_uniqueness_from_wf.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class RemoveUniquenessFromWf < ActiveRecord::Migration +class RemoveUniquenessFromWf < ActiveRecord::Migration[4.2] def up remove_index(:dmsf_workflows, :name) if index_exists?(:dmsf_workflows, :name) diff --git a/db/migrate/20150120152101_notifications_nullable.rb b/db/migrate/20150120152101_notifications_nullable.rb index c58efbe7..45f7bd7a 100644 --- a/db/migrate/20150120152101_notifications_nullable.rb +++ b/db/migrate/20150120152101_notifications_nullable.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class NotificationsNullable < ActiveRecord::Migration +class NotificationsNullable < ActiveRecord::Migration[4.2] def up change_column :projects, :dmsf_notification, :boolean, default: false, null: true diff --git a/db/migrate/20150130052716_add_external.rb b/db/migrate/20150130052716_add_external.rb index c736f0a3..81029635 100644 --- a/db/migrate/20150130052716_add_external.rb +++ b/db/migrate/20150130052716_add_external.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class AddExternal < ActiveRecord::Migration +class AddExternal < ActiveRecord::Migration[4.2] def up change_column :dmsf_links, :target_id, :integer, null: true diff --git a/db/migrate/20150202010301_add_user_to_links.rb b/db/migrate/20150202010301_add_user_to_links.rb index ed1dc111..7c67fc7e 100644 --- a/db/migrate/20150202010301_add_user_to_links.rb +++ b/db/migrate/20150202010301_add_user_to_links.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class AddUserToLinks < ActiveRecord::Migration +class AddUserToLinks < ActiveRecord::Migration[4.2] def change add_column :dmsf_links, :user_id, :integer diff --git a/db/migrate/20150910153701_title_not_null.rb b/db/migrate/20150910153701_title_not_null.rb index 80577366..8b059c18 100644 --- a/db/migrate/20150910153701_title_not_null.rb +++ b/db/migrate/20150910153701_title_not_null.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class TitleNotNull < ActiveRecord::Migration +class TitleNotNull < ActiveRecord::Migration[4.2] def up change_column :dmsf_file_revisions, :title, :string, null: false diff --git a/db/migrate/20151020141801_large_files.rb b/db/migrate/20151020141801_large_files.rb index fd4b0203..8017541a 100644 --- a/db/migrate/20151020141801_large_files.rb +++ b/db/migrate/20151020141801_large_files.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class LargeFiles < ActiveRecord::Migration +class LargeFiles < ActiveRecord::Migration[4.2] def up change_column :dmsf_file_revisions, :size, :bigint, null: true diff --git a/db/migrate/20151209100001_title_format.rb b/db/migrate/20151209100001_title_format.rb index 6fd80d30..9b762cbb 100644 --- a/db/migrate/20151209100001_title_format.rb +++ b/db/migrate/20151209100001_title_format.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class TitleFormat < ActiveRecord::Migration +class TitleFormat < ActiveRecord::Migration[4.2] def change add_column :members, :title_format, :text, null: true, limit: 100 diff --git a/db/migrate/20160215125801_approval_workflow_status.rb b/db/migrate/20160215125801_approval_workflow_status.rb index 37877d4d..43bfc70a 100644 --- a/db/migrate/20160215125801_approval_workflow_status.rb +++ b/db/migrate/20160215125801_approval_workflow_status.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class ApprovalWorkflowStatus < ActiveRecord::Migration +class ApprovalWorkflowStatus < ActiveRecord::Migration[4.2] def up add_column :dmsf_workflows, :status, :integer, null: false, diff --git a/db/migrate/20160217133001_status_deleted.rb b/db/migrate/20160217133001_status_deleted.rb index 34cda511..6042e194 100644 --- a/db/migrate/20160217133001_status_deleted.rb +++ b/db/migrate/20160217133001_status_deleted.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class StatusDeleted < ActiveRecord::Migration +class StatusDeleted < ActiveRecord::Migration[4.2] def up case ActiveRecord::Base.connection.adapter_name.downcase diff --git a/db/migrate/20160222140401_approval_workflow_std_fields.rb b/db/migrate/20160222140401_approval_workflow_std_fields.rb index ffdea6dc..43a0404d 100644 --- a/db/migrate/20160222140401_approval_workflow_std_fields.rb +++ b/db/migrate/20160222140401_approval_workflow_std_fields.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class ApprovalWorkflowStdFields < ActiveRecord::Migration +class ApprovalWorkflowStdFields < ActiveRecord::Migration[4.2] def up add_column :dmsf_workflows, :updated_on, :timestamp diff --git a/db/migrate/20160421150501_add_digest_to_revision.rb b/db/migrate/20160421150501_add_digest_to_revision.rb index 6500f8be..b1f0dc7d 100644 --- a/db/migrate/20160421150501_add_digest_to_revision.rb +++ b/db/migrate/20160421150501_add_digest_to_revision.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class AddDigestToRevision < ActiveRecord::Migration +class AddDigestToRevision < ActiveRecord::Migration[4.2] def up add_column :dmsf_file_revisions, :digest, :string, limit: 40, default: '', null: false diff --git a/db/migrate/20161223133200_create_dmsf_public_urls.rb b/db/migrate/20161223133200_create_dmsf_public_urls.rb index 8575be95..e4b5d1aa 100644 --- a/db/migrate/20161223133200_create_dmsf_public_urls.rb +++ b/db/migrate/20161223133200_create_dmsf_public_urls.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class CreateDmsfPublicUrls < ActiveRecord::Migration +class CreateDmsfPublicUrls < ActiveRecord::Migration[4.2] def change create_table :dmsf_public_urls do |t| diff --git a/db/migrate/20170103164701_add_name_to_appoval_workflow_step.rb b/db/migrate/20170103164701_add_name_to_appoval_workflow_step.rb index ece8afdf..81b482fb 100644 --- a/db/migrate/20170103164701_add_name_to_appoval_workflow_step.rb +++ b/db/migrate/20170103164701_add_name_to_appoval_workflow_step.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class AddNameToAppovalWorkflowStep < ActiveRecord::Migration +class AddNameToAppovalWorkflowStep < ActiveRecord::Migration[4.2] def change add_column :dmsf_workflow_steps, :name, :string, limit: 30, null: true diff --git a/db/migrate/20170118142001_dmsf_file_container.rb b/db/migrate/20170118142001_dmsf_file_container.rb index 66c95096..80d7d23b 100644 --- a/db/migrate/20170118142001_dmsf_file_container.rb +++ b/db/migrate/20170118142001_dmsf_file_container.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class DmsfFileContainer < ActiveRecord::Migration +class DmsfFileContainer < ActiveRecord::Migration[4.2] def up remove_index :dmsf_files, :project_id diff --git a/db/migrate/20170204214753_add_revision_to_dmsf_lock.rb b/db/migrate/20170204214753_add_revision_to_dmsf_lock.rb index 58a2ce2e..a4566529 100644 --- a/db/migrate/20170204214753_add_revision_to_dmsf_lock.rb +++ b/db/migrate/20170204214753_add_revision_to_dmsf_lock.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # Copyright © 2016-17 carlolars # # This program is free software; you can redistribute it and/or @@ -19,7 +19,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class AddRevisionToDmsfLock < ActiveRecord::Migration +class AddRevisionToDmsfLock < ActiveRecord::Migration[4.2] def change add_column :dmsf_locks, :revision, :integer, null: true diff --git a/db/migrate/20170214153223_add_dmsf_file_last_revision_id_to_dmsf_lock.rb b/db/migrate/20170214153223_add_dmsf_file_last_revision_id_to_dmsf_lock.rb index 1e962b73..0cb2c532 100644 --- a/db/migrate/20170214153223_add_dmsf_file_last_revision_id_to_dmsf_lock.rb +++ b/db/migrate/20170214153223_add_dmsf_file_last_revision_id_to_dmsf_lock.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # Copyright © 2016-17 carlolars # # This program is free software; you can redistribute it and/or @@ -19,7 +19,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class AddDmsfFileLastRevisionIdToDmsfLock < ActiveRecord::Migration +class AddDmsfFileLastRevisionIdToDmsfLock < ActiveRecord::Migration[4.2] def up rename_column :dmsf_locks, :revision, :dmsf_file_last_revision_id diff --git a/db/migrate/20170217141601_add_dmsf_not_inheritable_to_custom_fields.rb b/db/migrate/20170217141601_add_dmsf_not_inheritable_to_custom_fields.rb index d40ff6a9..fb8ec475 100644 --- a/db/migrate/20170217141601_add_dmsf_not_inheritable_to_custom_fields.rb +++ b/db/migrate/20170217141601_add_dmsf_not_inheritable_to_custom_fields.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class AddDmsfNotInheritableToCustomFields < ActiveRecord::Migration +class AddDmsfNotInheritableToCustomFields < ActiveRecord::Migration[4.2] def change add_column :custom_fields, :dmsf_not_inheritable, :boolean, null: true diff --git a/db/migrate/20170323131231_dmsf_description_limit.rb b/db/migrate/20170323131231_dmsf_description_limit.rb index a6e2ffc9..12a2eeeb 100644 --- a/db/migrate/20170323131231_dmsf_description_limit.rb +++ b/db/migrate/20170323131231_dmsf_description_limit.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class DmsfDescriptionLimit < ActiveRecord::Migration +class DmsfDescriptionLimit < ActiveRecord::Migration[4.2] def up change_column :projects, :dmsf_description, :text, null: true, limit: 65535 diff --git a/db/migrate/20170330131901_create_dmsf_folder_permissions.rb b/db/migrate/20170330131901_create_dmsf_folder_permissions.rb index e1c5445d..c2015467 100644 --- a/db/migrate/20170330131901_create_dmsf_folder_permissions.rb +++ b/db/migrate/20170330131901_create_dmsf_folder_permissions.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class CreateDmsfFolderPermissions < ActiveRecord::Migration +class CreateDmsfFolderPermissions < ActiveRecord::Migration[4.2] def change create_table :dmsf_folder_permissions do |t| @@ -29,4 +29,4 @@ class CreateDmsfFolderPermissions < ActiveRecord::Migration add_index :dmsf_folder_permissions, :dmsf_folder_id end -end \ No newline at end of file +end diff --git a/db/migrate/20170421101901_dmsf_file_container_rollback.rb b/db/migrate/20170421101901_dmsf_file_container_rollback.rb index f6ed7f94..78dee662 100644 --- a/db/migrate/20170421101901_dmsf_file_container_rollback.rb +++ b/db/migrate/20170421101901_dmsf_file_container_rollback.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class DmsfFileContainerRollback < ActiveRecord::Migration +class DmsfFileContainerRollback < ActiveRecord::Migration[4.2] def up # Add system folder_flag to dmsf_folders @@ -71,7 +71,7 @@ class DmsfFileContainerRollback < ActiveRecord::Migration def down # dmsf_files file_folder_ids = DmsfFile.joins(:dmsf_folder).where(dmsf_folders: { system: true }).pluck( - 'dmsf_files.id, cast(dmsf_folders.title as decimal)') + 'dmsf_files.id, dmsf_folders.title') remove_index :dmsf_files, :project_id rename_column :dmsf_files, :project_id, :container_id # Temporarily added for the save method @@ -79,10 +79,10 @@ class DmsfFileContainerRollback < ActiveRecord::Migration add_column :dmsf_files, :container_type, :string, limit: 30, null: false, default: 'Project' DmsfFile.update_all(:container_type => 'Project') - file_folder_ids.each do |id, container_id| + file_folder_ids.each do |id, title| file = DmsfFile.find_by(id: id) - if file - file.container_id = container_id + if file && (title =~ /(^\d+) - .*/) + file.container_id = $1.to_i file.container_type = 'Issue' file.save! end diff --git a/db/migrate/20170422104901_migrate_documents.rb b/db/migrate/20170422104901_migrate_documents.rb index 027a32c6..e9ec1eaa 100644 --- a/db/migrate/20170422104901_migrate_documents.rb +++ b/db/migrate/20170422104901_migrate_documents.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class MigrateDocuments < ActiveRecord::Migration +class MigrateDocuments < ActiveRecord::Migration[4.2] def up # Migrate all documents from dmsf/p_{project identifier} to dmsf/{year}/{month} diff --git a/db/migrate/20170526144701_dmsf_attachable.rb b/db/migrate/20170526144701_dmsf_attachable.rb index f1b390d1..33729921 100644 --- a/db/migrate/20170526144701_dmsf_attachable.rb +++ b/db/migrate/20170526144701_dmsf_attachable.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,14 +18,14 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class DmsfAttachable < ActiveRecord::Migration +class DmsfAttachable < ActiveRecord::Migration[4.2] def up # DMSF - project's root folder notification add_column :projects, :dmsf_act_as_attachable, :integer, default: 1, null: false Project.update_all dmsf_act_as_attachable: 1 end - + def down remove_column :projects, :dmsf_act_as_attachable end diff --git a/db/migrate/20171027124101_change_revision_digest_limit_to_64.rb b/db/migrate/20171027124101_change_revision_digest_limit_to_64.rb index ca94c18c..679221a4 100644 --- a/db/migrate/20171027124101_change_revision_digest_limit_to_64.rb +++ b/db/migrate/20171027124101_change_revision_digest_limit_to_64.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class ChangeRevisionDigestLimitTo64 < ActiveRecord::Migration +class ChangeRevisionDigestLimitTo64 < ActiveRecord::Migration[4.2] def up change_column :dmsf_file_revisions, :digest, :string, limit: 64 diff --git a/db/migrate/20171110155901_add_index_to_dmsf_folder.rb b/db/migrate/20171110155901_add_index_to_dmsf_folder.rb index 07ba83b6..98e74b5e 100644 --- a/db/migrate/20171110155901_add_index_to_dmsf_folder.rb +++ b/db/migrate/20171110155901_add_index_to_dmsf_folder.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class AddIndexToDmsfFolder < ActiveRecord::Migration +class AddIndexToDmsfFolder < ActiveRecord::Migration[4.2] def change add_index :dmsf_folders, :dmsf_folder_id diff --git a/db/migrate/20180216152501_rename_title_format.rb b/db/migrate/20180216152501_rename_title_format.rb index 458b7337..436f35d6 100644 --- a/db/migrate/20180216152501_rename_title_format.rb +++ b/db/migrate/20180216152501_rename_title_format.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class RenameTitleFormat < ActiveRecord::Migration +class RenameTitleFormat < ActiveRecord::Migration[4.2] def up rename_column :members, :title_format, :dmsf_title_format diff --git a/db/migrate/20180903132101_fast_links.rb b/db/migrate/20180903132101_fast_links.rb index 81c3467c..39b4d541 100644 --- a/db/migrate/20180903132101_fast_links.rb +++ b/db/migrate/20180903132101_fast_links.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class FastLinks < ActiveRecord::Migration +class FastLinks < ActiveRecord::Migration[4.2] def change add_column :members, :dmsf_fast_links, :boolean, default: false, null: false diff --git a/dmsf_user_guide.odt b/dmsf_user_guide.odt index 8a5553a6..7e46fe87 100644 Binary files a/dmsf_user_guide.odt and b/dmsf_user_guide.odt differ diff --git a/extra/api/api_client.rb b/extra/api/api_client.rb index 13521ca9..1cf503d1 100644 --- a/extra/api/api_client.rb +++ b/extra/api/api_client.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/extra/api/api_client.sh b/extra/api/api_client.sh index 7881a614..809af17b 100644 --- a/extra/api/api_client.sh +++ b/extra/api/api_client.sh @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/extra/xapian_indexer.rb b/extra/xapian_indexer.rb index 5e1607f5..bd1aa0dc 100644 --- a/extra/xapian_indexer.rb +++ b/extra/xapian_indexer.rb @@ -5,7 +5,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2010 Xabier Elkano -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/init.rb b/init.rb index fc069e5d..775d52e8 100644 --- a/init.rb +++ b/init.rb @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -32,9 +32,9 @@ Redmine::Plugin.register :redmine_dmsf do end author 'Vít Jonáš / Daniel Munn / Karel Pičman' description 'Document Management System Features' - version '1.6.2' + version '2.0.0' - requires_redmine version_or_higher: '3.4.0' + requires_redmine version_or_higher: '4.0.0' settings partial: 'settings/dmsf_settings', default: { @@ -62,8 +62,9 @@ Redmine::Plugin.register :redmine_dmsf do 'dmsf_webdav_use_project_names' => nil } - # Uncomment to remove the original Documents from searching (replaced with DMSF) + # Uncomment to remove the original Documents from searching and project's modules (replaced with DMSF) # Redmine::Search.available_search_types.delete('documents') + # Redmine::AccessControl.available_project_modules.delete(:documents) end unless Redmine::Plugin.installed?(:easy_extensions) diff --git a/lib/dav4rack/LICENSE b/lib/dav4rack/LICENSE new file mode 100644 index 00000000..7d0bc974 --- /dev/null +++ b/lib/dav4rack/LICENSE @@ -0,0 +1,42 @@ +Current DAV4Rack license: + +Copyright (c) 2010 Chris Roberts + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +Original rack_dav source license: + +Copyright (c) 2009 Matthias Georgi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lib/dav4rack/README.md b/lib/dav4rack/README.md new file mode 100644 index 00000000..35577ee4 --- /dev/null +++ b/lib/dav4rack/README.md @@ -0,0 +1,467 @@ +# DAV4Rack - Web Authoring for Rack[![Build Status](https://travis-ci.org/planio-gmbh/dav4rack.svg?branch=master)](https://travis-ci.org/planio-gmbh/dav4rack) + +DAV4Rack is a framework for providing WebDAV via Rack allowing content +authoring over HTTP. It is based off the [original RackDAV +framework](http://github.com/georgi/rack_dav) adding some useful new features: + +- Better resource support for building fully virtualized resource structures +- Generic locking as well as Resource level specific locking +- Interceptor middleware to provide virtual mapping to resources +- Mapped resource paths +- Authentication support +- Resource callbacks +- Remote file proxying (including sendfile support for remote files) +- Nokogiri based document parsing +- Ox based XML document building (for performance reasons) + +If you find issues, please create a new issue on github. If you have fixes, +please fork the repo and send me a pull request with your modifications. If you +are just here to use the library, enjoy! + + +## About this fork + +This is the [Planio](https://plan.io/redmine-hosting) fork of DAV4Rack. The +master branch includes improvements and fixes done by @djgraham and +@tim-vandecasteele in their respective forks on Github. + +It also incorporates various fixes that were made as part of the redmine\_dmsf +plugin, as well as improvements done by ourselves during development of an +upcoming redmine document management plugin. + +Several core APIs were changed in the process so it will not be a straight +upgrade for applications that were developed with DAV4Rack 0.3 (the last +released Gem version). + +## Install + +### Bundler + +To use this fork, include in your Gemfile: + + gem 'dav4rack', git: 'https://github.com/planio-gmbh/dav4rack.git', branch: 'master' + + +### Via RubyGems + + gem install dav4rack + +This will give you the last officially released version, which is *very* old. + + +## Documentation + +- [DAV4Rack documentation](http://chrisroberts.github.com/dav4rack) + +## Quickstart + +If you just want to share a folder over WebDAV, you can just start a +simple server with: + + dav4rack + +This will start a Unicorn, Mongrel or WEBrick server on port 3000, which you +can connect to without authentication. Unicorn and Mongrel will be much more +responsive than WEBrick, so if you are having slowness issues, install one of +them and restart the dav4rack process. The simple file resource allows very +basic authentication which is used for an example. To enable it: + + dav4rack --username=user --password=pass + + +## Rack Handler + +Using DAV4Rack within a rack application is pretty simple. A very slim +rackup script would look something like this: + + +```ruby + require 'rubygems' + require 'dav4rack' + + use Rack::CommonLogger + run DAV4Rack::Handler.new(root: '/path/to/public/fileshare') +``` + +This will use the included FileResource and set the share path. However, +DAV4Rack has some nifty little extras that can be enabled in the rackup script. +First, an example of how to use a custom resource: + +```ruby + run DAV4Rack::Handler.new(resource_class: CustomResource, + custom: 'options', + passed: 'to resource') +``` + +Next, lets venture into mapping a path for our WebDAV access. In this example, +we will use default FileResource like in the first example, but instead of the +WebDAV content being available at the root directory, we will map it to a +specific directory: `/webdav/share/` + +```ruby + require 'rubygems' + require 'dav4rack' + + use Rack::CommonLogger + + app = Rack::Builder.new{ + map '/webdav/share/' do + run DAV4Rack::Handler.new(root: '/path/to/public/fileshare') + end + }.to_app + run app +``` + +Aside from the `Builder#map` block, notice the new option passed to the Handler's +initialization, `:root_uri_path`. When DAV4Rack receives a request, it will +automatically convert the request to the proper path and pass it to the +resource. + +Another tool available when building the rackup script is the Interceptor. The +Interceptor's job is to simply intercept WebDAV requests received up the path +hierarchy where no resources are currently mapped. For example, lets continue +with the last example but this time include the interceptor: + + +```ruby + require 'rubygems' + require 'dav4rack' + + use Rack::CommonLogger + app = Rack::Builder.new{ + map '/webdav/share/' do + run DAV4Rack::Handler.new(root: '/path/to/public/fileshare') + end + map '/webdav/share2/' do + run DAV4Rack::Handler.new(resource_class: CustomResource) + end + map '/' do + use DAV4Rack::Interceptor, mappings: { + '/webdav/share/' => {resource_class: FileResource, custom: 'option'}, + '/webdav/share2/' => {resource_class: CustomResource} + } + use Rails::Rack::Static + run ActionController::Dispatcher.new + end + }.to_app + run app +``` + +In this example we have two WebDAV resources restricted by path. This means +those resources will handle requests to `/webdav/share/* and /webdav/share2/*` +but nothing above that. To allow webdav to respond, we provide the Interceptor. +The Interceptor does not provide any authentication support. It simply creates +a virtual file system view to the provided mapped paths. Once the actual +resources have been reached, authentication will be enforced based on the +requirements defined by the individual resource. Also note in the root map you +can see we are running a Rails application. This is how you can easily enable +DAV4Rack with your Rails application. + + +## Custom Middleware + +This is an alternative way to integrate one or more webdav handlers into a +Rails app. It uses a custom middleware dispatching to any number of mounted +Dav4Rack handlers, handles OPTIONS requests outside the webdav namespaces for +interoperability with microsoft windows and lastly dispatches any remaining +requests to the main (Rails) application. + +```ruby + +class CustomMiddleware + + def initialize(app) + @rails_app = app + + @dav_app = Rack::Builder.new{ + map '/dav/' do + run DAV4Rack::Handler.new(resource_class: CustomResource) + end + + map '/other/dav' do + run CustomDavHandler.new + end + }.to_app + end + + def call(env) + status, headers, body = @dav_app.call env + + # If the URL map generated by Rack::Builder did not find a matching path, + # it will return a 404 along with the X-Cascade header set to 'pass'. + if status == 404 and headers['X-Cascade'] == 'pass' + + # The MS web redirector webdav client likes to go up a level and try + # OPTIONS there. We catch that here and respond telling it that just + # plain HTTP is going on. + if 'OPTIONS'.casecmp(env['REQUEST_METHOD'].to_s) == 0 + [ '200', { 'Allow' => 'OPTIONS,HEAD,GET,PUT,POST,DELETE' }, [''] ] + else + # let Rails handle the request + @rails_app.call env + end + + else + [status, headers, body] + end + end + +end +``` + +You can add this middleware to your Rails app using + +```ruby +Rails.configuration.middleware.insert_before ActionDispatch::Cookies, CustomMiddleware +``` + +## Logging + +DAV4Rack provides some simple logging in a Rails style format (simply for +consistency) so the output should look somewhat familiar. + + DAV4Rack::Handler.new(resource_class: CustomResource, log_to: '/my/log/file') + +You can even specify the level of logging: + + DAV4Rack::Handler.new(resource_class: CustomResource, log_to: ['/my/log/file', Logger::DEBUG]) + +In order to use the Rails logger, just specify `log_to: Rails.logger`. + +## Custom Resources + +Creating your own resource is easy. Simply inherit the DAV4Rack::Resource +class, and start redefining all the methods you want to customize. The +DAV4Rack::Resource class only has implementations for methods that can be +provided extremely generically. This means that most things will require at +least some sort of implementation. However, because the Resource is defined so +generically, and the Controller simply passes the request on to the Resource, +it is easy to create fully virtualized resources. + +## Helpers + +There are some helpers worth mentioning that make things a little easier. + +First of all, take note that the `request` object will be an instance of `DAV4Rack::Request`, which extends `Rack::Request` with some useful helpers. + +### Redirects and sending remote files + +If `request.client_allows_redirect?` is true, the currently connected client +will accept and properly use a 302 redirect for a GET request. Most clients do +not properly support this, which can be a real pain when working with +virtualized files that may be located some where else, like S3. To deal with +those clients that don't support redirects, a helper has been provided so +resources don't have to deal with proxying themselves. The DAV4Rack::RemoteFile +is a modified Rack::File that can do some interesting things. First, lets look +at its most basic use: + + class MyResource < DAV4Rack::Resource + def setup + @item = method_to_fill_this_properly + end + + def get + if(request.client_allows_redirect?) + response.redirect item[:url] + else + response.body = DAV4Rack::RemoteFile.new(item[:url], :size => content_length, :mime_type => content_type) + OK + end + end + end + +This is a simple proxy. When Rack receives the RemoteFile, it will pull a chunk of data from object, which in turn pulls it from the socket, and +sends it to the user over and over again until the EOF is reached. This much the same method that Rack::File uses but instead we are pulling +from a socket rather than an actual file. Now, instead of proxying these files from a remote server every time, lets cache them: + + response.body = DAV4Rack::RemoteFile.new(item[:url], :size => content_length, :mime_type => content_type, :cache_directory => '/tmp') + +Providing the `:cache_directory` will let RemoteFile cache the items locally, +and then search for them on subsequent requests before heading out to the +network. The cached file name is based off the SHA1 hash of the file path, size +and last modified time. It is important to note that for services like S3, the +path will often change, making this cache pretty worthless. To combat this, we +can provide a reference to use instead: + + response.body = DAV4Rack::RemoteFile.new(item[:url], :size => content_length, :mime_type => content_type, :cache_directory => '/tmp', :cache_ref => item[:static_url]) + +These methods will work just fine, but it would be really nice to just let +someone else deal with the proxying and let the process get back to dealing +with actual requests. RemoteFile will happily do that as long as the frontend +server is setup correctly. Using the sendfile approach will tell the RemoteFile +to simply pass the headers on and let the server deal with doing the actual +proxying. First, lets look at an implementation using all the features, and +then degrade that down to the bare minimum. These examples are NGINX specific, +but are based off the Rack::Sendfile implementation and as such should be +applicable to other servers. First, a simplified NGINX server block: + + server { + listen 80; + location / { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_set_header X-Sendfile-Type X-Accel-Redirect; + proxy_set_header X-Accel-Remote-Mapping webdav_redirect + proxy_pass http://my_app_server; + } + + location ~* /webdav_redirect { + internal; + resolver 127.0.0.1; + set $r_host $upstream_http_redirect_host; + set $r_url $upstream_http_redirect_url; + proxy_set_header Authorization ''; + proxy_set_header Host $r_host; + proxy_max_temp_file_size 0; + proxy_pass $r_url; + } + } + +With this in place, the parameters for the RemoteFile change slightly: + + response.body = DAV4Rack::RemoteFile.new(item[:url], :size => content_length, :mime_type => content_type, :sendfile => true) + +The RemoteFile will automatically take care of building out the correct path and sending the proper headers. If the X-Accel-Remote-Mapping header +is not available, you can simply pass the value: + + response.body = DAV4Rack::RemoteFile.new(item[:url], :size => content_length, :mime_type => content_type, :sendfile => true, :sendfile_prefix => 'webdav_redirect') + +And if you don't have the X-Sendfile-Type header set, you can fix that by changing the value of :sendfile: + + response.body = DAV4Rack::RemoteFile.new(item[:url], :size => content_length, :mime_type => content_type, :sendfile => 'X-Accel-Redirect', :sendfile_prefix => 'webdav_redirect') + +And if you have none of the above because your server hasn't been configured for sendfile support, you're out of luck until it's configured. + +## Authentication + +Authentication is performed on a per Resource basis. The Controller object will +call `#authenticate` on any Resources it handles requests for. Basic +Authentication information from the request will be passed to the method. +Depending on the result, the Controller will either continue on with the +request, or send a 401 Unauthorized response. + +Override `Resource#authentication_realm` and `Resource#authentication_error_msg` to customize the realm name and response content for authentication failures. + +Authentication can also be implemented using callbacks, as discussed below. + +## Callbacks + +*Deprecated*. This feature will most probably be removed in the future. + +If you want to implement general before/after logic for every request, use a +custom controller class and override `#process`. + + +Resources can make use of callbacks to easily apply permissions, authentication or any other action that needs to be performed before or after any or all +actions. Callbacks are applied to all publicly available methods. This is important for methods used internally within the resource. Methods not meant +to be called by the Controller, or anyone else, should be scoped protected or private to reduce the interaction with callbacks. + +Callbacks can be called before or after a method call. For example: + + class MyResource < DAV4Rack::Resource + before do |resource, method_name| + resource.send(:my_authentication_method) + end + + after do |resource, method_name| + puts "#{Time.now} -> Completed: #{resource}##{method_name}" + end + + private + + def my_authentication_method + true + end + end + +In this example MyResource#my_authentication_method will be called before any public method is called. After any method has been called a status +line will be printed to STDOUT. Running callbacks before/after every method call is a bit much in most cases, so callbacks can be applied to specific +methods: + + class MyResource < DAV4Rack::Resource + before_get do |resource| + puts "#{Time.now} -> Received GET request from resource: #{resource}" + end + end + +In this example, a simple status line will be printed to STDOUT before the MyResource#get method is called. The current resource object is always +provided to callbacks. The method name is only provided to the generic before/after callbacks. + +Something very handy for dealing with the mess of files OS X leaves on the system: + + class MyResource < DAV4Rack::Resource + after_unlock do |resource| + resource.delete if resource.name[0,1] == '.' + end + end + +Because OS X implements locking correctly, we can wait until it releases the lock on the file, and remove it if it's a hidden file. + +Callbacks are called in the order they are defined, so you can easily build callbacks off each other. Like this example: + + class MyResource < DAV4Rack::Resource + before do |resource, method_name| + resource.DAV_authenticate unless resource.user.is_a?(User) + raise Unauthorized unless resource.user.is_a?(User) + end + before do |resource, method_name| + resource.user.allowed?(method_name) + end + end + +In this example, the second block checking User#allowed? can count on Resource#user being defined because the blocks are called in +order, and if the Resource#user is not a User type, an exception is raised. + +### Avoiding callbacks + +Something special to notice in the last example is the DAV_ prefix on authenticate. Providing the DAV_ prefix will prevent +any callbacks being applied to the given method. This allows us to provide a public method that the callback can access on the resource +without getting stuck in a loop. + +## Software using DAV4Rack! + +* {meishi}[https://github.com/inferiorhumanorgans/meishi] - Lightweight CardDAV implementation in Rails +* {dav4rack_ext}[https://github.com/schmurfy/dav4rack_ext] - CardDAV extension. (CalDAV planned) + +## Issues/Bugs/Questions + +### Known Issues + +- OS X Finder PUT fails when using NGINX (this is due to NGINX's lack of + chunked transfer encoding in earlier versions). Use a recent version of + NGINX. +- Windows WebDAV mini-redirector - this client is very broken. Windows from + version 7 onwards however should work fine with the `OPTIONS` handling + addition demonstrated above. +- Lots of unimplemented parts of the webdav spec (patches always welcome). Run + `test/litmus_all.sh` to see what works and what doesnt. + + +### Unknown Issues + +Please report issues at github: http://github.com/planio-gmbh/dav4rack/issues +Include as much information about the environment as possible (especially client OS / software). + +## Contributors + +A big thanks to everyone contributing to help make this project better. + +* [clyfe](http://github.com/clyfe) +* [antiloopgmbh](http://github.com/antiloopgmbh) +* [krug](http://github.com/krug) +* [teefax](http://github.com/teefax) +* [buffym](https://github.com/buffym) +* [jbangert](https://github.com/jbangert) +* [doxavore](https://github.com/doxavore) +* [spicyj](https://github.com/spicyj) +* [TurchenkoAlex](https://github.com/TurchenkoAlex) +* [exabugs](https://github.com/exabugs) +* [inferiorhumanorgans](https://github.com/inferiorhumanorgans) +* [schmurfy](https://github.com/schmurfy) +* [pifleo](https://github.com/pifleo) +* [mlmorg](https://github.com/mlmorg) + +## License + +Just like RackDAV before it, this software is distributed under the MIT license. diff --git a/lib/dav4rack/controller.rb b/lib/dav4rack/controller.rb index f75086dd..da77a260 100644 --- a/lib/dav4rack/controller.rb +++ b/lib/dav4rack/controller.rb @@ -102,12 +102,14 @@ module DAV4Rack # Return response to HEAD def head if(resource.exist?) - response['Etag'] = resource.etag - response['Content-Type'] = resource.content_type - response['Content-Length'] = resource.content_length.to_s - response['Last-Modified'] = resource.last_modified.httpdate - resource.head(request, response) - OK + res = resource.head(request, response) + if(res == OK) + response['Etag'] ||= resource.etag + response['Content-Type'] ||= resource.content_type + response['Content-Length'] ||= resource.content_length.to_s + response['Last-Modified'] ||= resource.last_modified.httpdate + end + res else NotFound end @@ -197,7 +199,8 @@ module DAV4Rack return BadRequest unless request.depth == :infinity return BadRequest unless dest = request.destination - if status = dest.validate + if status = dest.validate(host: request.host, + resource_path: resource.path) return status end diff --git a/lib/dav4rack/destination_header.rb b/lib/dav4rack/destination_header.rb index fe43e7e1..bdaae6ec 100644 --- a/lib/dav4rack/destination_header.rb +++ b/lib/dav4rack/destination_header.rb @@ -5,24 +5,13 @@ module DAV4Rack attr_reader :host, :path, :path_info - def initialize(value, script_name: nil) - @script_name = script_name.to_s - @value = value.to_s.strip - parse - end - - def parse - uri = Addressable::URI.parse @value - + # uri is expected to be a DAV4Rack::Uri instance + def initialize(uri) @host = uri.host - @path = Addressable::URI.unencode uri.path - - if @script_name - if @path =~ /\A(?#{Regexp.escape @script_name}(?\/.*))\z/ - @path_info = $~[:path_info] - else - raise ArgumentError, 'invalid destination header value' - end + @path = uri.path + unless @path_info = uri.path_info + # nil path info means path is outside the realm of script_name + raise ArgumentError, "invalid destination header value: #{uri.to_s}" end end @@ -30,7 +19,7 @@ module DAV4Rack def validate(host: nil, resource_path: nil) if host and self.host and self.host != host DAV4Rack::HTTPStatus::BadGateway - elsif self.path == resource_path + elsif resource_path and self.path_info == resource_path DAV4Rack::HTTPStatus::Forbidden end end diff --git a/lib/dav4rack/request.rb b/lib/dav4rack/request.rb index 7851988b..3a867db7 100644 --- a/lib/dav4rack/request.rb +++ b/lib/dav4rack/request.rb @@ -3,6 +3,7 @@ require 'uri' require 'addressable/uri' require 'dav4rack/logger' +require 'dav4rack/uri' module DAV4Rack class Request < Rack::Request @@ -84,7 +85,7 @@ module DAV4Rack # Destination header def destination @destination ||= if h = get_header('HTTP_DESTINATION') - DestinationHeader.new h, script_name: script_name + DestinationHeader.new DAV4Rack::Uri.new(h, script_name: script_name) end end @@ -123,6 +124,13 @@ module DAV4Rack "#{script_name}#{expand_path path}" end + # returns the given path, but with the leading script_name removed. Will + # return nil if the path does not begin with the script_name + def path_info_for(full_path, script_name: self.script_name) + uri = DAV4Rack::Uri.new full_path, script_name: script_name + return uri.path_info + end + # expands '/foo/../bar' to '/bar' def expand_path(path) path.squeeze! '/' diff --git a/lib/dav4rack/resource.rb b/lib/dav4rack/resource.rb index 2981e852..6eb62d3e 100644 --- a/lib/dav4rack/resource.rb +++ b/lib/dav4rack/resource.rb @@ -208,8 +208,12 @@ module DAV4Rack NotImplemented end + # HTTP HEAD request. + # + # Like GET, but without content. Override if you set custom headers in GET + # to set them here as well. def head(request, response) - #no-op, but called by the controller + OK end # HTTP PUT request. diff --git a/lib/dav4rack/uri.rb b/lib/dav4rack/uri.rb new file mode 100644 index 00000000..20a5dbcf --- /dev/null +++ b/lib/dav4rack/uri.rb @@ -0,0 +1,42 @@ +require 'addressable/uri' + +module DAV4Rack + + # adds a bit of parsing logic around a header URI or path value + class Uri + + attr_reader :host, :path, :path_info, :script_name + + def initialize(uri_or_path, script_name: nil) + # more than one leading slash confuses Addressable::URI, resulting e.g. + # with //remote.php/dav/files in a path of /dav/files with a host + # remote.php. + @uri_or_path = uri_or_path.to_s.strip.sub %r{\A/+}, '/' + + @script_name = script_name + parse + end + + def to_s + @uri_or_path + end + + private + + def parse + uri = Addressable::URI.parse @uri_or_path + + @host = uri.host + @path = Addressable::URI.unencode uri.path + + if @script_name + if @path =~ /\A(?#{Regexp.escape @script_name}(?\/.*))\z/ + @path_info = $~[:path_info] + end + else + @path_info = @path + end + end + + end +end diff --git a/lib/dav4rack/version.rb b/lib/dav4rack/version.rb index 221a3e9a..d386f6c5 100644 --- a/lib/dav4rack/version.rb +++ b/lib/dav4rack/version.rb @@ -13,5 +13,5 @@ module DAV4Rack end end - VERSION = Version.new('1.0.0') + VERSION = Version.new('1.1.0') end diff --git a/lib/dmsf_zip.rb b/lib/dmsf_zip.rb deleted file mode 100644 index 0fe1a2d9..00000000 --- a/lib/dmsf_zip.rb +++ /dev/null @@ -1,81 +0,0 @@ -# encoding: utf-8 -# -# Redmine plugin for Document Management System "Features" -# -# Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -require 'zip' - -class DmsfZip - - attr_reader :files - - def initialize - @zip_path = DmsfHelper.temp_dir.join(DmsfHelper.temp_filename('dmsf_zip.zip')) - @zip_file = Zip::OutputStream.new(@zip_path) - @files = [] - @folders = [] - end - - def finish - @zip_file.close - @zip_path - end - - def close - @zip_file.close - end - - def add_file(file, member, root_path = nil) - unless @files.include?(file) - unless file && file.last_revision && File.exist?(file.last_revision.disk_file) - raise FileNotFound - end - string_path = file.dmsf_folder.nil? ? '' : (file.dmsf_folder.dmsf_path_str + File::SEPARATOR) - string_path = string_path[(root_path.length + 1) .. string_path.length] if root_path - if member && !member.dmsf_title_format.nil? && !member.dmsf_title_format.empty? - string_path += file.formatted_name(member.dmsf_title_format) - else - string_path += file.formatted_name(Setting.plugin_redmine_dmsf['dmsf_global_title_format']) - end - zip_entry = ::Zip::Entry.new(@zip_file, string_path, nil, nil, nil, nil, nil, nil, - ::Zip::DOSTime.at(file.last_revision.updated_at)) - @zip_file.put_next_entry(zip_entry) - File.open(file.last_revision.disk_file, 'rb') do |f| - while (buffer = f.read(8192)) - @zip_file.write(buffer) - end - end - @files << file - end - end - - def add_folder(folder, member, root_path = nil) - unless @folders.include?(folder) - string_path = folder.dmsf_path_str + File::SEPARATOR - string_path = string_path[(root_path.length + 1) .. string_path.length] if root_path - zip_entry = ::Zip::Entry.new(@zip_file, string_path, nil, nil, nil, nil, nil, nil, - ::Zip::DOSTime.at(folder.modified)) - @zip_file.put_next_entry(zip_entry) - @folders << folder - folder.dmsf_folders.visible.each { |subfolder| add_folder(subfolder, member, root_path) } - folder.dmsf_files.visible.each { |file| add_file(file, member, root_path) } - end - end - -end \ No newline at end of file diff --git a/lib/redmine_dmsf.rb b/lib/redmine_dmsf.rb index 65890cc6..8913c4f4 100644 --- a/lib/redmine_dmsf.rb +++ b/lib/redmine_dmsf.rb @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -52,7 +52,7 @@ require 'redmine_dmsf/webdav/index_resource' require 'redmine_dmsf/webdav/project_resource' require 'redmine_dmsf/webdav/resource_proxy' -# Exceptions +# Errors require 'redmine_dmsf/errors/dmsf_access_error' require 'redmine_dmsf/errors/dmsf_content_error' require 'redmine_dmsf/errors/dmsf_email_max_file_error' diff --git a/lib/redmine_dmsf/dmsf_zip.rb b/lib/redmine_dmsf/dmsf_zip.rb new file mode 100644 index 00000000..19812f1f --- /dev/null +++ b/lib/redmine_dmsf/dmsf_zip.rb @@ -0,0 +1,87 @@ +# encoding: utf-8 +# +# Redmine plugin for Document Management System "Features" +# +# Copyright © 2011 Vít Jonáš +# Copyright © 2011-19 Karel Pičman +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +require 'zip' + +module RedmineDmsf + module DmsfZip + + class Zip + + attr_reader :files + + def initialize + @zip_path = DmsfHelper.temp_dir.join(DmsfHelper.temp_filename('dmsf_zip.zip')) + @zip_file = ::Zip::OutputStream.new(@zip_path) + @files = [] + @folders = [] + end + + def finish + @zip_file.close + @zip_path + end + + def close + @zip_file.close + end + + def add_file(file, member, root_path = nil) + unless @files.include?(file) + unless file && file.last_revision && File.exist?(file.last_revision.disk_file) + raise FileNotFound + end + string_path = file.dmsf_folder.nil? ? '' : (file.dmsf_folder.dmsf_path_str + File::SEPARATOR) + string_path = string_path[(root_path.length + 1) .. string_path.length] if root_path + if member && !member.dmsf_title_format.nil? && !member.dmsf_title_format.empty? + string_path += file.formatted_name(member.dmsf_title_format) + else + string_path += file.formatted_name(Setting.plugin_redmine_dmsf['dmsf_global_title_format']) + end + zip_entry = ::Zip::Entry.new(@zip_file, string_path, nil, nil, nil, nil, nil, nil, + ::Zip::DOSTime.at(file.last_revision.updated_at)) + @zip_file.put_next_entry(zip_entry) + File.open(file.last_revision.disk_file, 'rb') do |f| + while (buffer = f.read(8192)) + @zip_file.write(buffer) + end + end + @files << file + end + end + + def add_folder(folder, member, root_path = nil) + unless @folders.include?(folder) + string_path = folder.dmsf_path_str + File::SEPARATOR + string_path = string_path[(root_path.length + 1) .. string_path.length] if root_path + zip_entry = ::Zip::Entry.new(@zip_file, string_path, nil, nil, nil, nil, nil, nil, + ::Zip::DOSTime.at(folder.modified)) + @zip_file.put_next_entry(zip_entry) + @folders << folder + folder.dmsf_folders.visible.each { |subfolder| add_folder(subfolder, member, root_path) } + folder.dmsf_files.visible.each { |file| add_file(file, member, root_path) } + end + end + + end + + end +end \ No newline at end of file diff --git a/lib/redmine_dmsf/errors/dmsf_access_error.rb b/lib/redmine_dmsf/errors/dmsf_access_error.rb index 550ebdb8..108ba6a0 100644 --- a/lib/redmine_dmsf/errors/dmsf_access_error.rb +++ b/lib/redmine_dmsf/errors/dmsf_access_error.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/errors/dmsf_content_error.rb b/lib/redmine_dmsf/errors/dmsf_content_error.rb index 2e1cea44..8cd695fd 100644 --- a/lib/redmine_dmsf/errors/dmsf_content_error.rb +++ b/lib/redmine_dmsf/errors/dmsf_content_error.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/errors/dmsf_email_max_file_error.rb b/lib/redmine_dmsf/errors/dmsf_email_max_file_error.rb index bf6460fd..d4f4113c 100644 --- a/lib/redmine_dmsf/errors/dmsf_email_max_file_error.rb +++ b/lib/redmine_dmsf/errors/dmsf_email_max_file_error.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/errors/dmsf_file_not_found_error.rb b/lib/redmine_dmsf/errors/dmsf_file_not_found_error.rb index 112adaeb..4801b3bf 100644 --- a/lib/redmine_dmsf/errors/dmsf_file_not_found_error.rb +++ b/lib/redmine_dmsf/errors/dmsf_file_not_found_error.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/errors/dmsf_lock_error.rb b/lib/redmine_dmsf/errors/dmsf_lock_error.rb index ba140072..613a6b3d 100644 --- a/lib/redmine_dmsf/errors/dmsf_lock_error.rb +++ b/lib/redmine_dmsf/errors/dmsf_lock_error.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/errors/dmsf_zip_max_file_error.rb b/lib/redmine_dmsf/errors/dmsf_zip_max_file_error.rb index 51612002..51d7e6b5 100644 --- a/lib/redmine_dmsf/errors/dmsf_zip_max_file_error.rb +++ b/lib/redmine_dmsf/errors/dmsf_zip_max_file_error.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/hooks/controllers/issues_controller_hooks.rb b/lib/redmine_dmsf/hooks/controllers/issues_controller_hooks.rb index 78ae7081..c6d38c4e 100644 --- a/lib/redmine_dmsf/hooks/controllers/issues_controller_hooks.rb +++ b/lib/redmine_dmsf/hooks/controllers/issues_controller_hooks.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -81,7 +81,7 @@ module RedmineDmsf if old_system_folder old_system_folder.title = "#{issue.id} - #{DmsfFolder::get_valid_title(issue.subject)}" unless old_system_folder.save - controller.flash[:error] = old_system_folder.errors.full_messages.to_sentence + controller.flash[:errors] = old_system_folder.errors.full_messages.to_sentence Rails.logger.error old_system_folder.errors.full_messages.to_sentence end end @@ -93,20 +93,20 @@ module RedmineDmsf old_system_folder.dmsf_folder_id = new_main_system_folder.id old_system_folder.project_id = project_id unless old_system_folder.save - controller.flash[:error] = old_system_folder.errors.full_messages.to_sentence + controller.flash[:errors] = old_system_folder.errors.full_messages.to_sentence Rails.logger.error old_system_folder.errors.full_messages.to_sentence end issue.dmsf_files.each do |dmsf_file| dmsf_file.project_id = project_id unless dmsf_file.save - controller.flash[:error] = dmsf_file.errors.full_messages.to_sentence + controller.flash[:errors] = dmsf_file.errors.full_messages.to_sentence Rails.logger.error dmsf_file.errors.full_messages.to_sentence end end issue.dmsf_links.each do | dmsf_link| dmsf_link.project_id = project_id unless dmsf_link.save - controller.flash[:error] = dmsf_link.errors.full_messages.to_sentence + controller.flash[:errors] = dmsf_link.errors.full_messages.to_sentence Rails.logger.error dmsf_link.errors.full_messages.to_sentence end end @@ -116,7 +116,7 @@ module RedmineDmsf end # Attach DMS documents uploaded_files = params[:dmsf_attachments] - if uploaded_files && uploaded_files.is_a?(Hash) + if uploaded_files system_folder = issue.system_folder(true) uploaded_files.each do |key, uploaded_file| upload = DmsfUpload.create_from_uploaded_attachment(issue.project, system_folder, uploaded_file) diff --git a/lib/redmine_dmsf/hooks/controllers/search_controller_hooks.rb b/lib/redmine_dmsf/hooks/controllers/search_controller_hooks.rb index 28af2fa0..b3457383 100644 --- a/lib/redmine_dmsf/hooks/controllers/search_controller_hooks.rb +++ b/lib/redmine_dmsf/hooks/controllers/search_controller_hooks.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -23,13 +23,14 @@ module RedmineDmsf include Redmine::Hook class ControllerSearchHook < RedmineDmsf::Hooks::Listener + include Rails.application.routes.url_helpers def controller_search_quick_jump(context={}) if context.is_a?(Hash) question = context[:question] if question.present? - if question.match(/^D(\d+)$/) && DmsfFile.visible.find_by(id: $1).exists? - return dmsf_file_path(:id => $1) + if question.match(/^D(\d+)$/) && DmsfFile.visible.where(id: $1).exists? + return dmsf_file_path(id: $1) end end end diff --git a/lib/redmine_dmsf/hooks/helpers/issues_helper_hooks.rb b/lib/redmine_dmsf/hooks/helpers/issues_helper_hooks.rb index 1e9b797e..d18f5455 100644 --- a/lib/redmine_dmsf/hooks/helpers/issues_helper_hooks.rb +++ b/lib/redmine_dmsf/hooks/helpers/issues_helper_hooks.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/hooks/helpers/search_helper_hooks.rb b/lib/redmine_dmsf/hooks/helpers/search_helper_hooks.rb index f942a53a..4aa9001a 100644 --- a/lib/redmine_dmsf/hooks/helpers/search_helper_hooks.rb +++ b/lib/redmine_dmsf/hooks/helpers/search_helper_hooks.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/hooks/views/base_view_hooks.rb b/lib/redmine_dmsf/hooks/views/base_view_hooks.rb index 60c20084..310d1ef0 100644 --- a/lib/redmine_dmsf/hooks/views/base_view_hooks.rb +++ b/lib/redmine_dmsf/hooks/views/base_view_hooks.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/hooks/views/custom_field_view_hooks.rb b/lib/redmine_dmsf/hooks/views/custom_field_view_hooks.rb index 3d305d12..8d5629e8 100644 --- a/lib/redmine_dmsf/hooks/views/custom_field_view_hooks.rb +++ b/lib/redmine_dmsf/hooks/views/custom_field_view_hooks.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb b/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb index f8b6dcf3..fccf907f 100644 --- a/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb +++ b/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/hooks/views/my_account_view_hooks.rb b/lib/redmine_dmsf/hooks/views/my_account_view_hooks.rb index 253b29ce..8f072405 100644 --- a/lib/redmine_dmsf/hooks/views/my_account_view_hooks.rb +++ b/lib/redmine_dmsf/hooks/views/my_account_view_hooks.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/hooks/views/search_view_hooks.rb b/lib/redmine_dmsf/hooks/views/search_view_hooks.rb index d9fb95e8..199f1842 100644 --- a/lib/redmine_dmsf/hooks/views/search_view_hooks.rb +++ b/lib/redmine_dmsf/hooks/views/search_view_hooks.rb @@ -1,6 +1,6 @@ # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/hooks/views/view_projects_form_hook.rb b/lib/redmine_dmsf/hooks/views/view_projects_form_hook.rb index fc3535ec..7abb3f23 100644 --- a/lib/redmine_dmsf/hooks/views/view_projects_form_hook.rb +++ b/lib/redmine_dmsf/hooks/views/view_projects_form_hook.rb @@ -1,6 +1,6 @@ # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/lockable.rb b/lib/redmine_dmsf/lockable.rb index 146a950f..fae03947 100644 --- a/lib/redmine_dmsf/lockable.rb +++ b/lib/redmine_dmsf/lockable.rb @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/macros.rb b/lib/redmine_dmsf/macros.rb index e93b43da..ec4a8376 100644 --- a/lib/redmine_dmsf/macros.rb +++ b/lib/redmine_dmsf/macros.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -53,8 +53,8 @@ Redmine::WikiFormatting::Macros.register do # dmsff - link to a folder desc "Wiki link to DMSF folder:\n\n" + - "{{dmsff(folder_id [, title])}}\n\n" + - "_folder_id_ may be missing. _folder_id_ can be found in the link for folder opening." + "{{dmsff([folder_id [, title]])}}\n\n" + + "_folder_id_ can be found in the link for folder opening. Without arguments return link to main folder 'Documents'" macro :dmsff do |obj, args| if args.length < 1 return link_to l(:link_documents), dmsf_folder_url(@project) @@ -75,7 +75,7 @@ Redmine::WikiFormatting::Macros.register do # dmsfd - link to the document's details desc "Wiki link to DMSF document details:\n\n" + - "{{dmsfd(document_id)}}\n\n" + + "{{dmsfd(document_id [, title])}}\n\n" + "_document_id_ can be found in the document's details." macro :dmsfd do |obj, args| raise ArgumentError if args.length < 1 # Requires file id @@ -130,9 +130,9 @@ Redmine::WikiFormatting::Macros.register do end # dmsft - link to the document's content preview - desc "Wiki link to DMSF document's content preview:\n\n" + - "{{dmsft(file_id)}}\n\n" + - "_file_id_ can be found in the document's details." + desc "Text referring to DMSF text document content:\n\n" + + "{{dmsft(file_id, lines_count)}}\n\n" + + "_file_id_ can be found in the document's details. _lines_count_ indicate quantity of lines to show." macro :dmsft do |obj, args| raise ArgumentError if args.length < 2 # Requires file id and lines number file = DmsfFile.visible.find args[0].strip @@ -146,10 +146,10 @@ Redmine::WikiFormatting::Macros.register do # dmsf_image - link to an image desc "Wiki DMSF image:\n\n" + "{{dmsf_image(file_id)}}\n" + - "{{dmsf_image(file_id, size=300)}} -- with custom title and size\n" + - "{{dmsf_image(file_id, height=300)}} -- with custom title and height (auto width)\n" + - "{{dmsf_image(file_id, width=300)}} -- with custom title and width (auto height)\n" + - "{{dmsf_image(file_id, size=640x480)}}" + "{{dmsf_image(file_id, size=300)}} -- with and size 300x300\n" + + "{{dmsf_image(file_id, height=300)}} -- with height (auto width)\n" + + "{{dmsf_image(file_id, width=300)}} -- with width (auto height)\n" + + "{{dmsf_image(file_id, size=640x480)}} -- with and size 640x480" macro :dmsf_image do |obj, args| args, options = extract_macro_options(args, :size, :width, :height, :title) file_id = args.first @@ -179,11 +179,11 @@ Redmine::WikiFormatting::Macros.register do # dmsftn - link to an image thumbnail desc "Wiki DMSF thumbnail:\n\n" + - "{{dmsftn(file_id)}}\n" + - "{{dmsftn(file_id, size=300)}} -- with custom title and size\n" + - "{{dmsftn(file_id, height=300)}} -- with custom title and height (auto width)\n" + - "{{dmsftn(file_id, width=300)}} -- with custom title and width (auto height)\n" + - "{{dmsftn(file_id, size=640x480)}}" + "{{dmsftn(file_id)}} -- with default height 200(auto width)\n" + + "{{dmsftn(file_id, size=300)}} -- with size 300x300\n" + + "{{dmsftn(file_id, height=300)}} -- with height (auto width)\n" + + "{{dmsftn(file_id, width=300)}} -- with width (auto height)\n" + + "{{dmsftn(file_id, size=640x480)}} -- with and size 640x480" macro :dmsftn do |obj, args| args, options = extract_macro_options(args, :size, :width, :height, :title) file_id = args.first @@ -217,7 +217,7 @@ Redmine::WikiFormatting::Macros.register do end # dmsfw - link to a document's approval workflow status - desc "Wiki link to DMSF document's approval workflow status:\n\n" + + desc "Text referring to DMSF document's approval workflow status:\n\n" + "{{dmsfw(file_id)}}\n\n" + "_file_id_ can be found in the document's details." macro :dmsfw do |obj, args| diff --git a/lib/redmine_dmsf/patches/attachable_patch.rb b/lib/redmine_dmsf/patches/attachable_patch.rb index a4376a63..c1f77bd3 100644 --- a/lib/redmine_dmsf/patches/attachable_patch.rb +++ b/lib/redmine_dmsf/patches/attachable_patch.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/patches/easy_crm_case_patch.rb b/lib/redmine_dmsf/patches/easy_crm_case_patch.rb index bd269b18..589f9750 100644 --- a/lib/redmine_dmsf/patches/easy_crm_case_patch.rb +++ b/lib/redmine_dmsf/patches/easy_crm_case_patch.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -98,7 +98,7 @@ module RedmineDmsf end def system_folder(create = false) - parent = DmsfFolder.system.where(project_id: self.project_id, title: '.CRM cases').first + parent = DmsfFolder.issystem.find_by(project_id: self.project_id, title: '.CRM cases') if create && !parent parent = DmsfFolder.new parent.project_id = self.project_id @@ -109,7 +109,7 @@ module RedmineDmsf parent.save end if parent - folder = DmsfFolder.system.where(['project_id = ? AND dmsf_folder_id = ? AND CAST(title AS DECIMAL) = ?', + folder = DmsfFolder.system.where(["project_id = ? AND dmsf_folder_id = ? AND title LIKE '? - %'", self.project_id, parent.id, self.id]).first if create && !folder folder = DmsfFolder.new diff --git a/lib/redmine_dmsf/patches/easy_crm_cases_controller_patch.rb b/lib/redmine_dmsf/patches/easy_crm_cases_controller_patch.rb index 19669d58..fff0365d 100644 --- a/lib/redmine_dmsf/patches/easy_crm_cases_controller_patch.rb +++ b/lib/redmine_dmsf/patches/easy_crm_cases_controller_patch.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -32,7 +32,7 @@ module RedmineDmsf easy_crm_cases.each do |easy_crm_case| # Attach DMS documents uploaded_files = params[:dmsf_attachments] - if uploaded_files && uploaded_files.is_a?(Hash) + if uploaded_files system_folder = easy_crm_case.system_folder(true) uploaded_files.each do |key, uploaded_file| upload = DmsfUpload.create_from_uploaded_attachment(easy_crm_case.project, system_folder, uploaded_file) diff --git a/lib/redmine_dmsf/patches/issue_patch.rb b/lib/redmine_dmsf/patches/issue_patch.rb index 72ebfb82..0a044203 100644 --- a/lib/redmine_dmsf/patches/issue_patch.rb +++ b/lib/redmine_dmsf/patches/issue_patch.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -93,7 +93,7 @@ module RedmineDmsf def main_system_folder(create = false, prj_id = nil) prj_id ||= self.project_id - parent = DmsfFolder.system.find_by(project_id: prj_id, title: '.Issues') + parent = DmsfFolder.issystem.find_by(project_id: prj_id, title: '.Issues') if create && !parent parent = DmsfFolder.new parent.project_id = prj_id @@ -110,7 +110,7 @@ module RedmineDmsf prj_id ||= self.project_id parent = main_system_folder(create, prj_id) if parent - folder = DmsfFolder.system.where(["project_id = ? AND dmsf_folder_id = ? AND title LIKE '? - %'", + folder = DmsfFolder.issystem.where(["project_id = ? AND dmsf_folder_id = ? AND title LIKE '? - %'", prj_id, parent.id, self.id]).first if create && !folder folder = DmsfFolder.new diff --git a/lib/redmine_dmsf/patches/project_patch.rb b/lib/redmine_dmsf/patches/project_patch.rb index 52679710..b2a0f77c 100644 --- a/lib/redmine_dmsf/patches/project_patch.rb +++ b/lib/redmine_dmsf/patches/project_patch.rb @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/patches/projects_helper_patch.rb b/lib/redmine_dmsf/patches/projects_helper_patch.rb index 5105a784..9913c4a1 100644 --- a/lib/redmine_dmsf/patches/projects_helper_patch.rb +++ b/lib/redmine_dmsf/patches/projects_helper_patch.rb @@ -2,7 +2,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -45,6 +45,5 @@ if Redmine::Plugin.installed?(:easy_extensions) RedmineExtensions::PatchManager.register_helper_patch 'ProjectsHelper', 'RedmineDmsf::Patches::ProjectHelperPatch', prepend: true else - RedmineExtensions::PatchManager.register_patch_to_be_first 'ProjectsHelper', - 'RedmineDmsf::Patches::ProjectHelperPatch', prepend: true, first: true + ProjectsController.send :helper, RedmineDmsf::Patches::ProjectHelperPatch end \ No newline at end of file diff --git a/lib/redmine_dmsf/patches/role_patch.rb b/lib/redmine_dmsf/patches/role_patch.rb index cd0ab8b4..f1544176 100644 --- a/lib/redmine_dmsf/patches/role_patch.rb +++ b/lib/redmine_dmsf/patches/role_patch.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/patches/user_patch.rb b/lib/redmine_dmsf/patches/user_patch.rb index 666c0cd4..46b8cb23 100644 --- a/lib/redmine_dmsf/patches/user_patch.rb +++ b/lib/redmine_dmsf/patches/user_patch.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/patches/user_preference_patch.rb b/lib/redmine_dmsf/patches/user_preference_patch.rb index 1447f70d..f4a4ec95 100644 --- a/lib/redmine_dmsf/patches/user_preference_patch.rb +++ b/lib/redmine_dmsf/patches/user_preference_patch.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/test/integration_test.rb b/lib/redmine_dmsf/test/integration_test.rb index 57b73e47..b933df66 100644 --- a/lib/redmine_dmsf/test/integration_test.rb +++ b/lib/redmine_dmsf/test/integration_test.rb @@ -3,7 +3,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/test/test_case.rb b/lib/redmine_dmsf/test/test_case.rb index e07ea1aa..85b1cd56 100644 --- a/lib/redmine_dmsf/test/test_case.rb +++ b/lib/redmine_dmsf/test/test_case.rb @@ -34,9 +34,17 @@ module RedmineDmsf end super(table_names) end - + def setup - @request = ActionController::TestRequest.new + if ::Rails::VERSION::MAJOR >= 5 + if ::Rails::VERSION::MINOR >= 1 + @request = ActionController::TestRequest.create(self.class.controller_class) + else + @request = ActionController::TestRequest.create + end + else + @request = ActionController::TestRequest.new + end @response = ActionController::TestResponse.new end diff --git a/lib/redmine_dmsf/test/unit_test.rb b/lib/redmine_dmsf/test/unit_test.rb index ae7a2739..5d98cd48 100644 --- a/lib/redmine_dmsf/test/unit_test.rb +++ b/lib/redmine_dmsf/test/unit_test.rb @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -20,12 +20,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# Load the normal Rails helper -#require File.expand_path("#{Rails.root}/test/test_helper") - -# Use fixtures from redmine -#ActiveSupport::TestCase.fixture_path = "#{Rails.root}/test/fixtures" - module RedmineDmsf module Test class UnitTest < ActiveSupport::TestCase diff --git a/lib/redmine_dmsf/webdav/base_resource.rb b/lib/redmine_dmsf/webdav/base_resource.rb index 0bd8f1df..3395fbed 100644 --- a/lib/redmine_dmsf/webdav/base_resource.rb +++ b/lib/redmine_dmsf/webdav/base_resource.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/webdav/custom_middleware.rb b/lib/redmine_dmsf/webdav/custom_middleware.rb index be81c422..d4619581 100644 --- a/lib/redmine_dmsf/webdav/custom_middleware.rb +++ b/lib/redmine_dmsf/webdav/custom_middleware.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/webdav/dmsf_resource.rb b/lib/redmine_dmsf/webdav/dmsf_resource.rb index ba38136d..a43b9806 100644 --- a/lib/redmine_dmsf/webdav/dmsf_resource.rb +++ b/lib/redmine_dmsf/webdav/dmsf_resource.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -199,10 +199,7 @@ module RedmineDmsf destroy = false end if file.delete(destroy) - recipients = DmsfMailer.get_notify_users(project, [file]) - recipients.each do |u| - DmsfMailer.files_deleted(u, project, [file]).deliver - end + DmsfMailer.deliver_files_deleted(project, [file]) NoContent else Conflict @@ -599,10 +596,7 @@ module RedmineDmsf new_revision.create_digest new_revision.save # Notifications - recipients = DmsfMailer.get_notify_users(project, [f]) - recipients.each do |u| - DmsfMailer.files_updated(u, project, [f]).deliver - end + DmsfMailer.deliver_files_updated(project, [f]) else raise InternalServerError end diff --git a/lib/redmine_dmsf/webdav/index_resource.rb b/lib/redmine_dmsf/webdav/index_resource.rb index 3de6e450..6883f61d 100644 --- a/lib/redmine_dmsf/webdav/index_resource.rb +++ b/lib/redmine_dmsf/webdav/index_resource.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/webdav/project_resource.rb b/lib/redmine_dmsf/webdav/project_resource.rb index 93201e1e..cf0989fa 100644 --- a/lib/redmine_dmsf/webdav/project_resource.rb +++ b/lib/redmine_dmsf/webdav/project_resource.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/redmine_dmsf/webdav/resource_proxy.rb b/lib/redmine_dmsf/webdav/resource_proxy.rb index 71ec0d14..d9ab5722 100644 --- a/lib/redmine_dmsf/webdav/resource_proxy.rb +++ b/lib/redmine_dmsf/webdav/resource_proxy.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/tasks/dmsf_alert_approvals.rake b/lib/tasks/dmsf_alert_approvals.rake index d6a80874..1925be10 100644 --- a/lib/tasks/dmsf_alert_approvals.rake +++ b/lib/tasks/dmsf_alert_approvals.rake @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -49,13 +49,13 @@ class DmsfAlertApprovals if dry_run puts "#{assignment.user.name} <#{assignment.user.mail}>" else - DmsfMailer.workflow_notification( - assignment.user, + DmsfMailer.deliver_workflow_notification( + [assignment.user], workflow, revision, :text_email_subject_requires_approval, :text_email_finished_step, - :text_email_to_proceed).deliver + :text_email_to_proceed) end end end diff --git a/lib/tasks/dmsf_convert_documents.rake b/lib/tasks/dmsf_convert_documents.rake index f9f6b206..ea6b565f 100644 --- a/lib/tasks/dmsf_convert_documents.rake +++ b/lib/tasks/dmsf_convert_documents.rake @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2011 Vít Jonáš -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/tasks/dmsf_create_digests.rake b/lib/tasks/dmsf_create_digests.rake index bc55f392..95f88a15 100644 --- a/lib/tasks/dmsf_create_digests.rake +++ b/lib/tasks/dmsf_create_digests.rake @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/lib/tasks/dmsf_maintenance.rake b/lib/tasks/dmsf_maintenance.rake index 73654654..69183d35 100644 --- a/lib/tasks/dmsf_maintenance.rake +++ b/lib/tasks/dmsf_maintenance.rake @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/test/ci/redmine_install.sh b/test/ci/redmine_install.sh index 5f6104c3..da85a5a5 100644 --- a/test/ci/redmine_install.sh +++ b/test/ci/redmine_install.sh @@ -4,7 +4,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -21,7 +21,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. export REDMINE_GIT_REPO=git://github.com/redmine/redmine.git -export REDMINE_GIT_TAG=3.4-stable +export REDMINE_GIT_TAG=4.0-stable clone() { diff --git a/test/fixtures/custom_fields.yml b/test/fixtures/custom_fields.yml index d9cdb6d1..e8ffe537 100644 --- a/test/fixtures/custom_fields.yml +++ b/test/fixtures/custom_fields.yml @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/test/fixtures/custom_values.yml b/test/fixtures/custom_values.yml index d276b12e..8ec518dd 100644 --- a/test/fixtures/custom_values.yml +++ b/test/fixtures/custom_values.yml @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/test/functional/dmsf_context_menus_controller_test.rb b/test/functional/dmsf_context_menus_controller_test.rb index f6791c21..cb3e8d31 100644 --- a/test/functional/dmsf_context_menus_controller_test.rb +++ b/test/functional/dmsf_context_menus_controller_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -44,7 +44,7 @@ class DmsfContextMenusControllerTest < RedmineDmsf::Test::TestCase end def test_dmsf - get :dmsf, :id => @project1.id, :ids => ["file-#{@file1.id}"] + get :dmsf, :params => {:id => @project1.id, :ids => ["file-#{@file1.id}"]} assert_response :success assert_select 'a.icon-edit', :text => l(:button_edit) assert_select 'a.icon-del', :text => l(:button_delete) @@ -53,7 +53,7 @@ class DmsfContextMenusControllerTest < RedmineDmsf::Test::TestCase end def test_dmsf_no_edit - get :dmsf, :id => @project1.id, :ids => ["folder-#{@folder1.id}"] + get :dmsf, :params => {:id => @project1.id, :ids => ["folder-#{@folder1.id}"]} assert_response :success assert_select 'a.icon-edit', :text => l(:button_edit), :count => 0 assert_select 'a.icon-del', :text => l(:button_delete) @@ -62,7 +62,7 @@ class DmsfContextMenusControllerTest < RedmineDmsf::Test::TestCase end def test_trash - get :trash, :id => @project1.id, :ids => ["file-#{@file1.id}"] + get :trash, :params => {:id => @project1.id, :ids => ["file-#{@file1.id}"]} assert_response :success assert_select 'a.icon-cancel', :text => l(:title_restore) assert_select 'a.icon-del', :text => l(:button_delete) diff --git a/test/functional/dmsf_controller_test.rb b/test/functional/dmsf_controller_test.rb index 54660699..b9fce110 100644 --- a/test/functional/dmsf_controller_test.rb +++ b/test/functional/dmsf_controller_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -33,6 +33,7 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase @folder1 = DmsfFolder.find 1 @folder2 = DmsfFolder.find 2 @folder4 = DmsfFolder.find 4 + @folder7 = DmsfFolder.find 7 @file1 = DmsfFile.find 1 @file_link2 = DmsfLink.find 4 @folder_link1 = DmsfLink.find 1 @@ -63,6 +64,7 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase assert_kind_of DmsfFolder, @folder1 assert_kind_of DmsfFolder, @folder2 assert_kind_of DmsfFolder, @folder4 + assert_kind_of DmsfFolder, @folder7 assert_kind_of DmsfFile, @file1 assert_kind_of DmsfLink, @file_link2 assert_kind_of DmsfLink, @folder_link1 @@ -74,7 +76,7 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase def test_edit_folder_forbidden # Missing permissions - get :edit, :id => @project, :folder_id => @folder1 + get :edit, :params => {:id => @project, :folder_id => @folder1} assert_response :forbidden end @@ -82,7 +84,7 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase # Permissions OK @role.add_permission! :view_dmsf_folders @role.add_permission! :folder_manipulation - get :edit, :id => @project, :folder_id => @folder1 + get :edit, :params => {:id => @project, :folder_id => @folder1} assert_response :success assert_select 'label', { :text => @custom_field.name } assert_select 'option', { :value => @custom_value.value } @@ -90,44 +92,44 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase def test_trash_forbidden # Missing permissions - get :trash, :id => @project + get :trash, :params => {:id => @project} assert_response :forbidden end def test_trash_allowed # Permissions OK @role.add_permission! :file_delete - get :trash, :id => @project + get :trash, :params => {:id => @project} assert_response :success assert_select 'h2', { :text => l(:link_trash_bin) } end def test_delete_forbidden # Missing permissions - get :delete, :id => @project, :folder_id => @folder1.id, :commit => false + get :delete, :params => {:id => @project, :folder_id => @folder1.id, :commit => false} assert_response :forbidden end def test_delete_not_empty # Permissions OK but the folder is not empty @role.add_permission! :folder_manipulation - get :delete, :id => @project, :folder_id => @folder1.id, :commit => false + get :delete, :params => {:id => @project, :folder_id => @folder1.id, :commit => false} assert_response :redirect - assert_include l(:error_folder_is_not_empty), flash[:error] + assert_include l(:error_folder_is_not_empty), flash[:errors] end def test_delete_locked # Permissions OK but the folder is locked @role.add_permission! :folder_manipulation - get :delete, :id => @project, :folder_id => @folder2.id, :commit => false + get :delete, :params => {:id => @project, :folder_id => @folder2.id, :commit => false} assert_response :redirect - assert_include l(:error_folder_is_locked), flash[:error] + assert_include l(:error_folder_is_locked), flash[:errors] end def test_delete_ok # Empty and not locked folder @role.add_permission! :folder_manipulation - get :delete, :id => @project, :folder_id => @folder4.id, :commit => false + get :delete, :params => {:id => @project, :folder_id => @folder4.id, :commit => false} assert_response :redirect end @@ -135,7 +137,7 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase # Missing permissions @folder4.deleted = 1 @folder4.save - get :restore, :id => @project, :folder_id => @folder4.id + get :restore, :params => {:id => @project, :folder_id => @folder4.id} assert_response :forbidden end @@ -145,52 +147,54 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase @role.add_permission! :folder_manipulation @folder4.deleted = 1 @folder4.save - get :restore, :id => @project, :folder_id => @folder4.id + get :restore, :params => {:id => @project, :folder_id => @folder4.id} assert_response :redirect end - def test_delete_restore_entries_forbidden + def test_delete_entries_forbidden # Missing permissions - get :entries_operation, :id => @project, :delete_entries => 'Delete', - :ids => ["folder-#{@folder1.id}", "file-#{@file1.id}", "folder-link-#{@folder_link1.id}", "file-link-#{@file_link2.id}"] + get :entries_operation, :params => {:id => @project, :delete_entries => 'Delete', + :ids => ["folder-#{@folder1.id}", "file-#{@file1.id}", "folder-link-#{@folder_link1.id}", "file-link-#{@file_link2.id}"]} assert_response :forbidden end - def test_delete_restore_not_empty + def test_delete_not_empty # Permissions OK but the folder is not empty @request.env['HTTP_REFERER'] = dmsf_folder_path(:id => @project.id) + @role.add_permission! :folder_manipulation @role.add_permission! :view_dmsf_files - get :entries_operation, :id => @project, :delete_entries => 'Delete', - :ids => ["folder-#{@folder1.id}", "file-#{@file1.id}", "folder-link-#{@folder_link1.id}", "file-link-#{@file_link2.id}"] + get :entries_operation, :params => {:id => @project, :delete_entries => 'Delete', + :ids => ["folder-#{@folder1.id}", "file-#{@file1.id}", "folder-link-#{@folder_link1.id}", "file-link-#{@file_link2.id}"]} assert_response :redirect - assert_equal flash[:error].to_s, l(:error_folder_is_not_empty) + assert_equal flash[:errors].to_s, l(:error_folder_is_not_empty) end - def test_delete_restore_entries_ok + def test_delete_entries_ok # Permissions OK @request.env['HTTP_REFERER'] = dmsf_folder_path(:id => @project.id) @role.add_permission! :view_dmsf_files - flash[:error] = nil - get :entries_operation, :id => @project, :delete_entries => 'Delete', - :ids => ["file-#{@file1.id}", "file-link-#{@file_link2.id}"] + @role.add_permission! :folder_manipulation + flash[:errors] = nil + get :entries_operation, :params => {:id => @project, :delete_entries => 'Delete', + :ids => ["folder-#{@folder7.id}", "file-#{@file1.id}", "file-link-#{@file_link2.id}"]} assert_response :redirect - assert_nil flash[:error] + assert_nil flash[:errors] end def test_restore_entries # Restore @role.add_permission! :view_dmsf_files @request.env['HTTP_REFERER'] = trash_dmsf_path(:id => @project.id) - get :entries_operation, :id => @project, :restore_entries => 'Restore', - :ids => ["file-#{@file1.id}", "file-link-#{@file_link2.id}"] + get :entries_operation, :params => {:id => @project, :restore_entries => 'Restore', + :ids => ["file-#{@file1.id}", "file-link-#{@file_link2.id}"]} assert_response :redirect - assert_nil flash[:error] + assert_nil flash[:errors] end def test_show @role.add_permission! :view_dmsf_files @role.add_permission! :view_dmsf_folders - get :show, :id => @project.id + get :show, :params => {:id => @project.id} assert_response :success assert_select 'tr.dmsf_tree', :count => 0 end @@ -198,7 +202,7 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase def test_show_tag @role.add_permission! :view_dmsf_files @role.add_permission! :view_dmsf_folders - get :show, :id => @project.id, :custom_field_id => 21, :custom_value => 'Technical documentation' + get :show, :params => {:id => @project.id, :custom_field_id => 21, :custom_value => 'Technical documentation'} assert_response :success assert_select 'tr.dmsf_tree', :count => 0 end @@ -208,7 +212,7 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase @role.add_permission! :view_dmsf_folders @manager.pref[:dmsf_tree_view] = '1' @manager.preference.save - get :show, :id => @project.id + get :show, :params => {:id => @project.id} assert_response :success assert_select 'tr.dmsf_tree' end @@ -216,27 +220,27 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase def test_show_csv @role.add_permission! :view_dmsf_files @role.add_permission! :view_dmsf_folders - get :show, id: @project.id, format: 'csv', :settings => { dmsf_columns: %w(id title) } + get :show, :params => {id: @project.id, format: 'csv', :settings => { dmsf_columns: %w(id title) }} assert_response :success assert_equal 'text/csv; header=present', @response.content_type end def test_new_forbidden @role.remove_permission! :folder_manipulation - get :new, :id => @project, :parent_id => nil + get :new, :params => {:id => @project, :parent_id => nil} assert_response :forbidden end def test_new @role.add_permission! :folder_manipulation - get :new, :id => @project, :parent_id => nil + get :new, :params => {:id => @project, :parent_id => nil} assert_response :success end def test_email_entries_email_from Setting.plugin_redmine_dmsf['dmsf_documents_email_from'] = 'karel.picman@kontron.com' @role.add_permission! :view_dmsf_files - get :entries_operation, :id => @project, :email_entries => 'Email', :ids => ["file-#{@file1.id}"] + get :entries_operation, :params => {:id => @project, :email_entries => 'Email', :ids => ["file-#{@file1.id}"]} assert_response :success assert_select "input:match('value', ?)", Setting.plugin_redmine_dmsf['dmsf_documents_email_from'] end @@ -244,49 +248,66 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase def test_email_entries_reply_to Setting.plugin_redmine_dmsf['dmsf_documents_email_reply_to'] = 'karel.picman@kontron.com' @role.add_permission! :view_dmsf_files - get :entries_operation, :id => @project, :email_entries => 'Email', :ids => ["file-#{@file1.id}"] + get :entries_operation, :params => {:id => @project, :email_entries => 'Email', :ids => ["file-#{@file1.id}"]} assert_response :success assert_select "input:match('value', ?)", Setting.plugin_redmine_dmsf['dmsf_documents_email_reply_to'] end def test_email_entries_links_only - Setting.plugin_redmine_dmsf['dmsf_documents_email_links_only'] = true + Setting.plugin_redmine_dmsf['dmsf_documents_email_links_only'] = '1' @role.add_permission! :view_dmsf_files - get :entries_operation, :id => @project, :email_entries => 'Email', :ids => ["file-#{@file1.id}"] + get :entries_operation, :params => {:id => @project, :email_entries => 'Email', :ids => ["file-#{@file1.id}"]} assert_response :success assert_select "input:match('value', ?)", Setting.plugin_redmine_dmsf['dmsf_documents_email_links_only'] end + def test_entries_email + @role.add_permission! :view_dmsf_files + zip_file_path = DmsfHelper.temp_dir.join(DmsfHelper.temp_filename('dmsf_email_sent_documents.zip')) + FileUtils.touch(zip_file_path) + assert File.exist?(zip_file_path) + get :entries_email, :params => {:id => @project, :email => + { + :to => 'to@test.com', :from => 'from@test.com', :subject => 'subject', :body => 'body', :expired_at => '2015-01-01', + :folders => [], :files => [@file1.id], :zipped_content => zip_file_path + } + } + assert_redirected_to dmsf_folder_path(:id => @project) + assert !File.exist?(zip_file_path) + ensure + FileUtils.rm_rf(zip_file_path) + end + def test_add_email_forbidden - xhr :get, :add_email, id: @project.id + get :add_email, :params => {id: @project.id}, :xhr => true assert_response :forbidden end def test_add_email @role.add_permission! :view_dmsf_files - xhr :get, :add_email, id: @project.id + get :add_email, :params => {id: @project.id}, :xhr => true assert_response :success end def test_append_email_forbidden - post :append_email, :id => @project, :user_ids => @project.members.collect{ |m| m.user.id }, :format => 'js' + post :append_email, :params => {:id => @project, :user_ids => @project.members.collect{ |m| m.user.id }, :format => 'js'} assert_response :forbidden end def test_append_email @role.add_permission! :view_dmsf_files - post :append_email, :id => @project, :user_ids => @project.members.collect{ |m| m.user.id }, :format => 'js' + post :append_email, :params => {:id => @project, :user_ids => @project.members.collect{ |m| m.user.id }, :format => 'js'} assert_response :success end def test_autocomplete_for_user_forbidden - xhr :get, :autocomplete_for_user, id: @project.id + get :autocomplete_for_user, :params => {id: @project.id}, :xhr => true assert_response :forbidden end def test_autocomplete_for_user @role.add_permission! :view_dmsf_files - xhr :get, :autocomplete_for_user, id: @project + get :autocomplete_for_user, :params => {id: @project}, :xhr => true assert_response :success end @@ -294,10 +315,10 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase @role.add_permission! :folder_manipulation @role.add_permission! :view_dmsf_folders assert_difference 'DmsfFolder.count', +1 do - post :create, :id => @project.id, :dmsf_folder => { + post :create, :params => {:id => @project.id, :dmsf_folder => { :title => 'New folder', :description => 'Unit tests' - } + }} end assert_redirected_to dmsf_folder_path(:id => @project, :folder_id => nil) end @@ -306,10 +327,10 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase @role.add_permission! :folder_manipulation @role.add_permission! :view_dmsf_folders assert_difference 'DmsfFolder.count', +1 do - post :create, :id => @project.id, :parent_id => @folder1.id, :dmsf_folder => { + post :create, :params => {:id => @project.id, :parent_id => @folder1.id, :dmsf_folder => { :title => 'New folder', :description => 'Unit tests' - } + }} end assert_redirected_to dmsf_folder_path(:id => @project, :folder_id => @folder1) end diff --git a/test/functional/dmsf_files_controller_test.rb b/test/functional/dmsf_files_controller_test.rb index 84f20bcf..1f0c6c99 100644 --- a/test/functional/dmsf_files_controller_test.rb +++ b/test/functional/dmsf_files_controller_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -57,60 +57,60 @@ class DmsfFilesControllerTest < RedmineDmsf::Test::TestCase def test_show_file_ok # Permissions OK @role.add_permission! :view_dmsf_files - get :show, :id => @file.id + get :show, :params => {:id => @file.id} assert_response :success end def test_show_file_forbidden # Missing permissions - get :show, :id => @file.id + get :show, :params => {:id => @file.id} assert_response :forbidden end def test_view_file_ok # Permissions OK @role.add_permission! :view_dmsf_files - get :view, :id => @file.id + get :view, :params => {:id => @file.id} assert_response :success end def test_view_file_forbidden # Missing permissions - get :view, :id => @file.id + get :view, :params => {:id => @file.id} assert_response :forbidden end def delete_forbidden # Missing permissions - delete @file, :commit => false + delete @file, :params => {:commit => false} assert_response :forbidden end def delete_locked # Permissions OK but the file is locked @role.add_permission! :file_delete - delete @file, :commit => false + delete @file, :params => {:commit => false} assert_response :redirect - assert_include l(:error_file_is_locked), flash[:error] + assert_include l(:error_file_is_locked), flash[:errors] end def delete_ok # Permissions OK and not locked - flash[:error].clear + flash[:errors].clear @file.unlock! - delete @file, :commit => false + delete @file, :params => {:commit => false} assert_response :redirect - assert_equal 0, flash[:error].size + assert_equal 0, flash[:errors].size end def test_obsolete_revision_ok @role.add_permission! :file_manipulation - get :obsolete_revision, :id => @file.last_revision.id + get :obsolete_revision, :params => {:id => @file.last_revision.id} assert_redirected_to :action => 'show', :id => @file end def test_obsolete_revision_missing_permissions - get :obsolete_revision, :id => @file.last_revision.id + get :obsolete_revision, :params => {:id => @file.last_revision.id} assert :forbiden end diff --git a/test/functional/dmsf_files_copy_controller_test.rb b/test/functional/dmsf_files_copy_controller_test.rb index c01619e4..6e270a27 100644 --- a/test/functional/dmsf_files_copy_controller_test.rb +++ b/test/functional/dmsf_files_copy_controller_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -72,127 +72,127 @@ class DmsfFilesCopyControllerTest < RedmineDmsf::Test::TestCase def test_authorize_admin @request.session[:user_id] = @user_admin.id - get :new, :id => @file1.id + get :new, :params => {:id => @file1.id} assert_response :success assert_template 'new' end def test_authorize_non_member @request.session[:user_id] = @user_non_member.id - get :new, :id => @file1.id + get :new, :params => {:id => @file1.id} assert_response :forbidden end def test_authorize_member_no_module @project1.disable_module!(:dmsf) - get :new, :id => @file1.id + get :new, :params => {:id => @file1.id} assert_response :forbidden end def test_authorize_forbidden @role_manager.remove_permission! :file_manipulation - get :new, :id => @file1.id + get :new, :params => {:id => @file1.id} assert_response :forbidden end def test_target_folder - get :new, :id => @file1.id, :target_folder_id => @folder1.id + get :new, :params => {:id => @file1.id, :target_folder_id => @folder1.id} assert_response :success assert_template 'new' end def test_target_folder_forbidden @role_manager.remove_permission! :view_dmsf_folders - get :new, :id => @file1.id, :target_folder_id => @folder1.id + get :new, :params => {:id => @file1.id, :target_folder_id => @folder1.id} assert_response :not_found end def test_target_project - get :new, :id => @file1.id, :target_project_id => @project1.id + get :new, :params => {:id => @file1.id, :target_project_id => @project1.id} assert_response :success assert_template 'new' end def test_new - get :new, :id => @file1.id + get :new, :params => {:id => @file1.id} assert_response :success assert_template 'new' end def test_copy - post :copy, :id => @file1.id, :target_project_id => @project1.id, :target_folder_id => @folder1.id + post :copy, :params => {:id => @file1.id, :target_project_id => @project1.id, :target_folder_id => @folder1.id} assert_response :redirect - assert_nil flash[:error] + assert_nil flash[:errors] end def test_copy_the_same_target - post :copy, :id => @file1.id, :target_project_id => @file1.project.id, :target_folder_id => @file1.dmsf_folder - assert_equal flash[:error], l(:error_target_folder_same) + post :copy, :params => {:id => @file1.id, :target_project_id => @file1.project.id, :target_folder_id => @file1.dmsf_folder} + assert_equal flash[:errors], l(:error_target_folder_same) assert_redirected_to :action => 'new', :target_project_id => @file1.project.id, :target_folder_id => @file1.dmsf_folder end def test_copy_to_locked_folder @folder1.lock! - post :copy, :id => @file1.id, :target_project_id => @file1.project.id, :target_folder_id => @folder1.id + post :copy, :params => {:id => @file1.id, :target_project_id => @file1.project.id, :target_folder_id => @folder1.id} assert_response :forbidden end def test_copy_to_dmsf_not_enabled - post :copy, :id => @file1.id, :target_project_id => @project5.id, :target_folder_id => nil + post :copy, :params => {:id => @file1.id, :target_project_id => @project5.id, :target_folder_id => nil} assert_response :forbidden end def test_copy_to_dmsf_enabled @project5.enable_module!(:dmsf) - post :copy, :id => @file1.id, :target_project_id => @project5.id, :target_folder_id => nil + post :copy, :params => {:id => @file1.id, :target_project_id => @project5.id, :target_folder_id => nil} assert_response :redirect - assert_nil flash[:error] + assert_nil flash[:errors] end def test_copy_to_as_non_member - post :copy, :id => @file1.id, :target_project_id => @project2.id, :target_folder_id => nil + post :copy, :params => {:id => @file1.id, :target_project_id => @project2.id, :target_folder_id => nil} assert_response :forbidden end def test_move - post :move, :id => @file1.id, :target_project_id => @project1.id, :target_folder_id => @folder1.id + post :move, :params => {:id => @file1.id, :target_project_id => @project1.id, :target_folder_id => @folder1.id} assert_response :redirect - assert_nil flash[:error] + assert_nil flash[:errors] end def test_move_the_same_target - post :move, :id => @file1.id, :target_project_id => @file1.project.id, :target_folder_id => @file1.dmsf_folder - assert_equal flash[:error], l(:error_target_folder_same) + post :move, :params => {:id => @file1.id, :target_project_id => @file1.project.id, :target_folder_id => @file1.dmsf_folder} + assert_equal flash[:errors], l(:error_target_folder_same) assert_redirected_to :action => 'new', :target_project_id => @file1.project.id, :target_folder_id => @file1.dmsf_folder end def test_move_to_locked @file1.lock! - post :move, :id => @file1.id, :target_project_id => @file1.project.id, :target_folder_id => @folder1.id + post :move, :params => {:id => @file1.id, :target_project_id => @file1.project.id, :target_folder_id => @folder1.id} assert_response :redirect - assert_equal l(:error_file_is_locked), flash[:error] + assert_equal l(:error_file_is_locked), flash[:errors] end def test_move_to_locked_folder @folder1.lock! - post :move, :id => @file1.id, :target_project_id => @file1.project.id, :target_folder_id => @folder1.id + post :move, :params => {:id => @file1.id, :target_project_id => @file1.project.id, :target_folder_id => @folder1.id} assert_response :forbidden end def test_move_to_dmsf_not_enabled - post :move, :id => @file1.id, :target_project_id => @project5.id, :target_folder_id => nil + post :move, :params => {:id => @file1.id, :target_project_id => @project5.id, :target_folder_id => nil} assert_response :forbidden end def test_move_to_dmsf_enabled @project5.enable_module!(:dmsf) - post :move, :id => @file1.id, :target_project_id => @project5.id, :target_folder_id => nil + post :move, :params => {:id => @file1.id, :target_project_id => @project5.id, :target_folder_id => nil} assert_response :redirect - assert_nil flash[:error] + assert_nil flash[:errors] end def test_move_to_as_non_member - post :move, :id => @file1.id, :target_project_id => @project2.id, :target_folder_id => nil + post :move, :params => {:id => @file1.id, :target_project_id => @project2.id, :target_folder_id => nil} assert_response :forbidden end diff --git a/test/functional/dmsf_folder_permissions_controller_test.rb b/test/functional/dmsf_folder_permissions_controller_test.rb index 46eba14a..e54589bb 100644 --- a/test/functional/dmsf_folder_permissions_controller_test.rb +++ b/test/functional/dmsf_folder_permissions_controller_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -46,20 +46,22 @@ class DmsfFolderPermissionsControllerTest < RedmineDmsf::Test::TestCase end def test_new - xhr :get, :new, :project_id => @project1, :format => 'js' + get :new, params: { project_id: @project1, dmsf_folder_id: @folder7, format: 'js'}, xhr: true assert_response :success assert_template 'new' assert_equal 'text/javascript', response.content_type end def test_autocomplete_for_user - xhr :get, :autocomplete_for_user, :project_id => @project1, :q => 'smi', :format => 'js' + get :autocomplete_for_user, params: { project_id: @project1, dmsf_folder_id: @folder7, q: 'smi', format: 'js'}, + xhr: true assert_response :success assert_include 'John Smith', response.body end def test_append - xhr :get, :new, :project_id => @project1, :user_ids => [@manager.id], :format => 'js' + get :new, params: { project_id: @project1, dmsf_folder_id: @folder7, user_ids: [@manager.id], format: 'js'}, + xhr: true assert_response :success assert_template 'new' assert_equal 'text/javascript', response.content_type diff --git a/test/functional/dmsf_folders_copy_controller_test.rb b/test/functional/dmsf_folders_copy_controller_test.rb index 25eb6c0c..9fc14159 100644 --- a/test/functional/dmsf_folders_copy_controller_test.rb +++ b/test/functional/dmsf_folders_copy_controller_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -73,66 +73,66 @@ class DmsfFoldersCopyControllerTest < RedmineDmsf::Test::TestCase def test_authorize_admin @request.session[:user_id] = @user_admin.id - get :new, :id => @folder1.id + get :new, :params => {:id => @folder1.id} assert_response :success assert_template 'new' end def test_authorize_non_member @request.session[:user_id] = @user_non_member.id - get :new, :id => @folder1.id + get :new, :params => {:id => @folder1.id} assert_response :forbidden end def test_authorize_member_no_module @project1.disable_module!(:dmsf) - get :new, :id => @folder1.id + get :new, :params => {:id => @folder1.id} assert_response :forbidden end def test_authorize_forbidden @role_manager.remove_permission! :folder_manipulation - get :new, :id => @folder1.id + get :new, :params => {:id => @folder1.id} assert_response :forbidden end def test_target_folder - get :new, :id => @folder1.id, :target_folder_id => @folder2.id + get :new, :params => {:id => @folder1.id, :target_folder_id => @folder2.id} assert_response :success assert_template 'new' end def test_target_folder_forbidden @role_manager.remove_permission! :view_dmsf_folders - get :new, :id => @folder1.id, :target_folder_id => @folder2.id + get :new, :params => {:id => @folder1.id, :target_folder_id => @folder2.id} assert_response :forbidden end def test_target_project - get :new, :id => @folder1.id, :target_project_id => @project1.id + get :new, :params => {:id => @folder1.id, :target_project_id => @project1.id} assert_response :success assert_template 'new' end def test_new - get :new, :id => @folder1.id + get :new, :params => {:id => @folder1.id} assert_response :success assert_template 'new' end def test_copy - post :copy, :id => @folder1.id, :target_project_id => @project1.id, :target_folder_id => @folder6.id + post :copy, :params => {:id => @folder1.id, :target_project_id => @project1.id, :target_folder_id => @folder6.id} assert_response :redirect - assert_nil flash[:error] + assert_nil flash[:errors] end def test_copy_to_another_project @request.session[:user_id] = @user_admin.id @project2.enable_module!(:dmsf) assert_equal @project1.id, @folder1.project_id - post :copy, :id => @folder1.id, :target_project_id => @project2.id + post :copy, :params => {:id => @folder1.id, :target_project_id => @project2.id} assert_response :redirect - assert_nil flash[:error] + assert_nil flash[:errors] # Check all childs' project ID tree = DmsfHelper::all_children_sorted(@project2, 0, 0) tree.each do |f, pos| @@ -141,71 +141,71 @@ class DmsfFoldersCopyControllerTest < RedmineDmsf::Test::TestCase end def test_copy_the_same_target - post :copy, :id => @folder1.id, :target_project_id => @folder1.project.id, :target_folder_id => @folder1.dmsf_folder - assert_equal flash[:error], l(:error_target_folder_same) + post :copy, :params => {:id => @folder1.id, :target_project_id => @folder1.project.id, :target_folder_id => @folder1.dmsf_folder} + assert_equal flash[:errors], l(:error_target_folder_same) assert_redirected_to :action => 'new', :target_project_id => @folder1.project.id, :target_folder_id => @folder1.dmsf_folder end def test_copy_to_locked_folder - post :copy, :id => @folder1.id, :target_project_id => @folder1.project.id, :target_folder_id => @folder2.id + post :copy, :params => {:id => @folder1.id, :target_project_id => @folder1.project.id, :target_folder_id => @folder2.id} assert_response :forbidden end def test_copy_to_dmsf_not_enabled - post :copy, :id => @folder1.id, :target_project_id => @project5.id, :target_folder_id => nil + post :copy, :params => {:id => @folder1.id, :target_project_id => @project5.id, :target_folder_id => nil} assert_response :forbidden end def test_copy_to_dmsf_enabled @project5.enable_module!(:dmsf) - post :copy, :id => @folder1.id, :target_project_id => @project5.id, :target_folder_id => nil + post :copy, :params => {:id => @folder1.id, :target_project_id => @project5.id, :target_folder_id => nil} assert_response :redirect - assert_nil flash[:error] + assert_nil flash[:errors] end def test_copy_to_as_non_member - post :copy, :id => @folder1.id, :target_project_id => @project2.id, :target_folder_id => nil + post :copy, :params => {:id => @folder1.id, :target_project_id => @project2.id, :target_folder_id => nil} assert_response :forbidden end def test_move - post :move, :id => @folder1.id, :target_project_id => @project1.id, :target_folder_id => @folder6.id + post :move, :params => {:id => @folder1.id, :target_project_id => @project1.id, :target_folder_id => @folder6.id} assert_response :redirect - assert_nil flash[:error] + assert_nil flash[:errors] end def test_move_the_same_target - post :move, :id => @folder1.id, :target_project_id => @folder1.project.id, :target_folder_id => @folder1.dmsf_folder - assert_equal flash[:error], l(:error_target_folder_same) + post :move, :params => {:id => @folder1.id, :target_project_id => @folder1.project.id, :target_folder_id => @folder1.dmsf_folder} + assert_equal flash[:errors], l(:error_target_folder_same) assert_redirected_to :action => 'new', :target_project_id => @folder1.project.id, :target_folder_id => @folder1.dmsf_folder end def test_move_to_locked @folder1.lock! - post :move, :id => @folder1.id, :target_project_id => @folder1.project.id, :target_folder_id => @folder2.id + post :move, :params => {:id => @folder1.id, :target_project_id => @folder1.project.id, :target_folder_id => @folder2.id} assert_response :forbidden end def test_move_to_locked_folder - post :move, :id => @folder1.id, :target_project_id => @folder2.project.id, :target_folder_id => @folder2.id + post :move, :params => {:id => @folder1.id, :target_project_id => @folder2.project.id, :target_folder_id => @folder2.id} assert_response :forbidden end def test_move_to_dmsf_not_enabled - post :move, :id => @folder1.id, :target_project_id => @project5.id, :target_folder_id => nil + post :move, :params => {:id => @folder1.id, :target_project_id => @project5.id, :target_folder_id => nil} assert_response :forbidden end def test_move_to_dmsf_enabled @project5.enable_module!(:dmsf) - post :move, :id => @folder1.id, :target_project_id => @project5.id, :target_folder_id => nil + post :move, :params => {:id => @folder1.id, :target_project_id => @project5.id, :target_folder_id => nil} assert_response :redirect - assert_nil flash[:error] + assert_nil flash[:errors] end def test_move_to_as_non_member - post :move, :id => @folder1.id, :target_project_id => @project2.id, :target_folder_id => nil + post :move, :params => {:id => @folder1.id, :target_project_id => @project2.id, :target_folder_id => nil} assert_response :forbidden end @@ -213,9 +213,9 @@ class DmsfFoldersCopyControllerTest < RedmineDmsf::Test::TestCase @request.session[:user_id] = @user_admin.id @project2.enable_module!(:dmsf) assert_equal @project1.id, @folder1.project_id - post :move, :id => @folder1.id, :target_project_id => @project2.id + post :move, :params => {:id => @folder1.id, :target_project_id => @project2.id} assert_response :redirect - assert_nil flash[:error] + assert_nil flash[:errors] # Check all childs' project ID tree = DmsfHelper::all_children_sorted(@project2, 0, 0) tree.each do |f, pos| diff --git a/test/functional/dmsf_links_controller_test.rb b/test/functional/dmsf_links_controller_test.rb index 648408b7..43efa2f3 100644 --- a/test/functional/dmsf_links_controller_test.rb +++ b/test/functional/dmsf_links_controller_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -73,27 +73,27 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase def test_authorize_admin @request.session[:user_id] = @user_admin.id - get :new, :project_id => @project1.id + get :new, :params => {:project_id => @project1.id} assert_response :success assert_template 'new' end def test_authorize_non_member @request.session[:user_id] = @user_non_member.id - get :new, :project_id => @project2.id + get :new, :params => {:project_id => @project2.id} assert_response :forbidden end def test_authorize_member_ok @request.session[:user_id] = @user_member.id - get :new, :project_id => @project1.id + get :new, :params => {:project_id => @project1.id} assert_response :success end def test_authorize_member_no_module # Without the module @project1.disable_module!(:dmsf) - get :new, :project_id => @project1.id + get :new, :params => {:project_id => @project1.id} assert_response :forbidden end @@ -101,12 +101,12 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase # Without permissions @project1.enable_module!(:dmsf) @role_manager.remove_permission! :file_manipulation - get :new, :project_id => @project1.id + get :new, :params => {:project_id => @project1.id} assert_response :forbidden end def test_new - get :new, :project_id => @project1.id, :type => 'link_to' + get :new, :params => {:project_id => @project1.id, :type => 'link_to'} assert_response :success assert_select 'label', { :text => l(:label_target_project) } end @@ -115,7 +115,7 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase member = Member.where(:user_id => @user_member.id, :project_id => @project1.id).first assert member member.update_attribute :dmsf_fast_links, true - get :new, :project_id => @project1.id, :type => 'link_to' + get :new, :params => {:project_id => @project1.id, :type => 'link_to'} assert_response :success assert_select 'label', { :count => 0, :text => l(:label_target_project) } end @@ -123,7 +123,7 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase def test_create_file_link_from_f1 # 1. File link in a folder from another folder assert_difference 'DmsfLink.count', +1 do - post :create, :dmsf_link => { + post :create, :params => {:dmsf_link => { :project_id => @project1.id, :target_project_id => @project2.id, :dmsf_folder_id => @folder1.id, @@ -131,7 +131,7 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase :target_folder_id => @folder3.id, :name => 'file_link', :type => 'link_from' - } + }} end assert_redirected_to dmsf_folder_path(:id => @project1.id, :folder_id => @folder1.id) end @@ -139,7 +139,7 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase def test_create_file_link_from_f2 # 2. File link in a folder from another root folder assert_difference 'DmsfLink.count', +1 do - post :create, :dmsf_link => { + post :create, :params => {:dmsf_link => { :project_id => @project1.id, :dmsf_folder_id => @folder1.id, :target_project_id => @project2.id, @@ -147,7 +147,7 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase :target_folder_id => 'Documents', :name => 'file_link', :type => 'link_from' - } + }} end assert_redirected_to dmsf_folder_path(:id => @project1.id, :folder_id => @folder1.id) end @@ -155,14 +155,14 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase def test_create_file_link_from_f3 # 3. File link in a root folder from another folder assert_difference 'DmsfLink.count', +1 do - post :create, :dmsf_link => { + post :create, :params => {:dmsf_link => { :project_id => @project1.id, :target_project_id => @project2.id, :target_file_id => @file6.id, :target_folder_id => @folder3.id, :name => 'file_link', :type => 'link_from' - } + }} end assert_redirected_to dmsf_folder_path(:id => @project1.id) end @@ -170,28 +170,28 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase def test_create_file_link_from_f4 # 4. File link in a root folder from another root folder assert_difference 'DmsfLink.count', +1 do - post :create, :dmsf_link => { + post :create, :params => {:dmsf_link => { :project_id => @project1.id, :target_project_id => @project2.id, :target_file_id => @file2.id, :name => 'file_link', :type => 'link_from' - } - end + }} + end assert_redirected_to dmsf_folder_path(:id => @project1.id) end def test_create_folder_link_from_d1 # 1. Folder link in a folder from another folder assert_difference 'DmsfLink.count', +1 do - post :create, :dmsf_link => { + post :create, :params => {:dmsf_link => { :project_id => @project1.id, :dmsf_folder_id => @folder1.id, :target_project_id => @project2.id, :target_folder_id => @folder3.id, :name => 'folder_link', :type => 'link_from' - } + }} end assert_redirected_to dmsf_folder_path(:id => @project1.id, :folder_id => @folder1.id) end @@ -199,13 +199,13 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase def test_create_folder_link_from_d2 # 2. Folder link in a folder from another root folder assert_difference 'DmsfLink.count', +1 do - post :create, :dmsf_link => { + post :create, :params => {:dmsf_link => { :project_id => @project1.id, :dmsf_folder_id => @folder1.id, :target_project_id => @project2.id, :name => 'folder_link', :type => 'link_from' - } + }} end assert_redirected_to dmsf_folder_path(:id => @project1.id, :folder_id => @folder1.id) end @@ -213,13 +213,13 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase def test_create_folder_link_from_d3 # 3. Folder link in a root folder from another folder assert_difference 'DmsfLink.count', +1 do - post :create, :dmsf_link => { + post :create, :params => {:dmsf_link => { :project_id => @project1.id, :target_project_id => @project2.id, :target_folder_id => @folder3.id, :name => 'folder_link', :type => 'link_from' - } + }} end assert_redirected_to dmsf_folder_path(:id => @project1.id) end @@ -227,35 +227,35 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase def test_create_folder_link_from_d4 # 4. Folder link in a root folder from another root folder assert_difference 'DmsfLink.count', +1 do - post :create, :dmsf_link => { + post :create, :params => {:dmsf_link => { :project_id => @project1.id, :target_project_id => @project2.id, :name => 'folder_link', :type => 'link_from' - } - end + }} + end assert_redirected_to dmsf_folder_path(:id => @project1.id) end def test_create_file_link_to_f1 # 1. File link to a root folder from another folder assert_difference 'DmsfLink.count', +1 do - post :create, :dmsf_link => { + post :create, :params => {:dmsf_link => { :project_id => @project1.id, :dmsf_file_id => @file1.id, :target_project_id => @project2.id, :target_folder_id => @folder3.id, :name => 'file_link', :type => 'link_to' - } - end + }} + end assert_redirected_to dmsf_file_path(@file1) end def test_create_file_link_to_f2 # 2. File link to a folder from another folder assert_difference 'DmsfLink.count', +1 do - post :create, :dmsf_link => { + post :create, :params => {:dmsf_link => { :project_id => @project2.id, :dmsf_folder_id => @folder3.id, :target_project_id => @project1.id, @@ -263,85 +263,85 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase :dmsf_file_id => @file6.id, :name => 'file_link', :type => 'link_to' - } - end + }} + end assert_redirected_to dmsf_file_path(@file6) end def test_create_file_link_to_f3 # 3. File link to a root folder from another root folder assert_difference 'DmsfLink.count', +1 do - post :create, :dmsf_link => { + post :create, :params => {:dmsf_link => { :project_id => @project2.id, :target_project_id => @project1.id, :dmsf_file_id => @file6.id, :name => 'file_link', :type => 'link_to' - } - end + }} + end assert_redirected_to dmsf_file_path(@file6) end def test_create_file_link_to_f4 # 4. File link to a folder from another root folder assert_difference 'DmsfLink.count', +1 do - post :create, :dmsf_link => { + post :create, :params => {:dmsf_link => { :project_id => @project2.id, :dmsf_folder_id => @folder3.id, :target_project_id => @project1.id, :dmsf_file_id => @file6.id, :name => 'file_link', :type => 'link_to' - } - end + }} + end assert_redirected_to dmsf_file_path(@file6) end def test_create_external_link_from assert_difference 'DmsfLink.count', +1 do - post :create, :dmsf_link => { + post :create, :params => {:dmsf_link => { :project_id => @project1.id, :target_project_id => @project1.id, :name => 'file_link', :external_link => 'true', :type => 'link_from' - } - end + }} + end assert_redirected_to dmsf_folder_path(:id => @project1.id) end def test_create_folder_link_to_f1 # 1. Folder link to a root folder assert_difference 'DmsfLink.count', +1 do - post :create, :dmsf_link => { + post :create, :params => {:dmsf_link => { :project_id => @project1.id, :dmsf_folder_id => @folder1.id, :target_project_id => @project2.id, :name => 'folder_link', :type => 'link_to' - } - end + }} + end assert_redirected_to edit_dmsf_path(:id => @project1.id, :folder_id => @folder1.id) end def test_create_folder_link_to_f2 # 2. Folder link to a folder assert_difference 'DmsfLink.count', +1 do - post :create, :dmsf_link => { + post :create, :params => {:dmsf_link => { :project_id => @project1.id, :dmsf_folder_id => @folder1.id, :target_project_id => @project2.id, :target_folder_id => @folder3.id, :name => 'folder_link', :type => 'link_to' - } - end + }} + end assert_redirected_to edit_dmsf_path(:id => @project1.id, :folder_id => @folder1.id) end def test_destroy assert_difference 'DmsfLink.visible.count', -1 do - delete :destroy, :project_id => @project1.id, :id => @file_link.id + delete :destroy, :params => {:project_id => @project1.id, :id => @file_link.id} end assert_redirected_to dmsf_folder_path(:id => @project1.id, :folder_id => @folder1.id) end @@ -350,7 +350,7 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase # Missing permissions @request.env['HTTP_REFERER'] = trash_dmsf_path(:id => @project1.id) @role_manager.remove_permission! :file_manipulation - get :restore, :project_id => @project1.id, :id => @file_link.id + get :restore, :params => {:project_id => @project1.id, :id => @file_link.id} assert_response :forbidden end @@ -358,7 +358,7 @@ class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase # Permissions OK @request.env['HTTP_REFERER'] = trash_dmsf_path(:id => @project1.id) @role_manager.add_permission! :file_manipulation - get :restore, :project_id => @project1.id, :id => @file_link.id + get :restore, :params => {:project_id => @project1.id, :id => @file_link.id} assert_response :redirect end diff --git a/test/functional/dmsf_public_urls_controller_test.rb b/test/functional/dmsf_public_urls_controller_test.rb index 831265a4..ba6f07b9 100644 --- a/test/functional/dmsf_public_urls_controller_test.rb +++ b/test/functional/dmsf_public_urls_controller_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -35,17 +35,17 @@ class DmsfPublicUrlsControllerTest < RedmineDmsf::Test::TestCase end def test_show_valid_url - get :show, :token => 'd8d33e21914a433b280fdc94450ee212' + get :show, :params => {:token => 'd8d33e21914a433b280fdc94450ee212'} assert_response :success end def test_show_url_width_invalid_token - get :show, :token => 'f8d33e21914a433b280fdc94450ee212' + get :show, :params => {:token => 'f8d33e21914a433b280fdc94450ee212'} assert_response :not_found end def test_show_url_that_has_expired - get :show, :token => 'e8d33e21914a433b280fdc94450ee212' + get :show, :params => {:token => 'e8d33e21914a433b280fdc94450ee212'} assert_response :not_found end diff --git a/test/functional/dmsf_state_controller_test.rb b/test/functional/dmsf_state_controller_test.rb index 021aeaab..69c42733 100644 --- a/test/functional/dmsf_state_controller_test.rb +++ b/test/functional/dmsf_state_controller_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -47,8 +47,8 @@ class DmsfStateControllerTest < RedmineDmsf::Test::TestCase # Member @request.session[:user_id] = @user_member.id @role_manager.add_permission! :user_preferences - post :user_pref_save, :id => @project.id, :email_notify => 1, - :title_format => '%t_%v' + post :user_pref_save, :params => {:id => @project.id, :email_notify => 1, + :title_format => '%t_%v'} assert_redirected_to settings_project_path(@project, :tab => 'dmsf') assert_not_nil flash[:notice] assert_equal flash[:notice], l(:notice_your_preferences_were_saved) @@ -57,8 +57,8 @@ class DmsfStateControllerTest < RedmineDmsf::Test::TestCase def test_user_pref_save_member_forbidden # Member @request.session[:user_id] = @user_member.id - post :user_pref_save, :id => @project.id, :email_notify => 1, - :title_format => '%t_%v' + post :user_pref_save, :params => {:id => @project.id, :email_notify => 1, + :title_format => '%t_%v'} assert_response :forbidden end @@ -66,8 +66,8 @@ class DmsfStateControllerTest < RedmineDmsf::Test::TestCase # Non Member @request.session[:user_id] = @user_non_member.id @role_manager.add_permission! :user_preferences - post :user_pref_save, :id => @project.id, :email_notify => 1, - :title_format => '%t_%v' + post :user_pref_save, :params => {:id => @project.id, :email_notify => 1, + :title_format => '%t_%v'} assert_response :forbidden end @@ -75,8 +75,8 @@ class DmsfStateControllerTest < RedmineDmsf::Test::TestCase # Admin - non member @request.session[:user_id] = @user_admin.id @role_manager.add_permission! :user_preferences - post :user_pref_save, :id => @project.id, :email_notify => 1, - :title_format => '%t_%v' + post :user_pref_save, :params => {:id => @project.id, :email_notify => 1, + :title_format => '%t_%v'} assert_redirected_to settings_project_path(@project, :tab => 'dmsf') assert_not_nil flash[:warning] assert_equal flash[:warning], l(:user_is_not_project_member) diff --git a/test/functional/dmsf_workflow_controller_test.rb b/test/functional/dmsf_workflow_controller_test.rb index 88bec7d0..4b526a93 100644 --- a/test/functional/dmsf_workflow_controller_test.rb +++ b/test/functional/dmsf_workflow_controller_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -85,7 +85,7 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase def test_authorize_member # Non member @request.session[:user_id] = @user_non_member.id - get :index, :project_id => @project1.id + get :index, :params => {:project_id => @project1.id} assert_response :forbidden end @@ -97,7 +97,7 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase def test_authorize_projects # Project - get :index, :project_id => @project1.id + get :index, :params => {:project_id => @project1.id} assert_response :success assert_template 'index' end @@ -105,23 +105,23 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase def test_authorize_manage_workflows_forbidden # Without permissions @role_manager.remove_permission! :manage_workflows - get :index, :project_id => @project1.id + get :index, :params => {:project_id => @project1.id} assert_response :forbidden end def test_authorization_file_approval_ok @role_manager.add_permission! :file_approval @revision2.dmsf_workflow_id = @wf1.id - get :start, :id => @revision2.dmsf_workflow_id, - :dmsf_file_revision_id => @revision2.id + get :start, :params => {:id => @revision2.dmsf_workflow_id, + :dmsf_file_revision_id => @revision2.id} assert_response :redirect end def test_authorization_file_approval_forbidden @role_manager.remove_permission! :file_approval @revision2.dmsf_workflow_id = @wf1.id - get :start, :id => @revision2.dmsf_workflow_id, - :dmsf_file_revision_id => @revision2.id + get :start, :params => {:id => @revision2.dmsf_workflow_id, + :dmsf_file_revision_id => @revision2.id} assert_response :forbidden end @@ -129,7 +129,7 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase # Without the module @role_manager.add_permission! :file_manipulation @project1.disable_module!(:dmsf) - get :index, :project_id => @project1.id + get :index, :params => {:project_id => @project1.id} assert_response :forbidden end @@ -141,52 +141,52 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase end def test_index_project - get :index, :project_id => @project1.id + get :index, :params => {:project_id => @project1.id} assert_response :success assert_template 'index' end def test_new - get :new, :project_id => @project1.id + get :new, :params => {:project_id => @project1.id} assert_response :success assert_template 'new' end def test_lock - put :update, :id => @wf1.id, :dmsf_workflow => { :status => DmsfWorkflow::STATUS_LOCKED } + put :update, :params => {:id => @wf1.id, :dmsf_workflow => { :status => DmsfWorkflow::STATUS_LOCKED }} @wf1.reload assert @wf1.locked?, "#{@wf1.name} status is #{@wf1.status}" end def test_unlock @request.session[:user_id] = @user_admin.id - put :update, :id => @wf3.id, :dmsf_workflow => { :status => DmsfWorkflow::STATUS_ACTIVE } + put :update, :params => {:id => @wf3.id, :dmsf_workflow => { :status => DmsfWorkflow::STATUS_ACTIVE }} @wf3.reload assert @wf3.active?, "#{@wf3.name} status is #{@wf3.status}" end def test_show - get :show, :id => @wf1.id + get :show, :params => {:id => @wf1.id} assert_response :success assert_template 'show' end def test_create assert_difference 'DmsfWorkflow.count', +1 do - post :create, :dmsf_workflow => {:name => 'wf4', :project_id => @project1.id} + post :create, :params => {:dmsf_workflow => {:name => 'wf4', :project_id => @project1.id}} end assert_redirected_to settings_project_path(@project1, :tab => 'dmsf_workflow') end def test_update - put :update, :id => @wf1.id, :dmsf_workflow => {:name => 'wf1a'} + put :update, :params => {:id => @wf1.id, :dmsf_workflow => {:name => 'wf1a'}} @wf1.reload assert_equal 'wf1a', @wf1.name end def test_destroy assert_difference 'DmsfWorkflow.count', -1 do - delete :destroy, :id => @wf1.id + delete :destroy, :params => {:id => @wf1.id} end assert_redirected_to settings_project_path(@project1, :tab => 'dmsf_workflow') assert_equal 0, DmsfWorkflowStep.where(:dmsf_workflow_id => @wf1.id).all.count @@ -194,8 +194,8 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase def test_add_step assert_difference 'DmsfWorkflowStep.count', +1 do - post :add_step, :commit => l(:dmsf_or), :step => 1, :name => '1st step', :id => @wf1.id, - :user_ids => [@user_non_member.id] + post :add_step, :params => {:commit => l(:dmsf_or), :step => 1, :name => '1st step', :id => @wf1.id, + :user_ids => [@user_non_member.id]} end assert_response :success ws = DmsfWorkflowStep.order(id: :desc).first @@ -209,7 +209,7 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase def test_remove_step n = DmsfWorkflowStep.where(:dmsf_workflow_id => @wf1.id, :step => 1).count assert_difference 'DmsfWorkflowStep.count', -n do - delete :remove_step, :step => @wfs1.id, :id => @wf1.id + delete :remove_step, :params => {:step => @wfs1.id, :id => @wf1.id} end assert_response :redirect ws = DmsfWorkflowStep.where(:dmsf_workflow_id => @wf1.id).order(:id =>:asc).first @@ -217,7 +217,7 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase end def test_reorder_steps_to_lower - put :reorder_steps, :step => 1, :id => @wf1.id, :dmsf_workflow => {:position => 2} + put :reorder_steps, :params => {:step => 1, :id => @wf1.id, :dmsf_workflow => {:position => 2}} assert_response :success @wfs1.reload @wfs2.reload @@ -232,7 +232,7 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase end def test_reorder_steps_to_lowest - put :reorder_steps, :step => 1, :id => @wf1.id, :dmsf_workflow => {:position => 3} + put :reorder_steps, :params => {:step => 1, :id => @wf1.id, :dmsf_workflow => {:position => 3}} assert_response :success @wfs1.reload @wfs2.reload @@ -247,7 +247,7 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase end def test_reorder_steps_to_higher - put :reorder_steps, :step => 3, :id => @wf1.id, :dmsf_workflow => {:position => 2} + put :reorder_steps, :params => {:step => 3, :id => @wf1.id, :dmsf_workflow => {:position => 2}} assert_response :success @wfs1.reload @wfs2.reload @@ -262,7 +262,7 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase end def test_reorder_steps_to_highest - put :reorder_steps, :step => 3, :id => @wf1.id, :dmsf_workflow => {:position => '1'} + put :reorder_steps, :params => {:step => 3, :id => @wf1.id, :dmsf_workflow => {:position => '1'}} assert_response :success @wfs1.reload @wfs2.reload @@ -278,14 +278,14 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase def test_action_approve post( - :new_action, + :new_action, :params => { :commit => l(:button_submit), :id => @wf1.id, :dmsf_workflow_step_assignment_id => @wfsa2.id, :dmsf_file_revision_id => @revision1.id, :step_action => DmsfWorkflowStepAction::ACTION_APPROVE, :user_id => nil, - :note => '') + :note => ''}) assert_redirected_to dmsf_folder_path(:id => @project1.id) assert DmsfWorkflowStepAction.where( :dmsf_workflow_step_assignment_id => @wfsa2.id, @@ -294,13 +294,13 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase def test_action_reject post( - :new_action, + :new_action, :params => { :commit => l(:button_submit), :id => @wf1.id, :dmsf_workflow_step_assignment_id => @wfsa2.id, :dmsf_file_revision_id => @revision2.id, :step_action => DmsfWorkflowStepAction::ACTION_REJECT, - :note => 'Rejected because...') + :note => 'Rejected because...'}) assert_response :redirect assert DmsfWorkflowStepAction.where( :dmsf_workflow_step_assignment_id => @wfsa2.id, @@ -308,14 +308,13 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase end def test_action - xhr( - :get, - :action, + get( + :action, :xhr => true, :params => { :project_id => @project1.id, :id => @wf1.id, :dmsf_workflow_step_assignment_id => @wfsa2.id, :dmsf_file_revision_id => @revision2.id, - :title => l(:title_waiting_for_approval)) + :title => l(:title_waiting_for_approval)}) assert_response :success assert_match(/ajax-modal/, response.body) assert_template 'action' @@ -323,13 +322,13 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase def test_new_action_delegate post( - :new_action, + :new_action, :params => { :commit => l(:button_submit), :id => @wf1.id, :dmsf_workflow_step_assignment_id => @wfsa2.id, :dmsf_file_revision_id => @revision2.id, :step_action => @user_admin.id * 10, - :note => 'Delegated because...') + :note => 'Delegated because...'}) assert_redirected_to dmsf_folder_path(:id => @project1.id) assert DmsfWorkflowStepAction.where( :dmsf_workflow_step_assignment_id => @wfsa2.id, @@ -339,13 +338,12 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase end def test_assign - xhr( - :get, - :assign, + get( + :assign, :xhr => true, :params => { :project_id => @project1.id, :id => @wf1.id, :dmsf_file_revision_id => @revision1.id, - :title => l(:label_dmsf_wokflow_action_assign)) + :title => l(:label_dmsf_wokflow_action_assign)}) assert_response :success assert_match(/ajax-modal/, response.body) assert_template 'assign' @@ -353,24 +351,24 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase def test_start @revision2.dmsf_workflow_id = @wf1.id - get :start, :id => @revision2.dmsf_workflow_id, :dmsf_file_revision_id => @revision2.id + get :start, :params => {:id => @revision2.dmsf_workflow_id, :dmsf_file_revision_id => @revision2.id} assert_redirected_to dmsf_folder_path(:id => @project1.id) end def test_assignment post( - :assignment, + :assignment, :params => { :commit => l(:button_submit), :id => @wf1.id, :dmsf_workflow_id => @wf1.id, :dmsf_file_revision_id => @revision2.id, :action => 'assignment', - :project_id => @project1.id) + :project_id => @project1.id}) assert_response :redirect end def test_update_step_name - put :update_step, id: @wf1.id, step: @wfs2.step, dmsf_workflow: { step_name: 'new_name'} + put :update_step, :params => {id: @wf1.id, step: @wfs2.step, dmsf_workflow: { step_name: 'new_name'}} assert_response :redirect # All steps in the same step must be renamed @wfs2.reload @@ -383,22 +381,22 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase end def test_update_step_operators - put :update_step, + put :update_step, :params => { :id => @wf1, :step => '1', :operator_step => { @wfs1.id.to_s => DmsfWorkflowStep::OPERATOR_OR.to_s }, - :assignee => { @wfs1.id.to_s => @wfs1.user_id.to_s } + :assignee => { @wfs1.id.to_s => @wfs1.user_id.to_s }} assert_response :redirect @wfs1.reload assert_equal @wfs1.operator, DmsfWorkflowStep::OPERATOR_OR end def test_update_step_assignee - put :update_step, + put :update_step, :params => { :id => @wf1, :step => '1', :operator_step => { @wfs1.id.to_s => DmsfWorkflowStep::OPERATOR_OR.to_s }, - :assignee => { @wfs1.id.to_s => @user_non_member.id.to_s } + :assignee => { @wfs1.id.to_s => @user_non_member.id.to_s }} assert_response :redirect @wfs1.reload assert_equal @user_non_member.id, @wfs1.user_id @@ -407,7 +405,7 @@ class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase def test_delete_step name = @wfs2.name assert_difference 'DmsfWorkflowStep.count', -1 do - delete :delete_step, :id => @wf1, :step => @wfs2.id + delete :delete_step, :params => {:id => @wf1, :step => @wfs2.id} end @wfs3.reload assert_equal @wfs3.name, name diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index ca7cf5e2..108ba90f 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -67,8 +67,8 @@ class IssuesControllerTest < RedmineDmsf::Test::TestCase main_system_folder = @issue1.main_system_folder assert main_system_folder assert_equal @project1.id, main_system_folder.project_id - put :update, id: @issue1.id, issue: { project_id: @project2.id, tracker_id: '1', priority_id: '6', - category_id: '3' } + put :update, :params => {id: @issue1.id, issue: { project_id: @project2.id, tracker_id: '1', priority_id: '6', + category_id: '3' }} assert_redirected_to action: 'show', id: @issue1.id @issue1.reload assert_equal @project2.id, @issue1.project.id diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb index a627e191..61e07986 100644 --- a/test/functional/my_controller_test.rb +++ b/test/functional/my_controller_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -38,7 +38,7 @@ class MyControllerTest < RedmineDmsf::Test::TestCase end def test_page_with_open_approvals_one_approval - DmsfFileRevision.delete_all(id: 5) + DmsfFileRevision.where(id: 5).delete_all @user_member.pref[:my_page_layout] = { 'top' => ['open_approvals'] } @user_member.pref.save! get :page diff --git a/test/integration/rest_api/dmsf_file_api_test.rb b/test/integration/rest_api/dmsf_file_api_test.rb index 19c13290..282f7aa1 100644 --- a/test/integration/rest_api/dmsf_file_api_test.rb +++ b/test/integration/rest_api/dmsf_file_api_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -63,29 +63,67 @@ class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest get "/dmsf/files/#{@file1.id}.xml?key=#{@token.value}" assert_response :success assert_equal 'application/xml', @response.content_type - # + # # # 1 - # test.txt + # Test File # test.txt # 1 - # 1.0 - # text/plain - # 81dc9bdb52d04dc20036dbd8313ed055 - # 4 - # Some file :-) # http://www.example.com/dmsf/files/1/download + # + # + # 5 + # + # test5.txt + # http://www.example.com/dmsf/files/1/view?download=5 + # 4 + # text/plain + # Test File + # + # 1 + # 1.0 + # + # 1 + # 2017-04-18T12:52:28Z + # 2019-01-15T15:56:15Z + # + # + # + # + # + # + # + # + # 1 + # + # test.txt + # http://www.example.com/dmsf/files/1/view?download=1 + # 4 + # text/plain + # Test File + # Some file :-) + # 1 + # 1.0 + # + # 1 + # 2017-04-18T12:52:27Z + # 2019-01-15T15:56:15Z + # + # 1 + # + # 1 + # + # 81dc9bdb52d04dc20036dbd8313ed055 + # + # # + #puts response.body assert_select 'dmsf_file > id', text: @file1.id.to_s assert_select 'dmsf_file > title', text: @file1.title assert_select 'dmsf_file > name', text: @file1.name assert_select 'dmsf_file > project_id', text: @file1.project_id.to_s - assert_select 'dmsf_file > version', text: @file1.last_revision.version - assert_select 'dmsf_file > mime_type', text: @file1.last_revision.mime_type - assert_select 'dmsf_file > digest', text: @file1.last_revision.digest - assert_select 'dmsf_file > size', text: @file1.last_revision.size.to_s - assert_select 'dmsf_file > description', text: @file1.last_revision.description assert_select 'dmsf_file > content_url', text: "http://www.example.com/dmsf/files/#{@file1.id}/download" + assert_select 'dmsf_file > dmsf_file_revisions > dmsf_file_revision', @file1.dmsf_file_revisions.all.size #curl -v -H "Content-Type: application/octet-stream" -X GET -u ${1}:${2} http://localhost:3000/dmsf/files/41532/download > file.txt get "/dmsf/files/#{@file1.id}/download.xml?key=#{@token.value}" assert_response :success @@ -95,7 +133,7 @@ class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest def test_upload_document @role.add_permission! :file_manipulation #curl --data-binary "@cat.gif" -H "Content-Type: application/octet-stream" -X POST -u ${1}:${2} http://localhost:3000/projects/12/dmsf/upload.xml?filename=cat.gif - post "/projects/#{@project1.id}/dmsf/upload.xml?filename=test.txt&key=#{@token.value}", 'File content', {"CONTENT_TYPE" => 'application/octet-stream'} + post "/projects/#{@project1.id}/dmsf/upload.xml?filename=test.txt&key=#{@token.value}", :params => 'File content', :headers => {"CONTENT_TYPE" => 'application/octet-stream'} assert_response :created assert_equal 'application/xml', response.content_type # @@ -120,7 +158,7 @@ class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest } assert_difference 'DmsfFileRevision.count', +1 do - post "/projects/#{@project1.id}/dmsf/commit.xml?key=#{@token.value}", payload, {"CONTENT_TYPE" => 'application/xml'} + post "/projects/#{@project1.id}/dmsf/commit.xml?key=#{@token.value}", :params => payload, :headers => {"CONTENT_TYPE" => 'application/xml'} end # # @@ -138,7 +176,7 @@ class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest def test_delete_file @role.add_permission! :file_delete # curl -v -H "Content-Type: application/xml" -X DELETE -u ${1}:${2} http://localhost:3000/dmsf/files/196118.xml - delete "/dmsf/files/#{@file1.id}.xml?key=#{@token.value}", {'CONTENT_TYPE' => 'application/xml'} + delete "/dmsf/files/#{@file1.id}.xml?key=#{@token.value}", :headers => {'CONTENT_TYPE' => 'application/xml'} assert_response :success @file1.reload assert_equal DmsfFile::STATUS_DELETED, @file1.deleted @@ -148,14 +186,14 @@ class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest def test_delete_file_no_permissions token = Token.create!(:user => @jsmith, :action => 'api') # curl -v -H "Content-Type: application/xml" -X DELETE -u ${1}:${2} http://localhost:3000/dmsf/files/196118.xml - delete "/dmsf/files/#{@file1.id}.xml?key=#{token.value}", {'CONTENT_TYPE' => 'application/xml'} + delete "/dmsf/files/#{@file1.id}.xml?key=#{token.value}", :headers => {'CONTENT_TYPE' => 'application/xml'} assert_response :forbidden end def test_delete_folder_commit_yes @role.add_permission! :file_delete # curl -v -H "Content-Type: application/xml" -X DELETE -u ${1}:${2} http://localhost:3000/dmsf/files/196118.xml&commit=yes - delete "/dmsf/files/#{@file1.id}.xml?key=#{@token.value}&commit=yes", {'CONTENT_TYPE' => 'application/xml'} + delete "/dmsf/files/#{@file1.id}.xml?key=#{@token.value}&commit=yes", :headers => {'CONTENT_TYPE' => 'application/xml'} assert_response :success assert_nil DmsfFile.find_by(id: @file1.id) end @@ -166,7 +204,7 @@ class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest @file1.lock! User.current = @jsmith # curl -v -H "Content-Type: application/xml" -X DELETE -u ${1}:${2} http://localhost:3000/dmsf/files/196118.xml - delete "/dmsf/files/#{@file1.id}.xml?key=#{@token.value}", {'CONTENT_TYPE' => 'application/xml'} + delete "/dmsf/files/#{@file1.id}.xml?key=#{@token.value}", :headers => {'CONTENT_TYPE' => 'application/xml'} assert_response 422 # # diff --git a/test/integration/rest_api/dmsf_folder_api_test.rb b/test/integration/rest_api/dmsf_folder_api_test.rb index d0adda7a..7dc436a5 100644 --- a/test/integration/rest_api/dmsf_folder_api_test.rb +++ b/test/integration/rest_api/dmsf_folder_api_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -151,7 +151,7 @@ class DmsfFolderApiTest < RedmineDmsf::Test::IntegrationTest A folder created via REST API } - post "/projects/#{@project1.id}/dmsf/create.xml?key=#{token.value}", payload, {'CONTENT_TYPE' => 'application/xml'} + post "/projects/#{@project1.id}/dmsf/create.xml?key=#{token.value}", :params => payload, :headers => {'CONTENT_TYPE' => 'application/xml'} assert_response :success # # @@ -242,7 +242,7 @@ class DmsfFolderApiTest < RedmineDmsf::Test::IntegrationTest rest_api A folder updated via REST API } - post "/projects/#{@project1.id}/dmsf/save.xml?folder_id=1&key=#{token.value}", payload, {'CONTENT_TYPE' => 'application/xml'} + post "/projects/#{@project1.id}/dmsf/save.xml?folder_id=1&key=#{token.value}", :params => payload, :headers => {'CONTENT_TYPE' => 'application/xml'} assert_response :success # # @@ -258,7 +258,7 @@ class DmsfFolderApiTest < RedmineDmsf::Test::IntegrationTest token = Token.create!(:user => @jsmith, :action => 'api') # curl -v -H "Content-Type: application/xml" -X DELETE -u ${1}:${2} http://localhost:3000/projects/1/dmsf/delete.xml?folder_id=3 delete "/projects/#{@project1.id}/dmsf/delete.xml?key=#{token.value}&folder_id=#{@folder1.id}", - {'CONTENT_TYPE' => 'application/xml'} + :headers => {'CONTENT_TYPE' => 'application/xml'} assert_response :success @folder1.reload assert_equal DmsfFolder::STATUS_DELETED, @folder1.deleted @@ -269,7 +269,7 @@ class DmsfFolderApiTest < RedmineDmsf::Test::IntegrationTest token = Token.create!(:user => @jsmith, :action => 'api') # curl -v -H "Content-Type: application/xml" -X DELETE -u ${1}:${2} http://localhost:3000/projects/1/dmsf/delete.xml?folder_id=3 delete "/projects/#{@project1.id}/dmsf/delete.xml?key=#{token.value}&folder_id=#{@folder1.id}", - {'CONTENT_TYPE' => 'application/xml'} + :headers => {'CONTENT_TYPE' => 'application/xml'} assert_response :forbidden end @@ -278,7 +278,7 @@ class DmsfFolderApiTest < RedmineDmsf::Test::IntegrationTest token = Token.create!(:user => @jsmith, :action => 'api') # curl -v -H "Content-Type: application/xml" -X DELETE -u ${1}:${2} http://localhost:3000/projects/1/dmsf/delete.xml?folder_id=3 delete "/projects/#{@project1.id}/dmsf/delete.xml?key=#{token.value}&folder_id=#{@folder1.id}&commit=yes", - {'CONTENT_TYPE' => 'application/xml'} + :headers => {'CONTENT_TYPE' => 'application/xml'} assert_response :success assert_nil DmsfFolder.find_by(id: @folder1.id) end @@ -291,7 +291,7 @@ class DmsfFolderApiTest < RedmineDmsf::Test::IntegrationTest token = Token.create!(:user => @jsmith, :action => 'api') # curl -v -H "Content-Type: application/xml" -X DELETE -u ${1}:${2} http://localhost:3000/projects/1/dmsf/delete.xml?folder_id=3 delete "/projects/#{@project1.id}/dmsf/delete.xml?key=#{token.value}&folder_id=#{@folder1.id}", - {'CONTENT_TYPE' => 'application/xml'} + :headers => {'CONTENT_TYPE' => 'application/xml'} assert_response 422 # # diff --git a/test/integration/rest_api/dmsf_link_api_test.rb b/test/integration/rest_api/dmsf_link_api_test.rb index 21e4e499..b336d3a8 100644 --- a/test/integration/rest_api/dmsf_link_api_test.rb +++ b/test/integration/rest_api/dmsf_link_api_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -59,7 +59,7 @@ class DmsfLinkApiTest < RedmineDmsf::Test::IntegrationTest #{name} } - post "/dmsf_links.xml?key=#{token.value}", payload, {'CONTENT_TYPE' => 'application/xml'} + post "/dmsf_links.xml?key=#{token.value}", :params => payload, :headers => {'CONTENT_TYPE' => 'application/xml'} assert_response :success # # diff --git a/test/integration/webdav/dmsf_webdav_custom_middleware_test.rb b/test/integration/webdav/dmsf_webdav_custom_middleware_test.rb index b7ba05d5..66ee63e8 100644 --- a/test/integration/webdav/dmsf_webdav_custom_middleware_test.rb +++ b/test/integration/webdav/dmsf_webdav_custom_middleware_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -32,18 +32,18 @@ class DmsfWebdavCustomMiddlewareTest < RedmineDmsf::Test::IntegrationTest end def test_options_for_root_path - xml_http_request :options, '/' + process :options, '/' assert_response defined?(EasyExtensions) ? :method_not_allowed : :not_found end def test_options_for_dmsf_root_path - xml_http_request :options, '/dmsf' + process :options, '/dmsf' assert_response :success end def test_webdav_not_enabled Setting.plugin_redmine_dmsf['dmsf_webdav'] = nil - xml_http_request :options, '/dmsf/webdav' + process :options, '/dmsf/webdav' assert_response :not_found end diff --git a/test/integration/webdav/dmsf_webdav_delete_test.rb b/test/integration/webdav/dmsf_webdav_delete_test.rb index f2d13972..f754cb99 100644 --- a/test/integration/webdav/dmsf_webdav_delete_test.rb +++ b/test/integration/webdav/dmsf_webdav_delete_test.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -83,51 +83,51 @@ class DmsfWebdavDeleteTest < RedmineDmsf::Test::IntegrationTest end def test_failed_authentication_global - delete '/dmsf/webdav', nil, credentials('admin', 'badpassword') + delete '/dmsf/webdav', :params => nil, :headers => credentials('admin', 'badpassword') assert_response :unauthorized end def test_failed_authentication - delete "/dmsf/webdav/#{@project1.identifier}", nil, credentials('admin', 'badpassword') + delete "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => credentials('admin', 'badpassword') assert_response :unauthorized end def test_root_folder - delete '/dmsf/webdav', nil, @admin + delete '/dmsf/webdav', :params => nil, :headers => @admin assert_response :not_implemented end def test_delete_not_empty_folder - put "/dmsf/webdav/#{@project1.identifier}/#{@folder1.title}", nil, @admin + put "/dmsf/webdav/#{@project1.identifier}/#{@folder1.title}", :params => nil, :headers => @admin assert_response :forbidden end def test_not_existed_project - delete '/dmsf/webdav/not_a_project/file.txt', nil, @admin + delete '/dmsf/webdav/not_a_project/file.txt', :params => nil, :headers => @admin assert_response :not_found end def test_dmsf_not_enabled @project1.disable_module! :dmsf - delete "/dmsf/webdav/#{@project1.identifier}/test.txt", nil, @jsmith + delete "/dmsf/webdav/#{@project1.identifier}/test.txt", :params => nil, :headers => @jsmith assert_response :not_found # Item does not exist, as project is not enabled. end def test_delete_when_ro Setting.plugin_redmine_dmsf['dmsf_webdav_strategy'] = 'WEBDAV_READ_ONLY' - delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, @admin + delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, :headers => @admin assert_response :bad_gateway # Item does not exist, as project is not enabled. end def test_unlocked_file - delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, @admin + delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, :headers => @admin assert_response :no_content @file1.reload assert @file1.deleted?, "File #{@file1.name} hasn't been deleted" end def test_unathorized_user - delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, @jsmith + delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, :headers => @jsmith assert_response :not_found # Without folder_view permission, he will not even be aware of its existence. @file1.reload assert !@file1.deleted?, "File #{@file1.name} is expected to exist" @@ -135,7 +135,7 @@ class DmsfWebdavDeleteTest < RedmineDmsf::Test::IntegrationTest def test_unathorized_user_forbidden @role.add_permission! :view_dmsf_folders - delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, @jsmith + delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, :headers => @jsmith assert_response :forbidden # Now jsmith's role has view_folder rights, however they do not hold file manipulation rights. @file1.reload assert !@file1.deleted?, "File #{@file1.name} is expected to exist" @@ -143,7 +143,7 @@ class DmsfWebdavDeleteTest < RedmineDmsf::Test::IntegrationTest def test_view_folder_not_allowed @role.add_permission! :file_manipulation - delete "/dmsf/webdav/#{@project1.identifier}/#{@folder1.title}", nil, @jsmith + delete "/dmsf/webdav/#{@project1.identifier}/#{@folder1.title}", :params => nil, :headers => @jsmith assert_response :not_found # Without folder_view permission, he will not even be aware of its existence. @folder1.reload assert !@folder1.deleted?, "Folder #{@folder1.title} is expected to exist" @@ -151,14 +151,14 @@ class DmsfWebdavDeleteTest < RedmineDmsf::Test::IntegrationTest def test_folder_manipulation_not_allowed @role.add_permission! :view_dmsf_folders - delete "/dmsf/webdav/#{@project1.identifier}/#{@folder1.title}", nil, @jsmith + delete "/dmsf/webdav/#{@project1.identifier}/#{@folder1.title}", :params => nil, :headers => @jsmith assert_response :forbidden # Without manipulation permission, action is forbidden. @folder1.reload assert !@folder1.deleted?, "Foler #{@folder1.title} is expected to exist" end def test_folder_delete_by_admin - delete "/dmsf/webdav/#{@project1.identifier}/#{@folder6.title}", nil, @admin + delete "/dmsf/webdav/#{@project1.identifier}/#{@folder6.title}", :params => nil, :headers => @admin assert_response :success @folder6.reload assert @folder6.deleted?, "Folder #{@folder1.title} is not expected to exist" @@ -167,7 +167,7 @@ class DmsfWebdavDeleteTest < RedmineDmsf::Test::IntegrationTest def test_folder_delete_by_user @role.add_permission! :view_dmsf_folders @role.add_permission! :folder_manipulation - delete "/dmsf/webdav/#{@project1.identifier}/#{@folder6.title}", nil, @jsmith + delete "/dmsf/webdav/#{@project1.identifier}/#{@folder6.title}", :params => nil, :headers => @jsmith assert_response :success @folder6.reload assert @folder6.deleted?, "Folder #{@folder1.title} is not expected to exist" @@ -177,17 +177,17 @@ class DmsfWebdavDeleteTest < RedmineDmsf::Test::IntegrationTest Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = true @role.add_permission! :view_dmsf_folders @role.add_permission! :folder_manipulation - delete "/dmsf/webdav/#{@project1.identifier}/#{@folder6.title}", nil, @jsmith + delete "/dmsf/webdav/#{@project1.identifier}/#{@folder6.title}", :params => nil, :headers => @jsmith assert_response :not_found p1name_uri = Addressable::URI.escape(RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1)) - delete "/dmsf/webdav/#{p1name_uri}/#{@folder6.title}", nil, @jsmith + delete "/dmsf/webdav/#{p1name_uri}/#{@folder6.title}", :params => nil, :headers => @jsmith assert_response :success @folder6.reload assert @folder6.deleted?, "Folder #{@folder1.title} is not expected to exist" end def test_file_delete_by_administrator - delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, @admin + delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, :headers => @admin assert_response :success @file1.reload assert @file1.deleted?, "File #{@file1.name} is not expected to exist" @@ -196,7 +196,7 @@ class DmsfWebdavDeleteTest < RedmineDmsf::Test::IntegrationTest def test_file_delete_by_user @role.add_permission! :view_dmsf_folders @role.add_permission! :file_delete - delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, @jsmith + delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, :headers => @jsmith assert_response :success @file1.reload assert @file1.deleted?, "File #{@file1.name} is not expected to exist" @@ -206,10 +206,10 @@ class DmsfWebdavDeleteTest < RedmineDmsf::Test::IntegrationTest Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = true @role.add_permission! :view_dmsf_folders @role.add_permission! :file_delete - delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, @jsmith + delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, :headers => @jsmith assert_response :not_found p1name_uri = Addressable::URI.escape(RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1)) - delete "/dmsf/webdav/#{p1name_uri}/#{@file1.name}", nil, @jsmith + delete "/dmsf/webdav/#{p1name_uri}/#{@file1.name}", :params => nil, :headers => @jsmith assert_response :success @file1.reload assert @file1.deleted?, "File #{@file1.name} is not expected to exist" @@ -218,7 +218,7 @@ class DmsfWebdavDeleteTest < RedmineDmsf::Test::IntegrationTest def test_folder_delete_fragments @role.add_permission! :view_dmsf_folders @role.add_permission! :folder_manipulation - delete "/dmsf/webdav/#{@project1.identifier}/#{@folder6.title}/#frament=HTTP/1.1", nil, @jsmith + delete "/dmsf/webdav/#{@project1.identifier}/#{@folder6.title}/#frament=HTTP/1.1", :params => nil, :headers => @jsmith assert_response :bad_request end @@ -226,7 +226,7 @@ class DmsfWebdavDeleteTest < RedmineDmsf::Test::IntegrationTest @role.add_permission! :view_dmsf_folders @role.add_permission! :folder_manipulation @folder6.lock! - delete "/dmsf/webdav/#{@project1.identifier}/#{@folder6.title}", nil, @jsmith + delete "/dmsf/webdav/#{@project1.identifier}/#{@folder6.title}", :params => nil, :headers => @jsmith assert_response :locked @folder6.reload assert !@folder6.deleted?, "Folder #{@folder6.title} is expected to exist" @@ -236,7 +236,7 @@ class DmsfWebdavDeleteTest < RedmineDmsf::Test::IntegrationTest @role.add_permission! :view_dmsf_folders @role.add_permission! :file_delete @file1.lock! - delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, @jsmith + delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, :headers => @jsmith assert_response :locked @file1.reload assert !@file1.deleted?, "File #{@file1.name} is expected to exist" @@ -245,7 +245,7 @@ class DmsfWebdavDeleteTest < RedmineDmsf::Test::IntegrationTest def test_non_versioned_file @role.add_permission! :view_dmsf_folders @role.add_permission! :file_delete - delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, @jsmith + delete "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, :headers => @jsmith assert_response :success # The file should be destroyed assert_nil DmsfFile.visible.find_by(id: @file1.id) diff --git a/test/integration/webdav/dmsf_webdav_get_test.rb b/test/integration/webdav/dmsf_webdav_get_test.rb index 701894e0..d422905a 100644 --- a/test/integration/webdav/dmsf_webdav_get_test.rb +++ b/test/integration/webdav/dmsf_webdav_get_test.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -69,57 +69,57 @@ class DmsfWebdavGetTest < RedmineDmsf::Test::IntegrationTest end def test_should_deny_failed_authentication - get '/dmsf/webdav', nil, credentials('admin', 'badpassword') + get '/dmsf/webdav', :params => nil, :headers => credentials('admin', 'badpassword') assert_response :unauthorized end def test_should_permit_authenticated_user - get '/dmsf/webdav', nil, @admin + get '/dmsf/webdav', :params => nil, :headers => @admin assert_response :success end def test_should_list_dmsf_enabled_project - get '/dmsf/webdav', nil, @admin + get '/dmsf/webdav', :params => nil, :headers => @admin assert_response :success assert !response.body.match(@project1.identifier).nil?, "Expected to find project #{@project1.identifier} in return data" Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = true project1_uri = RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1) - get '/dmsf/webdav', nil, @admin + get '/dmsf/webdav', :params => nil, :headers => @admin assert_response :success assert_no_match @project1.identifier, response.body assert_match project1_uri, response.body end def test_should_not_list_non_dmsf_enabled_project - get '/dmsf/webdav', nil, @jsmith + get '/dmsf/webdav', :params => nil, :headers => @jsmith assert_response :success assert response.body.match(@project2.identifier).nil?, "Unexpected find of project #{@project2.identifier} in return data" end def test_should_return_status_404_when_project_does_not_exist @project1.enable_module! :dmsf # Flag module enabled - get '/dmsf/webdav/project_does_not_exist', nil, @jsmith + get '/dmsf/webdav/project_does_not_exist', :params => nil, :headers => @jsmith assert_response :not_found end def test_should_return_status_404_when_dmsf_not_enabled - get "/dmsf/webdav/#{@project2.identifier}", nil, @jsmith + get "/dmsf/webdav/#{@project2.identifier}", :params => nil, :headers => @jsmith assert_response :not_found end def test_download_file_from_dmsf_enabled_project - get "/dmsf/webdav/#{@project1.identifier}/test.txt", nil, @admin + get "/dmsf/webdav/#{@project1.identifier}/test.txt", :params => nil, :headers => @admin assert_response :success Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = true project1_uri = Addressable::URI.escape(RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1)) - get "/dmsf/webdav/#{@project1.identifier}/test.txt", nil, @admin + get "/dmsf/webdav/#{@project1.identifier}/test.txt", :params => nil, :headers => @admin assert_response :not_found - get "/dmsf/webdav/#{project1_uri}/test.txt", nil, @admin + get "/dmsf/webdav/#{project1_uri}/test.txt", :params => nil, :headers => @admin assert_response :success end def test_should_list_dmsf_contents_within_project - get "/dmsf/webdav/#{@project1.identifier}", nil, @admin + get "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => @admin assert_response :success folder = DmsfFolder.find_by(id: 1) assert_not_nil folder @@ -132,13 +132,13 @@ class DmsfWebdavGetTest < RedmineDmsf::Test::IntegrationTest end def test_user_assigned_to_project_dmsf_module_not_enabled - get "/dmsf/webdav/#{@project1.identifier}", nil, @jsmith + get "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => @jsmith assert_response :not_found end def test_user_assigned_to_project_folder_forbidden @project2.enable_module! :dmsf # Flag module enabled - get "/dmsf/webdav/#{@project2.identifier}", nil, @jsmith + get "/dmsf/webdav/#{@project2.identifier}", :params => nil, :headers => @jsmith assert_response :not_found end @@ -146,14 +146,14 @@ class DmsfWebdavGetTest < RedmineDmsf::Test::IntegrationTest @project1.enable_module! :dmsf # Flag module enabled @role.add_permission! :view_dmsf_folders @role.add_permission! :view_dmsf_files - get "/dmsf/webdav/#{@project1.identifier}", nil, @jsmith + get "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => @jsmith assert_response :success end def test_user_assigned_to_project_file_forbidden @project1.enable_module! :dmsf # Flag module enabled @role.add_permission! :view_dmsf_folders - get "/dmsf/webdav/#{@project1.identifier}/test.txt", nil, @jsmith + get "/dmsf/webdav/#{@project1.identifier}/test.txt", :params => nil, :headers => @jsmith assert_response :forbidden end @@ -161,7 +161,7 @@ class DmsfWebdavGetTest < RedmineDmsf::Test::IntegrationTest @project1.enable_module! :dmsf # Flag module enabled @role.add_permission! :view_dmsf_folders @role.add_permission! :view_dmsf_files - get "/dmsf/webdav/#{@project1.identifier}/test.txt", nil, @jsmith + get "/dmsf/webdav/#{@project1.identifier}/test.txt", :params => nil, :headers => @jsmith assert_response :success end diff --git a/test/integration/webdav/dmsf_webdav_head_test.rb b/test/integration/webdav/dmsf_webdav_head_test.rb index 962188bb..d7d07b82 100644 --- a/test/integration/webdav/dmsf_webdav_head_test.rb +++ b/test/integration/webdav/dmsf_webdav_head_test.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -71,13 +71,13 @@ class DmsfWebdavHeadTest < RedmineDmsf::Test::IntegrationTest end def test_head_responds_with_authentication - head "/dmsf/webdav/#{@project1.identifier}", nil, @admin + head "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => @admin assert_response :success check_headers_exist Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = true - head "/dmsf/webdav/#{@project1.identifier}", nil, @admin + head "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => @admin assert_response :not_found - head "/dmsf/webdav/#{@project1_uri}", nil, @admin + head "/dmsf/webdav/#{@project1_uri}", :params => nil, :headers => @admin assert_response :success end @@ -87,48 +87,48 @@ class DmsfWebdavHeadTest < RedmineDmsf::Test::IntegrationTest # (but may include an etag, so there is an allowance for a 1 in 2 failure rate on (optionally) required # headers) def test_head_responds_to_file - head "/dmsf/webdav/#{@project1.identifier}/test.txt", nil, @admin + head "/dmsf/webdav/#{@project1.identifier}/test.txt", :params => nil, :headers => @admin assert_response :success check_headers_exist # Note it'll allow 1 out of the 3 expected to fail Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = true - head "/dmsf/webdav/#{@project1.identifier}/test.txt", nil, @admin + head "/dmsf/webdav/#{@project1.identifier}/test.txt", :params => nil, :headers => @admin assert_response :not_found - head "/dmsf/webdav/#{@project1_uri}/test.txt", nil, @admin + head "/dmsf/webdav/#{@project1_uri}/test.txt", :params => nil, :headers => @admin assert_response :success end def test_head_responds_to_file_anonymous_other_user_agent - head "/dmsf/webdav/#{@project1.identifier}/test.txt", nil, {:HTTP_USER_AGENT => 'Other'} + head "/dmsf/webdav/#{@project1.identifier}/test.txt", :params => nil, :headers => {:HTTP_USER_AGENT => 'Other'} assert_response :unauthorized check_headers_dont_exist end def test_head_fails_when_file_not_found - head "/dmsf/webdav/#{@project1.identifier}/not_here.txt", nil, @admin + head "/dmsf/webdav/#{@project1.identifier}/not_here.txt", :params => nil, :headers => @admin assert_response :not_found check_headers_dont_exist end def test_head_fails_when_file_not_found_anonymous_other_user_agent - head "/dmsf/webdav/#{@project1.identifier}/not_here.txt", nil, {:HTTP_USER_AGENT => 'Other'} + head "/dmsf/webdav/#{@project1.identifier}/not_here.txt", :params => nil, :headers => {:HTTP_USER_AGENT => 'Other'} assert_response :unauthorized check_headers_dont_exist end def test_head_fails_when_folder_not_found - head '/dmsf/webdav/folder_not_here', nil, @admin + head '/dmsf/webdav/folder_not_here', :params => nil, :headers => @admin assert_response :not_found check_headers_dont_exist end def test_head_fails_when_folder_not_found_anonymous_other_user_agent - head '/dmsf/webdav/folder_not_here', nil, {:HTTP_USER_AGENT => 'Other'} + head '/dmsf/webdav/folder_not_here', :params => nil, :headers => {:HTTP_USER_AGENT => 'Other'} assert_response :unauthorized check_headers_dont_exist end def test_head_fails_when_project_is_not_enabled_for_dmsf - head "/dmsf/webdav/#{@project2.identifier}/test.txt", nil, @jsmith + head "/dmsf/webdav/#{@project2.identifier}/test.txt", :params => nil, :headers => @jsmith assert_response :not_found check_headers_dont_exist end diff --git a/test/integration/webdav/dmsf_webdav_lock_test.rb b/test/integration/webdav/dmsf_webdav_lock_test.rb index 946dd130..abea5540 100644 --- a/test/integration/webdav/dmsf_webdav_lock_test.rb +++ b/test/integration/webdav/dmsf_webdav_lock_test.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -57,20 +57,21 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest log_user 'admin', 'admin' # login as admin assert !User.current.anonymous?, 'Current user is anonymous' assert @file1.lock!, "File failed to be locked by #{User.current.name}" - xml_http_request :lock, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", + process :lock, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => %{ jsmith }, - @jsmith.merge!({ HTTP_DEPTH: 'infinity', HTTP_TIMEOUT: 'Infinite' }) + :headers => @jsmith.merge!({ HTTP_DEPTH: 'infinity', HTTP_TIMEOUT: 'Infinite' }) assert_response :locked end def test_lock_file create_time = Time.utc(2000, 1, 2, 3, 4, 5) refresh_time = Time.utc(2000, 1, 2, 6, 7, 8) + locktoken = nil # Time travel, will make the usec part of the time 0 travel_to create_time do @@ -81,8 +82,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest jsmith } - xml_http_request :lock, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", xml, - @jsmith.merge!({ HTTP_DEPTH: 'infinity', HTTP_TIMEOUT: 'Infinite' }) + process :lock, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => xml, + :headers => @jsmith.merge!({ HTTP_DEPTH: 'infinity', HTTP_TIMEOUT: 'Infinite' }) assert_response :success # Verify the response # @@ -113,22 +114,22 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest assert_equal create_time, l.created_at assert_equal create_time, l.updated_at assert_equal (create_time + 1.week), l.expires_at + end - travel_to refresh_time do - # Refresh lock - xml_http_request :lock, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", - nil, - @jsmith.merge!({ HTTP_DEPTH: 'infinity', HTTP_TIMEOUT: 'Infinite', HTTP_IF: locktoken }) - assert_response :success - # 1.week = 7*24*3600=604800 seconds - assert_match 'Second-604800', response.body - # Verify the lock in the db - @file1.reload - l = @file1.lock.first - assert_equal create_time, l.created_at - assert_equal refresh_time, l.updated_at - assert_equal (refresh_time + 1.week), l.expires_at - end + travel_to refresh_time do + # Refresh lock + process :lock, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", + :params => nil, + :headers => @jsmith.merge!({ HTTP_DEPTH: 'infinity', HTTP_TIMEOUT: 'Infinite', HTTP_IF: locktoken }) + assert_response :success + # 1.week = 7*24*3600=604800 seconds + assert_match 'Second-604800', response.body + # Verify the lock in the db + @file1.reload + l = @file1.lock.first + assert_equal create_time, l.created_at + assert_equal refresh_time, l.updated_at + assert_equal (refresh_time + 1.week), l.expires_at end end diff --git a/test/integration/webdav/dmsf_webdav_mkcol_test.rb b/test/integration/webdav/dmsf_webdav_mkcol_test.rb index b23357f1..d5f9ab86 100644 --- a/test/integration/webdav/dmsf_webdav_mkcol_test.rb +++ b/test/integration/webdav/dmsf_webdav_mkcol_test.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -66,28 +66,28 @@ class DmsfWebdavMkcolTest < RedmineDmsf::Test::IntegrationTest end def test_mkcol_requires_authentication - xml_http_request :mkcol, '/dmsf/webdav/test1' + process :mkcol, '/dmsf/webdav/test1' assert_response :unauthorized end def test_mkcol_fails_to_create_folder_at_root_level - xml_http_request :mkcol, '/dmsf/webdav/test1', nil, @admin + process :mkcol, '/dmsf/webdav/test1', :params => nil, :headers => @admin assert_response :method_not_allowed end def test_should_not_succeed_on_a_non_existant_project - xml_http_request :mkcol, '/dmsf/webdav/project_doesnt_exist/test1', nil, @admin + process :mkcol, '/dmsf/webdav/project_doesnt_exist/test1', :params => nil, :headers => @admin assert_response :not_found end def test_should_not_succed_on_a_non_dmsf_enabled_project - xml_http_request :mkcol, "/dmsf/webdav/#{@project1.identifier}/folder", nil, @jsmith + process :mkcol, "/dmsf/webdav/#{@project1.identifier}/folder", :params => nil, :headers => @jsmith assert_response :forbidden end def test_should_not_create_folder_without_permissions @project1.enable_module! :dmsf # Flag module enabled - xml_http_request :mkcol, "/dmsf/webdav/#{@project1.identifier}/folder", nil, @jsmith + process :mkcol, "/dmsf/webdav/#{@project1.identifier}/folder", :params => nil, :headers => @jsmith assert_response :forbidden end @@ -95,27 +95,27 @@ class DmsfWebdavMkcolTest < RedmineDmsf::Test::IntegrationTest @project1.enable_module! :dmsf # Flag module enabled @role.add_permission! :folder_manipulation @role.add_permission! :view_dmsf_folders - xml_http_request :mkcol, - "/dmsf/webdav/#{@project1.identifier}/#{@folder6.title}", nil, @jsmith + process :mkcol, + "/dmsf/webdav/#{@project1.identifier}/#{@folder6.title}", :params => nil, :headers => @jsmith assert_response :method_not_allowed end def test_should_fail_to_create_folder_for_user_without_rights @project1.enable_module! :dmsf # Flag module enabled - xml_http_request :mkcol, "/dmsf/webdav/#{@project1.identifier}/test1", nil, @jsmith + process :mkcol, "/dmsf/webdav/#{@project1.identifier}/test1", :params => nil, :headers => @jsmith assert_response :forbidden end def test_should_create_folder_for_non_admin_user_with_rights @project1.enable_module! :dmsf @role.add_permission! :folder_manipulation - xml_http_request :mkcol, "/dmsf/webdav/#{@project1.identifier}/test1", nil, @jsmith + process :mkcol, "/dmsf/webdav/#{@project1.identifier}/test1", :params => nil, :headers => @jsmith assert_response :success # Created Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = true project1_uri = Addressable::URI.escape(RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1)) - xml_http_request :mkcol, "/dmsf/webdav/#{@project1.identifier}/test2", nil, @jsmith + process :mkcol, "/dmsf/webdav/#{@project1.identifier}/test2", :params => nil, :headers => @jsmith assert_response :not_found - xml_http_request :mkcol, "/dmsf/webdav/#{project1_uri}/test3", nil, @jsmith + process :mkcol, "/dmsf/webdav/#{project1_uri}/test3", :params => nil, :headers => @jsmith assert_response :success # Created end diff --git a/test/integration/webdav/dmsf_webdav_move_test.rb b/test/integration/webdav/dmsf_webdav_move_test.rb index e904c440..ba3b8d07 100644 --- a/test/integration/webdav/dmsf_webdav_move_test.rb +++ b/test/integration/webdav/dmsf_webdav_move_test.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -75,8 +75,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest def test_move_denied_for_anonymous new_name = "#{@file1.name}.moved" assert_no_difference '@file1.dmsf_file_revisions.count' do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, - {:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"} + process :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, + :headers => {:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"} assert_response :unauthorized end end @@ -85,8 +85,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest @role.remove_permission! :folder_manipulation new_name = "#{@file1.name}.moved" assert_no_difference '@file1.dmsf_file_revisions.count' do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) assert_response :forbidden end end @@ -95,8 +95,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest @role.remove_permission! :folder_manipulation new_name = "#{@file1.name}.moved" assert_difference '@file1.dmsf_file_revisions.count', +1 do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, - @admin.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, + :headers => @admin.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) assert_response :created f = DmsfFile.find_file_by_name @project1, nil, "#{new_name}" assert f, "Moved file '#{new_name}' not found in project." @@ -104,16 +104,16 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest end def test_move_non_existent_file - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/not_a_file.txt", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/moved_file.txt"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/not_a_file.txt", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/moved_file.txt"}) assert_response :not_found # NotFound end def test_move_to_new_filename new_name = "#{@file1.name}.moved" assert_difference '@file1.dmsf_file_revisions.count', +1 do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) assert_response :created f = DmsfFile.find_file_by_name @project1, nil, "#{new_name}" assert f, "Moved file '#{new_name}' not found in project." @@ -125,8 +125,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest project1_uri = Addressable::URI.escape(RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1)) new_name = "#{@file1.name}.moved" assert_difference '@file1.dmsf_file_revisions.count', +1 do - xml_http_request :move, "/dmsf/webdav/#{project1_uri}/#{@file1.name}", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{project1_uri}/#{new_name}"}) + process :move, "/dmsf/webdav/#{project1_uri}/#{@file1.name}", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{project1_uri}/#{new_name}"}) assert_response :created f = DmsfFile.find_file_by_name @project1, nil, "#{new_name}" assert f, "Moved file '#{new_name}' not found in project." @@ -136,8 +136,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest def test_move_zero_sized_to_new_filename new_name = "#{@file10.name}.moved" assert_no_difference '@file10.dmsf_file_revisions.count' do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{@file10.name}", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/#{@file10.name}", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) assert_response :created f = DmsfFile.find_file_by_name @project1, nil, "#{new_name}" assert f, "Moved file '#{new_name}' not found in project." @@ -146,8 +146,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest def test_move_to_new_folder assert_difference '@file1.dmsf_file_revisions.count', +1 do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{@folder1.title}/#{@file1.name}"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{@folder1.title}/#{@file1.name}"}) assert_response :created @file1.reload assert_equal @folder1.id, @file1.dmsf_folder_id @@ -158,8 +158,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = true project1_uri = Addressable::URI.escape(RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1)) assert_difference '@file1.dmsf_file_revisions.count', +1 do - xml_http_request :move, "/dmsf/webdav/#{project1_uri}/#{@file1.name}", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{project1_uri}/#{@folder1.title}/#{@file1.name}"}) + process :move, "/dmsf/webdav/#{project1_uri}/#{@file1.name}", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{project1_uri}/#{@folder1.title}/#{@file1.name}"}) assert_response :created @file1.reload assert_equal @folder1.id, @file1.dmsf_folder_id @@ -168,8 +168,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest def test_move_zero_sized_to_new_folder assert_no_difference '@file10.dmsf_file_revisions.count' do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{@file10.name}", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{@folder1.title}/#{@file10.name}"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/#{@file10.name}", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{@folder1.title}/#{@file10.name}"}) assert_response :created @file10.reload assert_equal @folder1.id, @file10.dmsf_folder_id @@ -182,8 +182,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest new_name = "#{file9.name}" assert_no_difference 'file9.dmsf_file_revisions.count' do assert_no_difference '@file1.dmsf_file_revisions.count' do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) assert_response :not_implemented # NotImplemented end end @@ -195,8 +195,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest assert @file1.lock!, "File failed to be locked by #{User.current.name}" new_name = "#{@file1.name}.moved" assert_no_difference '@file1.dmsf_file_revisions.count' do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) assert_response :locked end end @@ -208,8 +208,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest new_name = "#{@file1.name}.moved" assert_no_difference '@file1.dmsf_file_revisions.count' do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, - @admin.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, + :headers => @admin.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) assert_response :locked end end @@ -222,15 +222,15 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest # Move once new_name = "#{@file1.name}.m1" assert_difference '@file1.dmsf_file_revisions.count', +1 do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name}"}) assert_response :success # Created end # Move twice, make sure that the MsOffice store sequence is not disrupting normal move new_name2 = "#{new_name}.m2" assert_difference '@file1.dmsf_file_revisions.count', +1 do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{new_name}", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name2}"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/#{new_name}", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{new_name2}"}) assert_response :success # Created end end @@ -255,8 +255,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest # Move the original file to AAAAAAAA.tmp. The original file should not changed but a new file should be created. assert_no_difference '@file1.dmsf_file_revisions.count' do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{temp_file_name}"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{temp_file_name}"}) assert_response :success # Created end @@ -268,8 +268,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest # Move a temporary file (use AAAAAAAA.tmp) to the original file. assert_difference '@file1.dmsf_file_revisions.count', +1 do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{temp_file_name}", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{@file1.name}"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/#{temp_file_name}", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{@file1.name}"}) assert_response :success # Created end @@ -282,8 +282,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest # Move the original file to BBBBBBBB.tmp. The original file should not change but a new file should be created. assert_no_difference '@file1.dmsf_file_revisions.count' do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{temp_file_name}"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/#{@file1.name}", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{temp_file_name}"}) assert_response :success # Created end @@ -295,8 +295,8 @@ class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest # Move a temporary file (use BBBBBBBB.tmp) to the original file. assert_no_difference '@file1.dmsf_file_revisions.count' do - xml_http_request :move, "/dmsf/webdav/#{@project1.identifier}/#{temp_file_name}", nil, - @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{@file1.name}"}) + process :move, "/dmsf/webdav/#{@project1.identifier}/#{temp_file_name}", :params => nil, + :headers => @jsmith.merge!({:destination => "http://www.example.com/dmsf/webdav/#{@project1.identifier}/#{@file1.name}"}) assert_response :success # Created end end diff --git a/test/integration/webdav/dmsf_webdav_options_test.rb b/test/integration/webdav/dmsf_webdav_options_test.rb index dcaea560..83821894 100644 --- a/test/integration/webdav/dmsf_webdav_options_test.rb +++ b/test/integration/webdav/dmsf_webdav_options_test.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -51,13 +51,13 @@ class DmsfWebdavOptionsTest < RedmineDmsf::Test::IntegrationTest end def test_options_requires_no_authentication_for_root_level - xml_http_request :options, '/dmsf/webdav' + process :options, '/dmsf/webdav' assert_response :success end def test_options_returns_expected_allow_header_for_ro Setting.plugin_redmine_dmsf['dmsf_webdav_strategy'] = 'WEBDAV_READ_ONLY' - xml_http_request :options, '/dmsf/webdav' + process :options, '/dmsf/webdav' assert_response :success assert !(response.headers.nil? || response.headers.empty?), 'Response headers are empty' assert response.headers['Allow'] , 'Allow header is empty or does not exist' @@ -65,7 +65,7 @@ class DmsfWebdavOptionsTest < RedmineDmsf::Test::IntegrationTest end def test_options_returns_expected_allow_header_for_rw - xml_http_request :options, '/dmsf/webdav' + process :options, '/dmsf/webdav' assert_response :success assert !(response.headers.nil? || response.headers.empty?), 'Response headers are empty' assert response.headers['Allow'] , 'Allow header is empty or does not exist' @@ -74,14 +74,14 @@ class DmsfWebdavOptionsTest < RedmineDmsf::Test::IntegrationTest end def test_options_returns_expected_dav_header - xml_http_request :options, '/dmsf/webdav' + process :options, '/dmsf/webdav' assert_response :success assert !(response.headers.nil? || response.headers.empty?), 'Response headers are empty' assert response.headers['Dav'] , 'Dav header is empty or does not exist' end def test_options_returns_expected_ms_auth_via_header - xml_http_request :options, '/dmsf/webdav' + process :options, '/dmsf/webdav' assert_response :success assert !(response.headers.nil? || response.headers.empty?), 'Response headers are empty' assert response.headers['Ms-Author-Via'] , 'Ms-Author-Via header is empty or does not exist' @@ -89,33 +89,33 @@ class DmsfWebdavOptionsTest < RedmineDmsf::Test::IntegrationTest end def test_options_requires_authentication_for_non_root_request - xml_http_request :options, "/dmsf/webdav/#{@project1.identifier}" + process :options, "/dmsf/webdav/#{@project1.identifier}" assert_response :unauthorized end def test_un_authenticated_options_returns_expected_allow_header - xml_http_request :options, "/dmsf/webdav/#{@project1.identifier}" + process :options, "/dmsf/webdav/#{@project1.identifier}" assert_response :unauthorized assert !(response.headers.nil? || response.headers.empty?), 'Response headers are empty' assert_nil response.headers['Allow'] , 'Allow header should not exist' end def test_un_authenticated_options_returns_expected_dav_header - xml_http_request :options, "/dmsf/webdav/#{@project1.identifier}" + process :options, "/dmsf/webdav/#{@project1.identifier}" assert_response :unauthorized assert !(response.headers.nil? || response.headers.empty?), 'Response headers are empty' assert_nil response.headers['Dav'] , 'Dav header should not exist' end def test_un_authenticated_options_returns_expected_ms_auth_via_header - xml_http_request :options, "/dmsf/webdav/#{@project1.identifier}" + process :options, "/dmsf/webdav/#{@project1.identifier}" assert_response :unauthorized assert !(response.headers.nil? || response.headers.empty?), 'Response headers are empty' assert_nil response.headers['Ms-Author-Via'] , 'Ms-Author-Via header should not exist' end def test_authenticated_options_returns_expected_allow_header - xml_http_request :options, "/dmsf/webdav/#{@project1.identifier}", nil, @jsmith + process :options, "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => @jsmith assert_response :success assert !(response.headers.nil? || response.headers.empty?), 'Response headers are empty' assert response.headers['Allow'], 'Allow header is empty or does not exist' @@ -124,14 +124,14 @@ class DmsfWebdavOptionsTest < RedmineDmsf::Test::IntegrationTest end def test_authenticated_options_returns_expected_dav_header - xml_http_request :options, "/dmsf/webdav/#{@project1.identifier}", nil, @jsmith + process :options, "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => @jsmith assert_response :success assert !(response.headers.nil? || response.headers.empty?), 'Response headers are empty' assert response.headers['Dav'], 'Dav header is empty or does not exist' end def test_authenticated_options_returns_expected_ms_auth_via_header - xml_http_request :options, "/dmsf/webdav/#{@project1.identifier}", nil, @jsmith + process :options, "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => @jsmith assert_response :success assert !(response.headers.nil? || response.headers.empty?), 'Response headers are empty' assert response.headers['Ms-Author-Via'], 'Ms-Author-Via header is empty or does not exist' @@ -139,40 +139,40 @@ class DmsfWebdavOptionsTest < RedmineDmsf::Test::IntegrationTest end def test_un_authenticated_options_for_msoffice_user_agent - xml_http_request :options, "/dmsf/webdav/#{@project1.identifier}", nil, {:HTTP_USER_AGENT => 'Microsoft Office Word 2014'} + process :options, "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => {:HTTP_USER_AGENT => 'Microsoft Office Word 2014'} assert_response :unauthorized end def test_authenticated_options_for_msoffice_user_agent - xml_http_request :options, "/dmsf/webdav/#{@project1.identifier}", nil, - @admin.merge!({:HTTP_USER_AGENT => 'Microsoft Office Word 2014'}) + process :options, "/dmsf/webdav/#{@project1.identifier}", :params => nil, + :headers => @admin.merge!({:HTTP_USER_AGENT => 'Microsoft Office Word 2014'}) assert_response :success end def test_un_authenticated_options_for_other_user_agent - xml_http_request :options, "/dmsf/webdav/#{@project1.identifier}", nil, {:HTTP_USER_AGENT => 'Other'} + process :options, "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => {:HTTP_USER_AGENT => 'Other'} assert_response :unauthorized end def test_authenticated_options_for_other_user_agent - xml_http_request :options, "/dmsf/webdav/#{@project1.identifier}", nil, @admin.merge!({:HTTP_USER_AGENT => 'Other'}) + process :options, "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => @admin.merge!({:HTTP_USER_AGENT => 'Other'}) assert_response :success Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = true project1_uri = Addressable::URI.escape(RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1)) - xml_http_request :options, "/dmsf/webdav/#{@project1.identifier}", nil, @admin.merge!({:HTTP_USER_AGENT => 'Other'}) + process :options, "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => @admin.merge!({:HTTP_USER_AGENT => 'Other'}) assert_response :not_found - xml_http_request :options, "/dmsf/webdav/#{project1_uri}", nil, @admin.merge!({:HTTP_USER_AGENT => 'Other'}) + process :options, "/dmsf/webdav/#{project1_uri}", :params => nil, :headers => @admin.merge!({:HTTP_USER_AGENT => 'Other'}) assert_response :success end def test_authenticated_options_returns_404_for_non_dmsf_enabled_items @project2.disable_module! :dmsf - xml_http_request :options, "/dmsf/webdav/#{@project2.identifier}", nil, @jsmith + process :options, "/dmsf/webdav/#{@project2.identifier}", :params => nil, :headers => @jsmith assert_response :not_found end def test_authenticated_options_returns_404_for_not_found - xml_http_request :options, '/dmsf/webdav/does-not-exist', nil, @jsmith + process :options, '/dmsf/webdav/does-not-exist', :params => nil, :headers => @jsmith assert_response :not_found end diff --git a/test/integration/webdav/dmsf_webdav_post_test.rb b/test/integration/webdav/dmsf_webdav_post_test.rb index 72ff6160..fc438570 100644 --- a/test/integration/webdav/dmsf_webdav_post_test.rb +++ b/test/integration/webdav/dmsf_webdav_post_test.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -43,7 +43,7 @@ class DmsfWebdavPostTest < RedmineDmsf::Test::IntegrationTest # Test post is not implemented def test_post_not_implemented - post '/dmsf/webdav/', nil, @admin + post '/dmsf/webdav/', :params => nil, :headers => @admin assert_response :not_implemented end diff --git a/test/integration/webdav/dmsf_webdav_propfind_test.rb b/test/integration/webdav/dmsf_webdav_propfind_test.rb index 8b0bcb82..e97c1147 100644 --- a/test/integration/webdav/dmsf_webdav_propfind_test.rb +++ b/test/integration/webdav/dmsf_webdav_propfind_test.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -63,26 +63,26 @@ class DmsfWebdavPropfindTest < RedmineDmsf::Test::IntegrationTest end def test_propfind_denied_for_anonymous - xml_http_request :propfind, '/dmsf/webdav/', nil, {:HTTP_DEPTH => '0'} + process :propfind, '/dmsf/webdav/', :params => nil, :headers => {:HTTP_DEPTH => '0'} assert_response :unauthorized end def test_propfind_depth0_on_root_for_non_member - xml_http_request :propfind, '/dmsf/webdav/', nil, @jsmith.merge!({:HTTP_DEPTH => '0'}) + process :propfind, '/dmsf/webdav/', :params => nil, :headers => @jsmith.merge!({:HTTP_DEPTH => '0'}) assert_response :multi_status assert response.body.include?('http://www.example.com:80/dmsf/webdav/') assert response.body.include?('/') end def test_propfind_depth1_on_root_for_non_member - xml_http_request :propfind, '/dmsf/webdav/', nil, @jsmith.merge!({:HTTP_DEPTH => '1'}) + process :propfind, '/dmsf/webdav/', :params => nil, :headers => @jsmith.merge!({:HTTP_DEPTH => '1'}) assert_response :multi_status assert response.body.include?('http://www.example.com:80/dmsf/webdav/') assert response.body.include?( '/') end def test_propfind_depth0_on_root_for_admin - xml_http_request :propfind, '/dmsf/webdav/', nil, @admin.merge!({:HTTP_DEPTH => '0'}) + process :propfind, '/dmsf/webdav/', :params => nil, :headers => @admin.merge!({:HTTP_DEPTH => '0'}) assert_response :multi_status assert response.body.include?('http://www.example.com:80/dmsf/webdav/') assert response.body.include?('/') @@ -90,7 +90,7 @@ class DmsfWebdavPropfindTest < RedmineDmsf::Test::IntegrationTest def test_propfind_depth1_on_root_for_admin_with_project_names Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = true - xml_http_request :propfind, '/dmsf/webdav/', nil, @admin.merge!({:HTTP_DEPTH => '1'}) + process :propfind, '/dmsf/webdav/', :params => nil, :headers => @admin.merge!({:HTTP_DEPTH => '1'}) assert_response :multi_status assert response.body.include?('http://www.example.com:80/dmsf/webdav/') assert response.body.include?('/') @@ -103,12 +103,12 @@ class DmsfWebdavPropfindTest < RedmineDmsf::Test::IntegrationTest end def test_propfind_depth0_on_project1_for_non_member - xml_http_request :propfind, "/dmsf/webdav/#{@project1.identifier}", nil, @jsmith.merge!({:HTTP_DEPTH => '0'}) + process :propfind, "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => @jsmith.merge!({:HTTP_DEPTH => '0'}) assert_response :not_found end def test_propfind_depth0_on_project1_for_admin - xml_http_request :propfind, "/dmsf/webdav/#{@project1.identifier}", nil, @admin.merge!({:HTTP_DEPTH => '0'}) + process :propfind, "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => @admin.merge!({:HTTP_DEPTH => '0'}) assert_response :multi_status assert response.body.include?("http://www.example.com:80/dmsf/webdav/#{@project1.identifier}/") assert response.body.include?("#{@project1.identifier}") @@ -116,16 +116,16 @@ class DmsfWebdavPropfindTest < RedmineDmsf::Test::IntegrationTest def test_propfind_depth0_on_project1_for_admin_with_project_names Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = true - xml_http_request :propfind, "/dmsf/webdav/#{@project1.identifier}", nil, @admin.merge!({:HTTP_DEPTH => '0'}) + process :propfind, "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => @admin.merge!({:HTTP_DEPTH => '0'}) assert_response :not_found - xml_http_request :propfind, "/dmsf/webdav/#{@project1_uri}", nil, @admin.merge!({:HTTP_DEPTH => '0'}) + process :propfind, "/dmsf/webdav/#{@project1_uri}", :params => nil, :headers => @admin.merge!({:HTTP_DEPTH => '0'}) assert_response :multi_status assert response.body.include?("http://www.example.com:80/dmsf/webdav/#{@project1_uri}/") assert response.body.include?("#{@project1_name}") end def test_propfind_depth1_on_project1_for_admin - xml_http_request :propfind, "/dmsf/webdav/#{@project1.identifier}", nil, @admin.merge!({:HTTP_DEPTH => '1'}) + process :propfind, "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => @admin.merge!({:HTTP_DEPTH => '1'}) assert_response :multi_status # Project assert response.body.include?("http://www.example.com:80/dmsf/webdav/#{@project1.identifier}/") @@ -146,9 +146,9 @@ class DmsfWebdavPropfindTest < RedmineDmsf::Test::IntegrationTest def test_propfind_depth1_on_project1_for_admin_with_project_names Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = true - xml_http_request :propfind, "/dmsf/webdav/#{@project1.identifier}", nil, @admin.merge!({:HTTP_DEPTH => '1'}) + process :propfind, "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => @admin.merge!({:HTTP_DEPTH => '1'}) assert_response :not_found - xml_http_request :propfind, "/dmsf/webdav/#{@project1_uri}", nil, @admin.merge!({:HTTP_DEPTH => '1'}) + process :propfind, "/dmsf/webdav/#{@project1_uri}", :params => nil, :headers => @admin.merge!({:HTTP_DEPTH => '1'}) assert_response :multi_status # Project assert response.body.include?("http://www.example.com:80/dmsf/webdav/#{@project1_uri}/") @@ -171,7 +171,7 @@ class DmsfWebdavPropfindTest < RedmineDmsf::Test::IntegrationTest @project1.save! project1_new_name = RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1) project1_new_uri = Addressable::URI.escape(project1_new_name) - xml_http_request :propfind, "/dmsf/webdav/#{project1_new_uri}", nil, @admin.merge!({:HTTP_DEPTH => '1'}) + process :propfind, "/dmsf/webdav/#{project1_new_uri}", :params => nil, :headers => @admin.merge!({:HTTP_DEPTH => '1'}) assert_response :multi_status assert response.body.include?("http://www.example.com:80/dmsf/webdav/#{project1_new_uri}/") assert response.body.include?("#{project1_new_name}") diff --git a/test/integration/webdav/dmsf_webdav_put_test.rb b/test/integration/webdav/dmsf_webdav_put_test.rb index f85a0584..eff05997 100644 --- a/test/integration/webdav/dmsf_webdav_put_test.rb +++ b/test/integration/webdav/dmsf_webdav_put_test.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -74,46 +74,46 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest end def test_put_denied_with_failed_authentication_root - put '/dmsf/webdav', nil, credentials('admin', 'badpassword') + put '/dmsf/webdav', :params => nil, :headers => credentials('admin', 'badpassword') assert_response :unauthorized end def test_put_denied_with_failed_authentication - put "/dmsf/webdav/#{@project1.identifier}", nil, credentials('admin', 'badpassword') + put "/dmsf/webdav/#{@project1.identifier}", :params => nil, :headers => credentials('admin', 'badpassword') assert_response :unauthorized end def test_put_denied_at_root_level - put '/dmsf/webdav/test.txt', '1234', @admin.merge!({:content_type => :text}) + put '/dmsf/webdav/test.txt', :params => '1234', :headers => @admin.merge!({:content_type => :text}) assert_response :not_implemented end def test_put_denied_on_folder - put "/dmsf/webdav/#{@project1.identifier}", '1234', @admin.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}", :params => '1234', :headers => @admin.merge!({:content_type => :text}) assert_response :forbidden end def test_put_failed_on_non_existant_project - put '/dmsf/webdav/not_a_project/file.txt', '1234', @admin.merge!({:content_type => :text}) + put '/dmsf/webdav/not_a_project/file.txt', :params => '1234', :headers => @admin.merge!({:content_type => :text}) assert_response :conflict # not_a_project does not exist - file.txt cannot be created end def test_put_as_admin_granted_on_dmsf_enabled_project - put "/dmsf/webdav/#{@project1.identifier}/test-1234.txt", '1234', @admin.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/test-1234.txt", :params => '1234', :headers => @admin.merge!({:content_type => :text}) assert_response :created # Lets check for our file file = DmsfFile.find_file_by_name @project1, nil, 'test-1234.txt' assert file, 'Check for files existance' Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = true project1_uri = Addressable::URI.escape(RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1)) - put "/dmsf/webdav/#{@project1.identifier}/test-1234.txt", '1234', @admin.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/test-1234.txt", :params => '1234', :headers => @admin.merge!({:content_type => :text}) assert_response :conflict - put "/dmsf/webdav/#{project1_uri}/test-1234.txt", '1234', @admin.merge!({:content_type => :text}) + put "/dmsf/webdav/#{project1_uri}/test-1234.txt", :params => '1234', :headers => @admin.merge!({:content_type => :text}) assert_response :created end def test_put_failed_as_jsmith_on_non_dmsf_enabled_project - put "/dmsf/webdav/#{@project2.identifier}/test-1234.txt", '1234', @jsmith.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project2.identifier}/test-1234.txt", :params => '1234', :headers => @jsmith.merge!({:content_type => :text}) assert_response :conflict # Should report conflict, as project 2 technically doesn't exist if not enabled # Lets check for our file file = DmsfFile.find_file_by_name @project2, nil, 'test-1234.txt' @@ -122,14 +122,14 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest def test_put_failed_when_no_permission @project2.enable_module! :dmsf # Flag module enabled - put "/dmsf/webdav/#{@project1.identifier}/test-1234.txt", '1234', @jsmith.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/test-1234.txt", :params => '1234', :headers => @jsmith.merge!({:content_type => :text}) assert_response :conflict # We don't hold the permission view_dmsf_folders, and thus project 2 doesn't exist to us. end def test_put_failed_when_no_file_manipulation_permission @project1.enable_module! :dmsf # Flag module enabled @role.add_permission! :view_dmsf_folders - put "/dmsf/webdav/#{@project1.identifier}/test-1234.txt", '1234', @jsmith.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/test-1234.txt", :params => '1234', :headers => @jsmith.merge!({:content_type => :text}) assert_response :forbidden # We don't hold the permission file_manipulation - so we're unable to do anything with files end @@ -137,7 +137,7 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest @project1.enable_module! :dmsf # Flag module enabled @role.add_permission! :file_manipulation # Check we don't have write access even if we do have the file_manipulation permission - put "/dmsf/webdav/#{@project1.identifier}/test-1234.txt", '1234', @jsmith.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/test-1234.txt", :params => '1234', :headers => @jsmith.merge!({:content_type => :text}) assert_response :conflict # We don't hold the permission view_dmsf_folders, and thus project 2 doesn't exist to us. # Lets check for our file file = DmsfFile.find_file_by_name @project1, nil, 'test-1234.txt' @@ -148,7 +148,7 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest @project1.enable_module! :dmsf # Flag module enabled @role.add_permission! :view_dmsf_folders @role.add_permission! :file_manipulation - put "/dmsf/webdav/#{@project1.identifier}/test-1234.txt", '1234', @jsmith.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/test-1234.txt", :params => '1234', :headers => @jsmith.merge!({:content_type => :text}) assert_response :created # Now we have permissions # Lets check for our file file = DmsfFile.find_file_by_name @project1, nil, 'test-1234.txt' @@ -157,9 +157,9 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest assert_equal file.last_revision.digest_type, 'SHA256' Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = true project1_uri = Addressable::URI.escape(RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1)) - put "/dmsf/webdav/#{@project1.identifier}/test-1234.txt", '1234', @jsmith.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/test-1234.txt", :params => '1234', :headers => @jsmith.merge!({:content_type => :text}) assert_response :conflict - put "/dmsf/webdav/#{project1_uri}/test-1234.txt", '1234', @jsmith.merge!({:content_type => :text}) + put "/dmsf/webdav/#{project1_uri}/test-1234.txt", :params => '1234', :headers => @jsmith.merge!({:content_type => :text}) assert_response :created # Now we have permissions end @@ -170,7 +170,7 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest file = DmsfFile.find_file_by_name @project1, nil, 'test.txt' assert_not_nil file, 'test.txt file not found' assert_difference 'file.dmsf_file_revisions.count', +1 do - put "/dmsf/webdav/#{@project1.identifier}/test.txt", '1234', @jsmith.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/test.txt", :params => '1234', :headers => @jsmith.merge!({:content_type => :text}) assert_response :created end end @@ -184,7 +184,7 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest file = DmsfFile.find_file_by_name @project1, nil, 'test.txt' assert file.lock!, "File failed to be locked by #{User.current.name}" assert_no_difference 'file.dmsf_file_revisions.count' do - put "/dmsf/webdav/#{@project1.identifier}/test.txt", '1234', @jsmith.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/test.txt", :params => '1234', :headers => @jsmith.merge!({:content_type => :text}) assert_response :locked end end @@ -198,7 +198,7 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest file = DmsfFile.find_file_by_name @project1, nil, 'test.txt' assert file.lock!, "File failed to be locked by #{User.current.name}" assert_no_difference 'file.dmsf_file_revisions.count' do - put "/dmsf/webdav/#{@project1.identifier}/test.txt", '1234', @admin.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/test.txt", :params => '1234', :headers => @admin.merge!({:content_type => :text}) assert_response :locked end end @@ -216,12 +216,12 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest # First PUT should always create new revision. assert_difference 'file.dmsf_file_revisions.count', +1 do - put "/dmsf/webdav/#{@project1.identifier}/test.txt", '1234', @jsmith.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/test.txt", :params => '1234', :headers => @jsmith.merge!({:content_type => :text}) assert_response :created end # Second PUT on a locked file should only update the revision that were created on the first PUT assert_no_difference 'file.dmsf_file_revisions.count' do - put "/dmsf/webdav/#{@project1.identifier}/test.txt", '1234', @jsmith.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/test.txt", :params => '1234', :headers => @jsmith.merge!({:content_type => :text}) assert_response :created end # Unlock @@ -237,12 +237,12 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest # First PUT should always create new revision. assert_difference 'file.dmsf_file_revisions.count', +1 do - put "/dmsf/webdav/#{@project1.identifier}/test.txt", '1234', @jsmith.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/test.txt", :params => '1234', :headers => @jsmith.merge!({:content_type => :text}) assert_response :created end # Second PUT on a locked file should only update the revision that were created on the first PUT assert_no_difference 'file.dmsf_file_revisions.count' do - put "/dmsf/webdav/#{@project1.identifier}/test.txt", '1234', @jsmith.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/test.txt", :params => '1234', :headers => @jsmith.merge!({:content_type => :text}) assert_response :created end end @@ -252,15 +252,15 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest @project1.enable_module! :dmsf @role.add_permission! :view_dmsf_folders @role.add_permission! :file_manipulation - put "/dmsf/webdav/#{@project1.identifier}/._test.txt", '1234', @admin.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/._test.txt", :params => '1234', :headers => @admin.merge!({:content_type => :text}) assert_response :no_content - put "/dmsf/webdav/#{@project1.identifier}/.DS_Store", '1234', @admin.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/.DS_Store", :params => '1234', :headers => @admin.merge!({:content_type => :text}) assert_response :no_content - put "/dmsf/webdav/#{@project1.identifier}/Thumbs.db", '1234', @admin.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/Thumbs.db", :params => '1234', :headers => @admin.merge!({:content_type => :text}) assert_response :no_content original = Setting.plugin_redmine_dmsf['dmsf_webdav_ignore'] Setting.plugin_redmine_dmsf['dmsf_webdav_ignore'] = '.dump$' - put "/dmsf/webdav/#{@project1.identifier}/test.dump", '1234', @admin.merge!({:content_type => :text}) + put "/dmsf/webdav/#{@project1.identifier}/test.dump", :params => '1234', :headers => @admin.merge!({:content_type => :text}) assert_response :no_content Setting.plugin_redmine_dmsf['dmsf_webdav_ignore'] = original end @@ -271,44 +271,44 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest @role.add_permission! :file_manipulation credentials = @admin.merge!({ content_type: :text }) - put "/dmsf/webdav/#{@project1.identifier}/file1.tmp", '1234', credentials + put "/dmsf/webdav/#{@project1.identifier}/file1.tmp", :params => '1234', :headers => credentials assert_response :success file1 = DmsfFile.find_by(project_id: @project1.id, dmsf_folder: nil, name: 'file1.tmp') assert file1 assert_difference 'file1.dmsf_file_revisions.count', 0 do - put "/dmsf/webdav/#{@project1.identifier}/file1.tmp", '5678', credentials + put "/dmsf/webdav/#{@project1.identifier}/file1.tmp", :params => '5678', :headers => credentials assert_response :created end assert_difference 'file1.dmsf_file_revisions.count', 0 do - put "/dmsf/webdav/#{@project1.identifier}/file1.tmp", '9ABC', credentials + put "/dmsf/webdav/#{@project1.identifier}/file1.tmp", :params => '9ABC', :headers => credentials assert_response :created end - put "/dmsf/webdav/#{@project1.identifier}/~$file2.txt", '1234', credentials + put "/dmsf/webdav/#{@project1.identifier}/~$file2.txt", :params => '1234', :headers => credentials assert_response :success file2 = DmsfFile.find_by(project_id: @project1.id, dmsf_folder_id: nil, name: '~$file2.txt') assert file2 assert_difference 'file2.dmsf_file_revisions.count', 0 do - put "/dmsf/webdav/#{@project1.identifier}/~$file2.txt", '5678', credentials + put "/dmsf/webdav/#{@project1.identifier}/~$file2.txt", :params => '5678', :headers => credentials assert_response :created end assert_difference 'file2.dmsf_file_revisions.count', 0 do - put "/dmsf/webdav/#{@project1.identifier}/~$file2.txt", '9ABC', credentials + put "/dmsf/webdav/#{@project1.identifier}/~$file2.txt", :params => '9ABC', :headers => credentials assert_response :created end original = Setting.plugin_redmine_dmsf['dmsf_webdav_disable_versioning'] Setting.plugin_redmine_dmsf['dmsf_webdav_disable_versioning'] = '.dump$' - put "/dmsf/webdav/#{@project1.identifier}/file3.dump", '1234', credentials + put "/dmsf/webdav/#{@project1.identifier}/file3.dump", :params => '1234', :headers => credentials assert_response :success file3 = DmsfFile.find_by(project_id: @project1.id, dmsf_folder_id: nil, name: 'file3.dump') assert file3 assert_difference 'file3.dmsf_file_revisions.count', 0 do - put "/dmsf/webdav/#{@project1.identifier}/file3.dump", '5678', credentials + put "/dmsf/webdav/#{@project1.identifier}/file3.dump", :params => '5678', :headers => credentials assert_response :created end assert_difference 'file3.dmsf_file_revisions.count', 0 do - put "/dmsf/webdav/#{@project1.identifier}/file3.dump", '9ABC', credentials + put "/dmsf/webdav/#{@project1.identifier}/file3.dump", :params => '9ABC', :headers => credentials assert_response :created end Setting.plugin_redmine_dmsf['dmsf_webdav_disable_versioning'] = original diff --git a/test/test_helper.rb b/test/test_helper.rb index 018c6142..339ba58f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -4,7 +4,7 @@ # # Copyright © 2011 Vít Jonáš # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/test/unit/attachable_patch_test.rb b/test/unit/attachable_patch_test.rb index 2bcad8ea..7fbbc718 100644 --- a/test/unit/attachable_patch_test.rb +++ b/test/unit/attachable_patch_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/test/unit/dmsf_file_revision_test.rb b/test/unit/dmsf_file_revision_test.rb index 98612c86..36eac40c 100644 --- a/test/unit/dmsf_file_revision_test.rb +++ b/test/unit/dmsf_file_revision_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/test/unit/dmsf_file_test.rb b/test/unit/dmsf_file_test.rb index 3da1f607..84abc6d8 100644 --- a/test/unit/dmsf_file_test.rb +++ b/test/unit/dmsf_file_test.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/test/unit/dmsf_folder_permission_test.rb b/test/unit/dmsf_folder_permission_test.rb index cfe9bf41..039b0305 100644 --- a/test/unit/dmsf_folder_permission_test.rb +++ b/test/unit/dmsf_folder_permission_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/test/unit/dmsf_folder_test.rb b/test/unit/dmsf_folder_test.rb index 0f363612..03a76ad9 100644 --- a/test/unit/dmsf_folder_test.rb +++ b/test/unit/dmsf_folder_test.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -22,7 +22,8 @@ require File.expand_path('../../test_helper', __FILE__) class DmsfFolderTest < RedmineDmsf::Test::UnitTest - fixtures :projects, :users, :email_addresses, :dmsf_folders, :roles, :members, :member_roles, :dmsf_folder_permissions + fixtures :projects, :users, :email_addresses, :dmsf_folders, :roles, :members, :member_roles, + :dmsf_folder_permissions def setup @project = Project.find 1 @@ -35,8 +36,8 @@ class DmsfFolderTest < RedmineDmsf::Test::UnitTest @folder7 = DmsfFolder.find 7 @manager = User.find 2 @developer = User.find 3 - manager_role = Role.find 1 - manager_role.add_permission! :view_dmsf_folders + @manager_role = Role.find 1 + @manager_role.add_permission! :view_dmsf_folders developer_role = Role.find 2 developer_role.add_permission! :view_dmsf_folders User.current = @manager @@ -52,6 +53,7 @@ class DmsfFolderTest < RedmineDmsf::Test::UnitTest assert_kind_of Project, @project assert_kind_of User, @manager assert_kind_of User, @developer + assert_kind_of Role, @manager_role end def test_visiblity @@ -188,4 +190,17 @@ class DmsfFolderTest < RedmineDmsf::Test::UnitTest assert_equal 'test', DmsfFolder::get_valid_title("test#{DmsfFolder::INVALID_CHARACTERS}") end + def test_permission_for_role + checked, disabled = @folder7.permission_for_role(@manager_role) + assert checked + assert !disabled + end + + def test_permissions_users + users = @folder7.permissions_users + assert users.any? + assert users[0] + assert !users[1] + end + end \ No newline at end of file diff --git a/test/unit/dmsf_link_test.rb b/test/unit/dmsf_link_test.rb index 8e0ea792..e63c7576 100644 --- a/test/unit/dmsf_link_test.rb +++ b/test/unit/dmsf_link_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -111,13 +111,18 @@ class DmsfLinksTest < RedmineDmsf::Test::UnitTest assert_equal 1, @file_link.errors.size end - def test_validate_external_url + def test_validate_external_url_invalid @file_link.target_type = 'DmsfUrl' @file_link.external_url = 'htt ps://abc.xyz' - assert !@file_link.save, - "External URL link #{@file_link.name} should have not been saved" + assert !@file_link.save, "External URL link #{@file_link.name} should have not been saved" assert_equal 1, @file_link.errors.size end + + def test_validate_external_url_valid + @file_link.target_type = 'DmsfUrl' + @file_link.external_url = 'https://www.google.com/search?q=寿司' + assert @file_link.save + end def test_belongs_to_project @project1.destroy diff --git a/test/unit/dmsf_lock_test.rb b/test/unit/dmsf_lock_test.rb index 6759c00d..c8030d24 100644 --- a/test/unit/dmsf_lock_test.rb +++ b/test/unit/dmsf_lock_test.rb @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright © 2012 Daniel Munn -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/test/unit/dmsf_mailer_test.rb b/test/unit/dmsf_mailer_test.rb index fb97f19a..0c008da4 100644 --- a/test/unit/dmsf_mailer_test.rb +++ b/test/unit/dmsf_mailer_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -23,14 +23,21 @@ require File.expand_path('../../test_helper', __FILE__) class DmsfMailerTest < RedmineDmsf::Test::UnitTest include Redmine::I18n - fixtures :users, :projects, :dmsf_files, :dmsf_workflows, :dmsf_file_revisions, :members + fixtures :users, :projects, :dmsf_files, :dmsf_workflows, :dmsf_file_revisions, :members, :email_addresses, + :roles, :member_roles def setup @user2 = User.find 2 @file1 = DmsfFile.find 1 + @file1.notify_activate @wf1 = DmsfWorkflow.find 1 @rev2 = DmsfFileRevision.find 2 @project1 = Project.find 1 + # Mailer settings + ActionMailer::Base.deliveries.clear + Setting.plain_text_mail = '0' + Setting.default_language = 'en' + User.current = nil end def test_truth @@ -42,15 +49,15 @@ class DmsfMailerTest < RedmineDmsf::Test::UnitTest end def test_files_updated - email = DmsfMailer.files_updated(@user2, @file1.project, [@file1]).deliver - assert email + DmsfMailer.deliver_files_updated(@file1.project, [@file1]) + email = last_email assert text_part(email).body.include? @file1.project.name assert html_part(email).body.include? @file1.project.name end def test_files_deleted - email = DmsfMailer.files_deleted(@user2, @file1.project, [@file1]).deliver - assert email + DmsfMailer.deliver_files_deleted(@file1.project, [@file1]) + email = last_email assert text_part(email).body.include? @file1.project.name assert html_part(email).body.include? @file1.project.name end @@ -58,40 +65,40 @@ class DmsfMailerTest < RedmineDmsf::Test::UnitTest def test_send_documents email_params = Hash.new body = 'Test' + email_params[:to] = @user2.mail + email_params[:from] = @user2.mail email_params[:body] = body email_params[:links_only] = '1' email_params[:public_urls] == '0' - email_params[:expired_at] = Date.today + email_params[:expired_at] = DateTime.current.to_s email_params[:folders] = nil email_params[:files] = "[\"#{@file1.id}\"]" - email = DmsfMailer.send_documents(@file1.project, email_params).deliver - assert email + DmsfMailer.deliver_send_documents(@file1.project, email_params) + email = last_email assert text_part(email).body.include? body assert html_part(email).body.include? body end def test_workflow_notification - email = DmsfMailer.workflow_notification(@user2, @wf1, @rev2, :text_email_subject_started, :text_email_started, - :text_email_to_proceed) - assert email + DmsfMailer.deliver_workflow_notification([@user2], @wf1, @rev2, :text_email_subject_started, + :text_email_started, :text_email_to_proceed) + email = last_email assert text_part(email).body.include? l(:text_email_subject_started) assert html_part(email).body.include? l(:text_email_subject_started) end def test_get_notify_users - @file1.notification = true users = DmsfMailer.get_notify_users(@project1, [@file1]) assert users.present? end def test_get_notify_users_notification_switched_off - @file1.notification = false + @file1.notify_deactivate users = DmsfMailer.get_notify_users(@project1, [@file1]) assert users.blank? end def test_get_notify_users_on_inactive_projects - @file1.notification = true @project1.status = Project::STATUS_CLOSED users = DmsfMailer.get_notify_users(@project1, [@file1]) assert users.blank? @@ -99,6 +106,12 @@ class DmsfMailerTest < RedmineDmsf::Test::UnitTest private + def last_email + mail = ActionMailer::Base.deliveries.last + assert_not_nil mail + mail + end + def text_part(email) email.parts.detect {|part| part.content_type.include?('text/plain')} end diff --git a/test/unit/dmsf_public_url_test.rb b/test/unit/dmsf_public_url_test.rb index f2ad35c4..0e652793 100644 --- a/test/unit/dmsf_public_url_test.rb +++ b/test/unit/dmsf_public_url_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/test/unit/dmsf_workflow_step_action_test.rb b/test/unit/dmsf_workflow_step_action_test.rb index 40ff0dbf..f9dd6cb8 100644 --- a/test/unit/dmsf_workflow_step_action_test.rb +++ b/test/unit/dmsf_workflow_step_action_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/test/unit/dmsf_workflow_step_assignment_test.rb b/test/unit/dmsf_workflow_step_assignment_test.rb index b2dd898f..f481d95b 100644 --- a/test/unit/dmsf_workflow_step_assignment_test.rb +++ b/test/unit/dmsf_workflow_step_assignment_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/test/unit/dmsf_workflow_step_test.rb b/test/unit/dmsf_workflow_step_test.rb index 77b2b55a..11c9c0a8 100644 --- a/test/unit/dmsf_workflow_step_test.rb +++ b/test/unit/dmsf_workflow_step_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -72,25 +72,25 @@ class DmsfWorkflowStepTest < RedmineDmsf::Test::UnitTest def test_validate_workflow_id_presence @wfs1.dmsf_workflow_id = nil assert !@wfs1.save - assert@wfs1.errors.count > 0 + assert @wfs1.errors.any? end def test_validate_step_presence @wfs1.step = nil assert !@wfs1.save - assert @wfs1.errors.count > 0 + assert @wfs1.errors.any? end def test_validate_user_id_presence @wfs1.user_id = nil assert !@wfs1.save - assert@wfs1.errors.count > 0 + assert @wfs1.errors.any? end def test_validate_operator_presence @wfs1.operator = nil assert !@wfs1.save - assert @wfs1.errors.count > 0 + assert @wfs1.errors.any? end def test_validate_user_id_uniqueness @@ -98,7 +98,7 @@ class DmsfWorkflowStepTest < RedmineDmsf::Test::UnitTest @wfs2.dmsf_workflow_id = @wfs1.dmsf_workflow_id @wfs2.step = @wfs1.step assert !@wfs2.save - assert @wfs2.errors.count > 0 + assert @wfs2.errors.any? end def test_validate_name_length diff --git a/test/unit/dmsf_workflow_test.rb b/test/unit/dmsf_workflow_test.rb index 85273fb0..155d162a 100644 --- a/test/unit/dmsf_workflow_test.rb +++ b/test/unit/dmsf_workflow_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/test/unit/issue_patch_test.rb b/test/unit/issue_patch_test.rb index 99b81d27..06f3e8ea 100644 --- a/test/unit/issue_patch_test.rb +++ b/test/unit/issue_patch_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/test/unit/project_patch_test.rb b/test/unit/project_patch_test.rb index deec9162..cf962b2a 100644 --- a/test/unit/project_patch_test.rb +++ b/test/unit/project_patch_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/test/unit/user_patch_test.rb b/test/unit/user_patch_test.rb index e521f0fd..d7c29804 100644 --- a/test/unit/user_patch_test.rb +++ b/test/unit/user_patch_test.rb @@ -2,7 +2,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright © 2011-18 Karel Pičman +# Copyright © 2011-19 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License