From 3a350ecb247caefd141d657e578c98fddc354897 Mon Sep 17 00:00:00 2001 From: Niklaus Giger Date: Wed, 16 Jan 2019 21:00:07 +0100 Subject: [PATCH 01/10] Must use netaddr in <2.0 as 2.x is totally incompatible --- Gemfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 3b6d3e0..4004bc3 100644 --- a/Gemfile +++ b/Gemfile @@ -1 +1,2 @@ -gem 'netaddr' \ No newline at end of file +# as version 2.0. is A complete rewrite and totally incompatible with 1.x. My main motivation now is to reduce bug reports resulting from the poor code quality of 1.x. +gem 'netaddr', '< 2.0.0 From 45ba0350d29f879c6d56a983dde3b5e8e3363872 Mon Sep 17 00:00:00 2001 From: Niklaus Giger Date: Thu, 2 Apr 2020 15:51:03 +0200 Subject: [PATCH 02/10] Updated version to 0.0.2 --- init.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.rb b/init.rb index 857ea15..248fbb7 100644 --- a/init.rb +++ b/init.rb @@ -2,7 +2,7 @@ name 'Redmine Access Filters plugin' author 'Redmine CRM' description 'Allows setting access filters for API and regular browser access per user' - version '0.0.1' + version '0.0.2' url 'http://redminecrm.com' author_url 'mailto:support@redminecrm.com' menu :admin_menu, :access_filters, @@ -11,4 +11,4 @@ end -require 'redmine_access_filters' \ No newline at end of file +require 'redmine_access_filters' From a0373b34574a72f6e83054c3c5662c2e9b634da5 Mon Sep 17 00:00:00 2001 From: Niklaus Giger Date: Mon, 2 Nov 2020 20:02:39 +0100 Subject: [PATCH 03/10] Update to redmine 4.1 --- Gemfile | 4 +++- README.rdoc | 8 +++++++- app/controllers/access_filters_controller.rb | 4 ++-- app/models/access_filter.rb | 4 ++-- .../patches/application_controller_patch.rb | 4 ++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index 4004bc3..46f7131 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,4 @@ +source 'https://rubygems.org' # as version 2.0. is A complete rewrite and totally incompatible with 1.x. My main motivation now is to reduce bug reports resulting from the poor code quality of 1.x. -gem 'netaddr', '< 2.0.0 +# gem 'netaddr' +gem 'netaddr', '< 2.0.0' diff --git a/README.rdoc b/README.rdoc index ff42526..3172a16 100644 --- a/README.rdoc +++ b/README.rdoc @@ -2,7 +2,7 @@ This plugin allows you to deny web or REST API access from specific IP addresses for specific users and groups -== Requirements +== Requirements * Redmine 2.3+ * Ruby 1.8.7, 1.9.3, 2.0.0 @@ -19,3 +19,9 @@ This plugin is licensed under the GNU GPL v2. See COPYRIGHT.txt and GPL.txt for == Sponsorship Pluing development was sponsored by MEDEVIT (http://www.medevit.at) + +== Testing + +Checkout a redmine version, clone this plugin under plugins/redmine_acess_filters +and run +bundle exec rake redmine:plugins:test NAME=redmine_acess_filter diff --git a/app/controllers/access_filters_controller.rb b/app/controllers/access_filters_controller.rb index 6013b2a..528246e 100644 --- a/app/controllers/access_filters_controller.rb +++ b/app/controllers/access_filters_controller.rb @@ -1,5 +1,5 @@ class AccessFiltersController < ApplicationController - before_filter :require_admin +# before_filter :require_admin def index @access_filters = AccessFilter.order(:position).all @@ -36,4 +36,4 @@ def destroy @access_filter.destroy redirect_to access_filters_path end -end \ No newline at end of file +end diff --git a/app/models/access_filter.rb b/app/models/access_filter.rb index a0aeb37..bd0aef6 100644 --- a/app/models/access_filter.rb +++ b/app/models/access_filter.rb @@ -5,7 +5,7 @@ class AccessFilter < ActiveRecord::Base validate :parsable_cidrs - acts_as_list + acts_as_tree # That is to clear cache on startup Rails.cache.delete(:access_filters) @@ -50,4 +50,4 @@ def parsable_cidrs end end end -end \ No newline at end of file +end diff --git a/lib/redmine_access_filters/patches/application_controller_patch.rb b/lib/redmine_access_filters/patches/application_controller_patch.rb index 103e26d..d5ea98f 100644 --- a/lib/redmine_access_filters/patches/application_controller_patch.rb +++ b/lib/redmine_access_filters/patches/application_controller_patch.rb @@ -5,7 +5,7 @@ def self.included(base) base.send(:include, InstanceMethods) base.class_eval do - before_filter :apply_access_filters + # before_filter :apply_access_filters end require "#{Rails.root}/plugins/redmine_access_filters/app/models/access_filter" end @@ -55,4 +55,4 @@ def access_filters unless ApplicationController.included_modules.include?(RedmineAccessFilters::Patches::ApplicationControllerPatch) ApplicationController.send(:include, RedmineAccessFilters::Patches::ApplicationControllerPatch) -end \ No newline at end of file +end From d2a9d013bf6e766397bfb76a66c752c5e3c7cc5e Mon Sep 17 00:00:00 2001 From: Niklaus Giger Date: Mon, 16 Aug 2021 12:52:23 +0200 Subject: [PATCH 04/10] Added github actions --- .github/workflows/ruby.yml | 50 ++++++++++++++++++++++++++++++ .gitignore | 3 ++ README.rdoc => README.md | 9 +++++- redmine | 53 ++++++++++++++++++++++++++++++++ scripts/install | 62 ++++++++++++++++++++++++++++++++++++++ scripts/update | 22 ++++++++++++++ test/database.yml | 13 ++++++++ 7 files changed, 211 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ruby.yml create mode 100644 .gitignore rename README.rdoc => README.md (66%) create mode 100755 redmine create mode 100755 scripts/install create mode 100755 scripts/update create mode 100644 test/database.yml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..c1f6a37 --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,50 @@ +name: Test +on: + push: + branches-ignore: [debian] + +jobs: + test: + name: ${{ matrix.redmine }} on ${{ matrix.ruby }} + runs-on: ubuntu-latest + + strategy: + matrix: + include: + - ruby: "2.7" + redmine: "4.2.1" + - ruby: "2.6" + redmine: "4.1.3" + fail-fast: false + + env: + BUNDLE_JOBS: 4 + BUNDLE_PATH: ${{ github.workspace }}/vendor/bundle + BUNDLE_RETRY: 3 + BUNDLE_WITHOUT: development + REDMINE_VERSION: ${{ matrix.redmine }} + + steps: + - uses: actions/checkout@master + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + + - name: setup cache + uses: actions/cache@v1 + with: + path: vendor + key: v3-ruby-${{ matrix.ruby }}-redmine-${{ matrix.redmine }} + + - name: install ruby dependencies + run: bundle install + + - name: setup redmine ${{ matrix.redmine }} + run: ./redmine update + + - name: run prepare tests + run: bundle exec rake db:test:prepare + + - name: run plugins tests + run: bundle exec rake redmine:plugins:test diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c6829c6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.bundle +Gemfile.lock +vendor diff --git a/README.rdoc b/README.md similarity index 66% rename from README.rdoc rename to README.md index 3172a16..38dbfe3 100644 --- a/README.rdoc +++ b/README.md @@ -24,4 +24,11 @@ Pluing development was sponsored by MEDEVIT (http://www.medevit.at) Checkout a redmine version, clone this plugin under plugins/redmine_acess_filters and run -bundle exec rake redmine:plugins:test NAME=redmine_acess_filter + + export RAILS_ENV=test + bundle install + bundle exec rake redmine:plugins NAME=redmine_access_filters + bundle exec rake db:test:prepare + bundle exec rake redmine:plugins:test + # run a single test + bundle exec ruby plugins/redmine_access_filters/test/functional/access_filter_test.rb -n test_works_if_no_rules_exist diff --git a/redmine b/redmine new file mode 100755 index 0000000..144aff9 --- /dev/null +++ b/redmine @@ -0,0 +1,53 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +REDMINE_VERSION = ENV['REDMINE_VERSION'] = ENV['REDMINE_VERSION'] || ENV['VERSION'] || '4.1.3' +REDMINE_PATH = ENV['REDMINE_PATH'] = File.expand_path("../vendor/redmine/#{REDMINE_VERSION}/", __FILE__) +REDMINE_EXEC = ENV['REDMINE_EXEC'] = File.expand_path(__FILE__) +PLUGIN_PATH = ENV['PLUGIN_PATH'] = File.expand_path(__dir__) + +require 'pathname' + +SCRIPT_PATH = Pathname.new(__FILE__).expand_path.parent.join('scripts') + +def help + <<-HELP.gsub(/^\s{4}/, '') + Available commands: + #{available_commands.join("\n ")} + HELP +end + +def available_commands + SCRIPT_PATH.children + .select(&:file?) + .select(&:executable?) + .map(&:basename) + .map(&:to_s) +end + +def handle_command(cmd, _argv) + unless ARGV[0] =~ /\A(\w+)\z/ + warn "Invalid command: #{ARGV[0]}" + warn help + Kernel.exit 1 + end + + command = SCRIPT_PATH.join(cmd.to_s) + + if command.file? && command.executable? + Kernel.exec command.to_s, *ARGV[1..-1] + else + warn "Unknown command: #{ARGV[0]}" + warn help + Kernel.exit 1 + end +end + +case ARGV[0] + when '-h', '--help', nil + $stdout.puts help + when 'exec' + Dir.chdir(REDMINE_PATH) { Kernel.exec(*ARGV[1..-1]) } + else + handle_command ARGV[0], ARGV[1..-1] +end diff --git a/scripts/install b/scripts/install new file mode 100755 index 0000000..8654756 --- /dev/null +++ b/scripts/install @@ -0,0 +1,62 @@ +#!/usr/bin/env bash + +set -e + +[ -z "$PLUGIN_PATH" ] && exit 1 +[ -z "$REDMINE_EXEC" ] && exit 1 +[ -z "$REDMINE_PATH" ] && exit 1 +[ -z "$REDMINE_VERSION" ] && exit 1 + +mkdir -p "${REDMINE_PATH}" +mkdir -p tmp log + +case ${REDMINE_VERSION} in + master) + REDMINE_SOURCE="http://svn.redmine.org/redmine/trunk" + ;; + + *) + REDMINE_SOURCE="http://svn.redmine.org/redmine/tags/${REDMINE_VERSION}" + ;; +esac + +(set -x; svn export --quiet --force "${REDMINE_SOURCE}" "${REDMINE_PATH}") + +echo "Symlink plugin, assets and specs..." + +mkdir -p ${REDMINE_PATH}/public/plugin_assets + +if [ ! -L "${REDMINE_PATH}/plugins/redmine_access_filters" ]; then + ln -s "${PLUGIN_PATH}" "${REDMINE_PATH}/plugins/redmine_access_filters" +fi + +if [ ! -L "${REDMINE_PATH}/spec" ]; then + ln -s "${PLUGIN_PATH}/spec" "${REDMINE_PATH}/spec" +fi + +if [ ! -L "${REDMINE_PATH}/test/fixtures/rdb" ]; then + ln -s "${PLUGIN_PATH}/spec/fixtures" "${REDMINE_PATH}/test/fixtures/rdb" +fi + +if [ ! -L "${REDMINE_PATH}/public/plugin_assets/redmine_access_filters_linked" ]; then + ln -s "${PLUGIN_PATH}/assets" "${REDMINE_PATH}/public/plugin_assets/redmine_access_filters_linked" +fi + +echo "Copy database configuration..." + +(set -x; cp -v $PLUGIN_PATH/test/database.yml "$REDMINE_PATH"/config/ ) + +pushd "${REDMINE_PATH}" + +sed -i -E '/selenium-webdriver|capybara/d' Gemfile +cat << EOF >> Gemfile +group :test do + gem 'capybara', '~> 3.12' + gem 'selenium-webdriver', '~> 3.141' +end +EOF + +(set -x; bundle install --without rmagick --jobs=3 --retry=3 ${BUNDLE_OPTS}) +(set -x; bundle exec rake generate_secret_token db:create:all db:migrate redmine:plugins:migrate db:test:prepare) + +popd diff --git a/scripts/update b/scripts/update new file mode 100755 index 0000000..ba4b78c --- /dev/null +++ b/scripts/update @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -e + +[ -z "$PLUGIN_PATH" ] && exit 1 +[ -z "$REDMINE_EXEC" ] && exit 1 +[ -z "$REDMINE_PATH" ] && exit 1 +[ -z "$REDMINE_VERSION" ] && exit 1 + +if [ ! -d "${REDMINE_PATH}" ]; then + exec $REDMINE_EXEC install +fi + +pushd "${REDMINE_PATH}" + +if [ "${REDMINE_VERSION}" == "master" ]; then + (set -x; svn export --quiet --force "${REDMINE_SOURCE}" .) +fi + +(set -x; bundle update --jobs=3 --retry=3) +pwd +(set -x; bundle exec rake db:create:all db:migrate redmine:plugins:migrate db:test:prepare) diff --git a/test/database.yml b/test/database.yml new file mode 100644 index 0000000..df32083 --- /dev/null +++ b/test/database.yml @@ -0,0 +1,13 @@ +# Line indentation must be 2 spaces (no tabs). +production: + adapter: sqlite3 + database: db/redmine_production.sqlite3 + +development: + adapter: sqlite3 + database: db/redmine_development.sqlite3 + +test: + adapter: sqlite3 + database: db/redmine_test.sqlite3 + From 39bbcd8200fbb54b242b3870c6a9094e75db01ce Mon Sep 17 00:00:00 2001 From: Niklaus Giger Date: Mon, 16 Aug 2021 13:13:28 +0200 Subject: [PATCH 05/10] [22953] Fix running tests --- .github/workflows/ruby.yml | 4 ++-- db/migrate/001_create_access_filters.rb | 4 ++-- db/migrate/002_add_active_flag_to_access_filters.rb | 4 ++-- db/migrate/003_add_position_to_access_filters.rb | 4 ++-- .../004_add_polymorphism_to_access_filters.rb | 4 ++-- scripts/install | 1 + test/functional/access_filter_test.rb | 13 +++++-------- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index c1f6a37..cc8ad64 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -44,7 +44,7 @@ jobs: run: ./redmine update - name: run prepare tests - run: bundle exec rake db:test:prepare + run: ./redmine exec bundle exec rake db:test:prepare - name: run plugins tests - run: bundle exec rake redmine:plugins:test + run: ./redmine exec bundle exec rake redmine:plugins:test diff --git a/db/migrate/001_create_access_filters.rb b/db/migrate/001_create_access_filters.rb index 9e23dfd..da0fb29 100644 --- a/db/migrate/001_create_access_filters.rb +++ b/db/migrate/001_create_access_filters.rb @@ -1,4 +1,4 @@ -class CreateAccessFilters < ActiveRecord::Migration +class CreateAccessFilters < ActiveRecord::Migration[5.2] def change create_table :access_filters do |t| t.references :user @@ -7,4 +7,4 @@ def change t.text :cidrs end end -end \ No newline at end of file +end diff --git a/db/migrate/002_add_active_flag_to_access_filters.rb b/db/migrate/002_add_active_flag_to_access_filters.rb index 59f7794..456f2ac 100644 --- a/db/migrate/002_add_active_flag_to_access_filters.rb +++ b/db/migrate/002_add_active_flag_to_access_filters.rb @@ -1,5 +1,5 @@ -class AddActiveFlagToAccessFilters < ActiveRecord::Migration +class AddActiveFlagToAccessFilters < ActiveRecord::Migration[5.2] def change add_column :access_filters, :active, :boolean, :default => true end -end \ No newline at end of file +end diff --git a/db/migrate/003_add_position_to_access_filters.rb b/db/migrate/003_add_position_to_access_filters.rb index 94b2932..65a06d0 100644 --- a/db/migrate/003_add_position_to_access_filters.rb +++ b/db/migrate/003_add_position_to_access_filters.rb @@ -1,5 +1,5 @@ -class AddPositionToAccessFilters < ActiveRecord::Migration +class AddPositionToAccessFilters < ActiveRecord::Migration[5.2] def change add_column :access_filters, :position, :integer, :default => 0 end -end \ No newline at end of file +end diff --git a/db/migrate/004_add_polymorphism_to_access_filters.rb b/db/migrate/004_add_polymorphism_to_access_filters.rb index 11f06ab..2d7e2b6 100644 --- a/db/migrate/004_add_polymorphism_to_access_filters.rb +++ b/db/migrate/004_add_polymorphism_to_access_filters.rb @@ -1,7 +1,7 @@ -class AddPolymorphismToAccessFilters < ActiveRecord::Migration +class AddPolymorphismToAccessFilters < ActiveRecord::Migration[5.2] def change add_column :access_filters, :owner_type, :string add_column :access_filters, :owner_id, :integer remove_column :access_filters, :user_id end -end \ No newline at end of file +end diff --git a/scripts/install b/scripts/install index 8654756..598e4b3 100755 --- a/scripts/install +++ b/scripts/install @@ -56,6 +56,7 @@ group :test do end EOF +(set -x; bundle config set --local without 'rmagick' ${BUNDLE_OPTS}) (set -x; bundle install --without rmagick --jobs=3 --retry=3 ${BUNDLE_OPTS}) (set -x; bundle exec rake generate_secret_token db:create:all db:migrate redmine:plugins:migrate db:test:prepare) diff --git a/test/functional/access_filter_test.rb b/test/functional/access_filter_test.rb index e8d8992..f777fb8 100644 --- a/test/functional/access_filter_test.rb +++ b/test/functional/access_filter_test.rb @@ -17,13 +17,10 @@ def setup AccessFilter.destroy_all @controller = IssuesController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new @request.session[:user_id] = 1 @request.env['REMOTE_ADDR'] = '192.168.0.1' @group = Group.create(:name => 'Test group') @group.users << User.find(1) - end def test_works_if_no_rules_exist @@ -45,7 +42,7 @@ def test_prevents_http_access_if_specified def test_prevents_api_access_if_specified AccessFilter.create(:owner_id => "User|1", :web => false, :api => true, :cidrs => 'any') with_settings :rest_api_enabled => '1' do - get :index, :format => :json, :key => User.find(1).api_key + get :index, :params => { :format => :json, :key => User.find(1).api_key} end assert_response 403 end @@ -77,7 +74,7 @@ def test_does_not_allow_http_access_if_ip_mismatched_for_subnet def test_allows_api_access_if_ip_matched AccessFilter.create(:owner_id => "User|1", :web => false, :api => false, :cidrs => '192.168.0.1') with_settings :rest_api_enabled => '1' do - get :index, :format => :json, :key => User.find(1).api_key + get :index, :params => {:format => :json, :key => User.find(1).api_key} end assert_response :success @@ -86,7 +83,7 @@ def test_allows_api_access_if_ip_matched def test_allows_api_access_if_ip_matched_for_subnet AccessFilter.create(:owner_id => "User|1", :web => false, :api => false, :cidrs => '192.168.0.0/24') with_settings :rest_api_enabled => '1' do - get :index, :format => :json, :key => User.find(1).api_key + get :index, :params => {:format => :json, :key => User.find(1).api_key} end assert_response :success @@ -95,7 +92,7 @@ def test_allows_api_access_if_ip_matched_for_subnet def test_does_not_allow_api_access_if_ip_mismatched_for_subnet AccessFilter.create(:owner_id => "User|1", :web => false, :api => false, :cidrs => '192.168.1.0/24') with_settings :rest_api_enabled => '1' do - get :index, :format => :json, :key => User.find(1).api_key + get :index, :params => {:format => :json, :key => User.find(1).api_key} end assert_response 403 end @@ -132,4 +129,4 @@ def test_access_filter_with_empty_cidrs_field_treated_as_any assert_response 200 end -end \ No newline at end of file +end From 74478bb83e5319822b0525734e13daaf3643ab61 Mon Sep 17 00:00:00 2001 From: Niklaus Giger Date: Mon, 16 Aug 2021 13:32:59 +0200 Subject: [PATCH 06/10] [22953] Make access filters work again --- app/controllers/access_filters_controller.rb | 2 +- lib/redmine_access_filters.rb | 2 +- .../patches/application_controller_patch.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/access_filters_controller.rb b/app/controllers/access_filters_controller.rb index 528246e..fd755bf 100644 --- a/app/controllers/access_filters_controller.rb +++ b/app/controllers/access_filters_controller.rb @@ -1,5 +1,5 @@ class AccessFiltersController < ApplicationController -# before_filter :require_admin + before_action :require_admin def index @access_filters = AccessFilter.order(:position).all diff --git a/lib/redmine_access_filters.rb b/lib/redmine_access_filters.rb index 11e5385..15c4368 100644 --- a/lib/redmine_access_filters.rb +++ b/lib/redmine_access_filters.rb @@ -1,2 +1,2 @@ require 'redmine_access_filters/patches/application_controller_patch' -require 'redmine_access_filters/hooks/view_layouts_hook' \ No newline at end of file +require 'redmine_access_filters/hooks/view_layouts_hook' diff --git a/lib/redmine_access_filters/patches/application_controller_patch.rb b/lib/redmine_access_filters/patches/application_controller_patch.rb index d5ea98f..9891102 100644 --- a/lib/redmine_access_filters/patches/application_controller_patch.rb +++ b/lib/redmine_access_filters/patches/application_controller_patch.rb @@ -5,7 +5,7 @@ def self.included(base) base.send(:include, InstanceMethods) base.class_eval do - # before_filter :apply_access_filters + before_action :apply_access_filters end require "#{Rails.root}/plugins/redmine_access_filters/app/models/access_filter" end From a31655048d131d58c3b66d679d0456688406de28 Mon Sep 17 00:00:00 2001 From: Niklaus Giger Date: Mon, 16 Aug 2021 13:46:00 +0200 Subject: [PATCH 07/10] [22953] Using selenium makes our tests fail --- .github/workflows/ruby.yml | 3 ++- scripts/install | 8 -------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index cc8ad64..7f73a63 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -35,7 +35,8 @@ jobs: uses: actions/cache@v1 with: path: vendor - key: v3-ruby-${{ matrix.ruby }}-redmine-${{ matrix.redmine }} + # Updating v to v clear the cache + key: v4-ruby-${{ matrix.ruby }}-redmine-${{ matrix.redmine }} - name: install ruby dependencies run: bundle install diff --git a/scripts/install b/scripts/install index 598e4b3..537619b 100755 --- a/scripts/install +++ b/scripts/install @@ -48,14 +48,6 @@ echo "Copy database configuration..." pushd "${REDMINE_PATH}" -sed -i -E '/selenium-webdriver|capybara/d' Gemfile -cat << EOF >> Gemfile -group :test do - gem 'capybara', '~> 3.12' - gem 'selenium-webdriver', '~> 3.141' -end -EOF - (set -x; bundle config set --local without 'rmagick' ${BUNDLE_OPTS}) (set -x; bundle install --without rmagick --jobs=3 --retry=3 ${BUNDLE_OPTS}) (set -x; bundle exec rake generate_secret_token db:create:all db:migrate redmine:plugins:migrate db:test:prepare) From 515a946bee01cd21697a0314fe051fbe9cb482ea Mon Sep 17 00:00:00 2001 From: Niklaus Giger Date: Mon, 16 Aug 2021 13:58:49 +0200 Subject: [PATCH 08/10] [22953] Push version to 1.0, explain that github actions fail --- README.md | 19 +++++++++++++------ init.rb | 4 ++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 38dbfe3..9bbbf60 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,26 @@ -= Redmine Access filters plugin +# Redmine Access filters plugin This plugin allows you to deny web or REST API access from specific IP addresses for specific users and groups -== Requirements +## Requirements * Redmine 2.3+ * Ruby 1.8.7, 1.9.3, 2.0.0 -== Installation and Setup +## Installation and Setup * Follow the Redmine plugin installation steps at http://www.redmine.org/wiki/redmine/Plugins * Restart your Redmine web servers (e.g. mongrel, thin, passenger) -== License +## License This plugin is licensed under the GNU GPL v2. See COPYRIGHT.txt and GPL.txt for details. -== Sponsorship +## Sponsorship Pluing development was sponsored by MEDEVIT (http://www.medevit.at) -== Testing +## Testing Checkout a redmine version, clone this plugin under plugins/redmine_acess_filters and run @@ -32,3 +32,10 @@ and run bundle exec rake redmine:plugins:test # run a single test bundle exec ruby plugins/redmine_access_filters/test/functional/access_filter_test.rb -n test_works_if_no_rules_exist + +## github Actions + +For unknown reason Niklaus was unable to make the github actions pass (August 21). +Running the tests locally worked fine, but on github I got always the error +messages containing `redirect to 'access_filters', :action => 'index'}, :caption => :label_access_filters_plural From 5afecd8cdc3a9c19055abe46e677953a45e91916 Mon Sep 17 00:00:00 2001 From: Niklaus Giger Date: Mon, 16 Aug 2021 14:03:16 +0200 Subject: [PATCH 09/10] Fix website URL --- init.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.rb b/init.rb index 2951fb4..9056fed 100644 --- a/init.rb +++ b/init.rb @@ -3,7 +3,7 @@ author 'Redmine CRM' description 'Allows setting access filters for API and regular browser access per user' version '1.0.0' - url 'http://redminecrm.com' + url 'https://github.com/ngiger/redmine_access_filters' author_url 'mailto:niklaus.giger@member.fsf.org' menu :admin_menu, :access_filters, {:controller => 'access_filters', :action => 'index'}, From 1a10637e5a3e6721e074e2292ae1d7c8121ea762 Mon Sep 17 00:00:00 2001 From: Niklaus Giger Date: Wed, 18 Aug 2021 18:07:29 +0200 Subject: [PATCH 10/10] [22953] Push version to 1.0.1. Reorder_handle does not work, but does not crash neither --- app/views/access_filters/_access_filter.html.erb | 4 ++-- init.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/access_filters/_access_filter.html.erb b/app/views/access_filters/_access_filter.html.erb index ba34667..28804bf 100644 --- a/app/views/access_filters/_access_filter.html.erb +++ b/app/views/access_filters/_access_filter.html.erb @@ -21,10 +21,10 @@ <%= access_filter.cidrs %> - <%= reorder_links('access_filter', {:action => 'update', :id => access_filter }, :put) %> + <%= reorder_handle(access_filter, :param => :put) %> <%= link_to l(:label_access_filters_edit), edit_access_filter_path(access_filter), :class => 'icon icon-edit' %> <%= link_to l(:label_access_filters_delete), access_filter_path(access_filter), :method => :delete, :confirm => l(:label_access_filters_delete_confirmation), :class => 'icon icon-del' %> - \ No newline at end of file + diff --git a/init.rb b/init.rb index 9056fed..a83f265 100644 --- a/init.rb +++ b/init.rb @@ -2,7 +2,7 @@ name 'Redmine Access Filters plugin' author 'Redmine CRM' description 'Allows setting access filters for API and regular browser access per user' - version '1.0.0' + version '1.0.1' url 'https://github.com/ngiger/redmine_access_filters' author_url 'mailto:niklaus.giger@member.fsf.org' menu :admin_menu, :access_filters,