From 09157b4699e75d7c27b3e327fe5509392cd10cfa Mon Sep 17 00:00:00 2001 From: Maxim Colls Date: Mon, 2 Nov 2020 10:59:57 +0100 Subject: [PATCH 1/9] Added missing argument to Verification::ConfirmUserAuthorization --- lib/decidim/direct_verifications/user_processor.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/decidim/direct_verifications/user_processor.rb b/lib/decidim/direct_verifications/user_processor.rb index befa6e0..0e594b8 100644 --- a/lib/decidim/direct_verifications/user_processor.rb +++ b/lib/decidim/direct_verifications/user_processor.rb @@ -50,7 +50,7 @@ def authorize_users next unless !auth.granted? || auth.expired? - Verification::ConfirmUserAuthorization.call(auth, authorize_form(u)) do + Verification::ConfirmUserAuthorization.call(auth, authorize_form(u), session) do on(:ok) do add_processed :authorized, email end From c73549840974bd6a5a789dc275a4e75039a854c8 Mon Sep 17 00:00:00 2001 From: Maxim Colls Date: Mon, 2 Nov 2020 11:13:35 +0100 Subject: [PATCH 2/9] Passed session from controller to the verification service --- .../verification/admin/direct_verifications_controller.rb | 2 +- lib/decidim/direct_verifications/user_processor.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/decidim/direct_verifications/verification/admin/direct_verifications_controller.rb b/app/controllers/decidim/direct_verifications/verification/admin/direct_verifications_controller.rb index b8a365f..6d3c283 100644 --- a/app/controllers/decidim/direct_verifications/verification/admin/direct_verifications_controller.rb +++ b/app/controllers/decidim/direct_verifications/verification/admin/direct_verifications_controller.rb @@ -21,7 +21,7 @@ def create @userlist = params[:userlist] @workflows = workflows - processor = UserProcessor.new(current_organization, current_user) + processor = UserProcessor.new(current_organization, current_user, session) processor.emails = parser_class.new(@userlist).to_h processor.authorization_handler = authorization_handler(params[:authorization_handler]) diff --git a/lib/decidim/direct_verifications/user_processor.rb b/lib/decidim/direct_verifications/user_processor.rb index 0e594b8..156fcfe 100644 --- a/lib/decidim/direct_verifications/user_processor.rb +++ b/lib/decidim/direct_verifications/user_processor.rb @@ -3,16 +3,17 @@ module Decidim module DirectVerifications class UserProcessor - def initialize(organization, current_user) + def initialize(organization, current_user, session) @organization = organization @current_user = current_user @authorization_handler = :direct_verifications @errors = { registered: [], authorized: [], revoked: [] } @processed = { registered: [], authorized: [], revoked: [] } @emails = {} + @session = session end - attr_reader :organization, :current_user, :errors, :processed + attr_reader :organization, :current_user, :session, :errors, :processed attr_accessor :authorization_handler, :emails def register_users From 79d5fd935ac383eeed173bbbf67e69bbbd21bef2 Mon Sep 17 00:00:00 2001 From: Maxim Colls Date: Mon, 2 Nov 2020 15:41:21 +0100 Subject: [PATCH 3/9] Fix authorizations collection to be scped by organization --- .../verification/admin/authorizations_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/decidim/direct_verifications/verification/admin/authorizations_controller.rb b/app/controllers/decidim/direct_verifications/verification/admin/authorizations_controller.rb index 9c92666..9cec560 100644 --- a/app/controllers/decidim/direct_verifications/verification/admin/authorizations_controller.rb +++ b/app/controllers/decidim/direct_verifications/verification/admin/authorizations_controller.rb @@ -22,7 +22,12 @@ def destroy private def collection - Decidim::Authorization.where(name: "direct_verifications").includes(:user) + # Decidim::Verifications::Authorizations Query + Decidim::Verifications::Authorizations.new( + organization: current_organization, + name: "direct_verifications", + granted: true + ).query end def authorization From 8d7137b5b3a899ed721f84a4f540e4b6a356eb80 Mon Sep 17 00:00:00 2001 From: Maxim Colls Date: Tue, 3 Nov 2020 11:44:28 +0100 Subject: [PATCH 4/9] Updated gems to fit decidim@0.22 --- Gemfile | 7 +- Gemfile.lock | 489 ++++++++++---------- lib/decidim/direct_verifications/version.rb | 6 +- 3 files changed, 261 insertions(+), 241 deletions(-) diff --git a/Gemfile b/Gemfile index 38c5267..c38dea5 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gem "decidim", Decidim::DirectVerifications::DECIDIM_VERSION gem "decidim-direct_verifications", path: "." gem "bootsnap", "~> 1.3" -gem "puma", "~> 3.0" +gem "puma", "~> 4.0" gem "uglifier", "~> 4.1" group :development, :test do @@ -34,8 +34,5 @@ end group :test do gem "codecov", require: false - # Workaround for cc-test-reporter with SimpleCov 0.18. - # Stop upgrading SimpleCov until the following issue will be resolved. - # https://github.com/codeclimate/test-reporter/issues/418 - gem "simplecov", "~> 0.10", "< 0.18" + gem "simplecov", "~> 0.18.5" end diff --git a/Gemfile.lock b/Gemfile.lock index 3dcc29a..c359109 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,32 +1,32 @@ PATH remote: . specs: - decidim-direct_verifications (0.20) - decidim-admin (>= 0.17.0) - decidim-core (>= 0.17.0) + decidim-direct_verifications (0.22) + decidim-admin (>= 0.22.0) + decidim-core (>= 0.22.0) GEM remote: https://rubygems.org/ specs: - actioncable (5.2.4.2) - actionpack (= 5.2.4.2) + actioncable (5.2.4.4) + actionpack (= 5.2.4.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.4.2) - actionpack (= 5.2.4.2) - actionview (= 5.2.4.2) - activejob (= 5.2.4.2) + actionmailer (5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.4.2) - actionview (= 5.2.4.2) - activesupport (= 5.2.4.2) + actionpack (5.2.4.4) + actionview (= 5.2.4.4) + activesupport (= 5.2.4.4) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.4.2) - activesupport (= 5.2.4.2) + actionview (5.2.4.4) + activesupport (= 5.2.4.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -34,20 +34,20 @@ GEM active_link_to (1.0.5) actionpack addressable - activejob (5.2.4.2) - activesupport (= 5.2.4.2) + activejob (5.2.4.4) + activesupport (= 5.2.4.4) globalid (>= 0.3.6) - activemodel (5.2.4.2) - activesupport (= 5.2.4.2) - activerecord (5.2.4.2) - activemodel (= 5.2.4.2) - activesupport (= 5.2.4.2) + activemodel (5.2.4.4) + activesupport (= 5.2.4.4) + activerecord (5.2.4.4) + activemodel (= 5.2.4.4) + activesupport (= 5.2.4.4) arel (>= 9.0) - activestorage (5.2.4.2) - actionpack (= 5.2.4.2) - activerecord (= 5.2.4.2) + activestorage (5.2.4.4) + actionpack (= 5.2.4.4) + activerecord (= 5.2.4.4) marcel (~> 0.3.1) - activesupport (5.2.4.2) + activesupport (5.2.4.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -58,7 +58,7 @@ GEM public_suffix (>= 2.0.2, < 5.0) anchored (1.1.0) arel (9.0.0) - ast (2.4.0) + ast (2.4.1) autoprefixer-rails (8.6.5) execjs axiom-types (0.1.1) @@ -70,8 +70,8 @@ GEM babel-source (>= 4.0, < 6) execjs (~> 2.0) batch-loader (1.5.0) - bcrypt (3.1.13) - better_html (1.0.14) + bcrypt (3.1.16) + better_html (1.0.15) actionview (>= 4.0) activesupport (>= 4.0) ast (~> 2.0) @@ -80,11 +80,12 @@ GEM parser (>= 2.4) smart_properties bindex (0.8.1) - bootsnap (1.4.6) + bootsnap (1.5.0) msgpack (~> 1.0) + browser (2.7.1) builder (3.2.4) byebug (11.1.3) - capybara (3.32.1) + capybara (3.33.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -108,8 +109,9 @@ GEM actionpack (>= 3.0) cells (>= 4.1.6, < 5.0.0) charlock_holmes (0.7.7) + chef-utils (16.6.14) childprocess (3.0.0) - codecov (0.2.11) + codecov (0.2.12) json simplecov coercible (1.0.0) @@ -121,9 +123,8 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.6) - crack (0.4.3) - safe_yaml (~> 1.0.0) + concurrent-ruby (1.1.7) + crack (0.4.4) crass (1.0.6) css_parser (1.7.1) addressable @@ -133,91 +134,95 @@ GEM db-query-matchers (0.9.0) activesupport (>= 4.0, <= 6.0) rspec (~> 3.0) - decidim (0.20.0) - decidim-accountability (= 0.20.0) - decidim-admin (= 0.20.0) - decidim-api (= 0.20.0) - decidim-assemblies (= 0.20.0) - decidim-blogs (= 0.20.0) - decidim-budgets (= 0.20.0) - decidim-comments (= 0.20.0) - decidim-core (= 0.20.0) - decidim-debates (= 0.20.0) - decidim-forms (= 0.20.0) - decidim-generators (= 0.20.0) - decidim-meetings (= 0.20.0) - decidim-pages (= 0.20.0) - decidim-participatory_processes (= 0.20.0) - decidim-proposals (= 0.20.0) - decidim-sortitions (= 0.20.0) - decidim-surveys (= 0.20.0) - decidim-system (= 0.20.0) - decidim-verifications (= 0.20.0) - decidim-accountability (0.20.0) - decidim-comments (= 0.20.0) - decidim-core (= 0.20.0) - kaminari (~> 1.1) + decidim (0.22.0) + decidim-accountability (= 0.22.0) + decidim-admin (= 0.22.0) + decidim-api (= 0.22.0) + decidim-assemblies (= 0.22.0) + decidim-blogs (= 0.22.0) + decidim-budgets (= 0.22.0) + decidim-comments (= 0.22.0) + decidim-core (= 0.22.0) + decidim-debates (= 0.22.0) + decidim-forms (= 0.22.0) + decidim-generators (= 0.22.0) + decidim-meetings (= 0.22.0) + decidim-pages (= 0.22.0) + decidim-participatory_processes (= 0.22.0) + decidim-proposals (= 0.22.0) + decidim-sortitions (= 0.22.0) + decidim-surveys (= 0.22.0) + decidim-system (= 0.22.0) + decidim-verifications (= 0.22.0) + decidim-accountability (0.22.0) + decidim-comments (= 0.22.0) + decidim-core (= 0.22.0) + kaminari (~> 1.2, >= 1.2.1) searchlight (~> 4.1) - decidim-admin (0.20.0) + decidim-admin (0.22.0) active_link_to (~> 1.0) - decidim-core (= 0.20.0) + decidim-core (= 0.22.0) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 1.7) jquery-rails (~> 4.3) - sassc (~> 1.12, >= 1.12.1) - sassc-rails (~> 1.3) - decidim-api (0.20.0) + sassc (~> 2.3.0) + sassc-rails (~> 2.1.2) + decidim-api (0.22.0) graphiql-rails (~> 1.4, < 1.5) graphql (~> 1.9) rack-cors (~> 1.0) + redcarpet (~> 3.4) sprockets-es6 (~> 0.9.2) - decidim-assemblies (0.20.0) - decidim-core (= 0.20.0) - decidim-blogs (0.20.0) - decidim-admin (= 0.20.0) - decidim-comments (= 0.20.0) - decidim-core (= 0.20.0) + decidim-assemblies (0.22.0) + decidim-core (= 0.22.0) + decidim-blogs (0.22.0) + decidim-admin (= 0.22.0) + decidim-comments (= 0.22.0) + decidim-core (= 0.22.0) httparty (~> 0.17) jquery-tmpl-rails (~> 1.1) - kaminari (~> 1.1) - decidim-budgets (0.20.0) - decidim-comments (= 0.20.0) - decidim-core (= 0.20.0) - kaminari (~> 1.1) + kaminari (~> 1.2, >= 1.2.1) + decidim-budgets (0.22.0) + decidim-comments (= 0.22.0) + decidim-core (= 0.22.0) + kaminari (~> 1.2, >= 1.2.1) searchlight (~> 4.1) - decidim-comments (0.20.0) - decidim-core (= 0.20.0) + decidim-comments (0.22.0) + decidim-core (= 0.22.0) jquery-rails (~> 4.3) - decidim-core (0.20.0) + redcarpet (~> 3.4) + decidim-core (0.22.0) active_link_to (~> 1.0) anchored (>= 1.1.0) autoprefixer-rails (~> 8.0) batch-loader (~> 1.2) + browser (~> 2.7) carrierwave (~> 1.3) cells-erb (~> 0.1.0) cells-rails (~> 0.0.9) charlock_holmes (~> 0.7) date_validator (~> 0.9.0) - decidim-api (= 0.20.0) + decidim-api (= 0.22.0) devise (~> 4.7) devise-i18n (~> 1.2) + diffy (~> 3.3) doorkeeper (~> 5.1) doorkeeper-i18n (~> 4.0) etherpad-lite (~> 0.3) file_validators (~> 2.1) - foundation-rails (~> 6.4, < 6.5) + foundation-rails (~> 6.6, < 6.7) foundation_rails_helper (~> 3.0) - geocoder (~> 1.5) + geocoder (>= 1.5) hashdiff (>= 0.4.0, < 2.0.0) invisible_captcha (~> 0.12) jquery-rails (~> 4.3) - kaminari (~> 1.1) + kaminari (~> 1.2, >= 1.2.1) loofah (~> 2.3.1) mini_magick (~> 4.9) mustache (~> 1.1.0) nobspw (~> 0.6.0) - omniauth (~> 1.9) + omniauth (= 1.9.0) omniauth-facebook (~> 5.0) omniauth-google-oauth2 (~> 0.7) omniauth-rails_csrf_protection (~> 0.1) @@ -226,15 +231,16 @@ GEM pg (~> 1.1.4, < 2) pg_search (~> 2.2) premailer-rails (~> 1.10) - rack (~> 2.0) + rack (>= 2.0.8) rack-attack (~> 6.0) - rails (>= 5.2, < 6.0.x) + rails (>= 5.2.4.3, < 6.0.x) rails-i18n (~> 5.0) rectify (~> 0.13.0) redis (~> 4.1) rubyzip (~> 2.0) - sassc (~> 1.12, >= 1.12.1) - sassc-rails (~> 1.3) + sassc (~> 2.3.0) + sassc-rails (~> 2.1.2) + seven_zip_ruby (~> 1.2, >= 1.2.2) social-share-button (~> 1.2, >= 1.2.1) spreadsheet (~> 1.2) sprockets (~> 3.7, < 4) @@ -243,108 +249,109 @@ GEM uglifier (~> 4.1) valid_email2 (~> 2.1) wisper (~> 2.0) - decidim-debates (0.20.0) - decidim-comments (= 0.20.0) - decidim-core (= 0.20.0) - kaminari (~> 1.1) + decidim-debates (0.22.0) + decidim-comments (= 0.22.0) + decidim-core (= 0.22.0) + kaminari (~> 1.2, >= 1.2.1) searchlight (~> 4.1) - decidim-dev (0.20.0) + decidim-dev (0.22.0) byebug (~> 11.0) capybara (~> 3.24) db-query-matchers (~> 0.9.0) - decidim (= 0.20.0) + decidim (= 0.22.0) erb_lint (~> 0.0.28) factory_bot_rails (~> 4.8) i18n-tasks (~> 0.9.18) - mdl (~> 0.5.0) - nokogiri (>= 1.10.4) - puma (~> 3.12) + mdl (~> 0.10) + nokogiri (>= 1.10.8) + puma (>= 4.3) rails-controller-testing (~> 1.0) rspec-cells (~> 0.3.4) rspec-html-matchers (~> 0.9.1) rspec-rails (~> 3.7) + rspec-retry (~> 0.6.2) rspec_junit_formatter (~> 0.3.0) rubocop (~> 0.71.0) rubocop-rails (~> 2.0) rubocop-rspec (~> 1.21) selenium-webdriver (~> 3.142) - simplecov (~> 0.16) + simplecov (~> 0.18.5) + simplecov-cobertura (~> 1.3.1) system_test_html_screenshots (~> 0.1.1) webmock (~> 3.6) wisper-rspec (~> 1.0) - decidim-forms (0.20.0) - decidim-core (= 0.20.0) - decidim-generators (0.20.0) - decidim-core (= 0.20.0) - decidim-meetings (0.20.0) + decidim-forms (0.22.0) + decidim-core (= 0.22.0) + decidim-generators (0.22.0) + decidim-core (= 0.22.0) + decidim-meetings (0.22.0) cells-erb (~> 0.1.0) cells-rails (~> 0.0.9) - decidim-core (= 0.20.0) - decidim-forms (= 0.20.0) + decidim-core (= 0.22.0) + decidim-forms (= 0.22.0) httparty (~> 0.17) icalendar (~> 2.5) jquery-tmpl-rails (~> 1.1) - kaminari (~> 1.1) + kaminari (~> 1.2, >= 1.2.1) searchlight (~> 4.1) - decidim-pages (0.20.0) - decidim-core (= 0.20.0) - decidim-participatory_processes (0.20.0) - decidim-core (= 0.20.0) - decidim-proposals (0.20.0) + decidim-pages (0.22.0) + decidim-core (= 0.22.0) + decidim-participatory_processes (0.22.0) + decidim-core (= 0.22.0) + decidim-proposals (0.22.0) acts_as_list (~> 0.9) cells-erb (~> 0.1.0) cells-rails (~> 0.0.9) - decidim-comments (= 0.20.0) - decidim-core (= 0.20.0) - diffy (~> 3.3) + decidim-comments (= 0.22.0) + decidim-core (= 0.22.0) doc2text (~> 0.4.2) - kaminari (~> 1.1) + kaminari (~> 1.2, >= 1.2.1) ransack (~> 2.1.1) redcarpet (~> 3.4) - decidim-sortitions (0.20.0) - decidim-admin (= 0.20.0) - decidim-comments (= 0.20.0) - decidim-core (= 0.20.0) - decidim-proposals (= 0.20.0) - decidim-surveys (0.20.0) - decidim-core (= 0.20.0) - decidim-forms (= 0.20.0) - decidim-system (0.20.0) + decidim-sortitions (0.22.0) + decidim-admin (= 0.22.0) + decidim-comments (= 0.22.0) + decidim-core (= 0.22.0) + decidim-proposals (= 0.22.0) + decidim-surveys (0.22.0) + decidim-core (= 0.22.0) + decidim-forms (= 0.22.0) + decidim-system (0.22.0) active_link_to (~> 1.0) - decidim-core (= 0.20.0) + decidim-core (= 0.22.0) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 1.7) jquery-rails (~> 4.3) - sassc (~> 1.12, >= 1.12.1) - sassc-rails (~> 1.3) - decidim-verifications (0.20.0) - decidim-core (= 0.20.0) + sassc (~> 2.3.0) + sassc-rails (~> 2.1.2) + decidim-verifications (0.22.0) + decidim-core (= 0.22.0) declarative-builder (0.1.0) declarative-option (< 0.2.0) declarative-option (0.1.0) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) - devise (4.7.1) + devise (4.7.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (1.9.1) + devise-i18n (1.9.2) devise (>= 4.7.1) devise_invitable (1.7.5) actionmailer (>= 4.1.0) devise (>= 4.0.0) - diff-lcs (1.3) - diffy (3.3.0) + diff-lcs (1.4.4) + diffy (3.4.0) doc2text (0.4.2) nokogiri (~> 1.10.0) rubyzip (~> 2.0.0) docile (1.3.2) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) - doorkeeper (5.3.1) + doorkeeper (5.4.0) railties (>= 5) doorkeeper-i18n (4.0.1) equalizer (0.0.11) @@ -368,15 +375,16 @@ GEM railties (>= 3.0.0) faker (1.9.6) i18n (>= 0.7) - faraday (1.0.1) + faraday (1.1.0) multipart-post (>= 1.2, < 3) - ffi (1.9.25) + ruby2_keywords + ffi (1.13.1) file_validators (2.3.0) activemodel (>= 3.2) mime-types (>= 1.0) - foundation-rails (6.4.3.0) + foundation-rails (6.6.2.0) railties (>= 3.1.0) - sass (>= 3.3.0, < 3.5) + sass (>= 3.3.0) sprockets-es6 (>= 0.9.0) foundation_rails_helper (3.0.0) actionpack (>= 4.1, < 6.0) @@ -384,25 +392,25 @@ GEM activesupport (>= 4.1, < 6.0) railties (>= 4.1, < 6.0) tzinfo (~> 1.2, >= 1.2.2) - geocoder (1.6.2) + geocoder (1.6.4) globalid (0.4.2) activesupport (>= 4.2.0) graphiql-rails (1.4.11) railties sprockets-rails - graphql (1.10.8) + graphql (1.11.6) hashdiff (1.0.1) - hashie (4.1.0) + hashie (3.6.0) highline (2.0.3) html_tokenizer (0.0.7) htmlentities (4.3.4) http-accept (1.7.0) http-cookie (1.0.3) domain_name (~> 0.5) - httparty (0.18.0) + httparty (0.18.1) mime-types (~> 3.0) multi_xml (>= 0.5.2) - i18n (1.8.2) + i18n (1.8.5) concurrent-ruby (~> 1.0) i18n-tasks (0.9.31) activesupport (>= 4.0.2) @@ -414,34 +422,37 @@ GEM rails-i18n rainbow (>= 2.2.2, < 4.0) terminal-table (>= 1.5.1) - icalendar (2.6.1) + icalendar (2.7.0) ice_cube (~> 0.16) ice_cube (0.16.3) ice_nine (0.11.2) invisible_captcha (0.13.0) rails (>= 3.2.0) jaro_winkler (1.5.4) - jquery-rails (4.3.5) + jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-tmpl-rails (1.1.0) rails (>= 3.1.0) json (2.3.1) - jwt (2.2.1) - kaminari (1.2.0) + jwt (2.2.2) + kaminari (1.2.1) activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.0) - kaminari-activerecord (= 1.2.0) - kaminari-core (= 1.2.0) - kaminari-actionview (1.2.0) + kaminari-actionview (= 1.2.1) + kaminari-activerecord (= 1.2.1) + kaminari-core (= 1.2.1) + kaminari-actionview (1.2.1) actionview - kaminari-core (= 1.2.0) - kaminari-activerecord (1.2.0) + kaminari-core (= 1.2.1) + kaminari-activerecord (1.2.1) activerecord - kaminari-core (= 1.2.0) - kaminari-core (1.2.0) - kramdown (1.17.0) + kaminari-core (= 1.2.1) + kaminari-core (1.2.1) + kramdown (2.3.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) launchy (2.5.0) addressable (~> 2.7) letter_opener (1.7.0) @@ -460,31 +471,35 @@ GEM mini_mime (>= 0.1.1) marcel (0.3.3) mimemagic (~> 0.3.2) - mdl (0.5.0) - kramdown (~> 1.12, >= 1.12.0) - mixlib-cli (~> 1.7, >= 1.7.0) - mixlib-config (~> 2.2, >= 2.2.1) + mdl (0.11.0) + kramdown (~> 2.3) + kramdown-parser-gfm (~> 1.1) + mixlib-cli (~> 2.1, >= 2.1.1) + mixlib-config (>= 2.2.1, < 4) + mixlib-shellout method_source (1.0.0) mime-types (3.3.1) mime-types-data (~> 3.2015) - mime-types-data (3.2020.0425) - mimemagic (0.3.4) + mime-types-data (3.2020.0512) + mimemagic (0.3.5) mini_magick (4.10.1) mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.14.0) - mixlib-cli (1.7.0) - mixlib-config (2.2.18) + minitest (5.14.2) + mixlib-cli (2.1.8) + mixlib-config (3.0.9) tomlrb + mixlib-shellout (3.1.7) + chef-utils msgpack (1.3.3) - multi_json (1.14.1) + multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) mustache (1.1.1) netrc (0.11.0) - nio4r (2.5.2) - nobspw (0.6.1) - nokogiri (1.10.9) + nio4r (2.5.4) + nobspw (0.6.2) + nokogiri (1.10.10) mini_portile2 (~> 2.4.0) oauth (0.5.4) oauth2 (1.4.4) @@ -493,8 +508,8 @@ GEM multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - omniauth (1.9.1) - hashie (>= 3.4.6) + omniauth (1.9.0) + hashie (>= 3.4.6, < 3.7.0) rack (>= 1.6.2, < 3) omniauth-facebook (5.0.0) omniauth-oauth2 (~> 1.2) @@ -505,8 +520,8 @@ GEM omniauth-oauth (1.1.0) oauth omniauth (~> 1.0) - omniauth-oauth2 (1.6.0) - oauth2 (~> 1.1) + omniauth-oauth2 (1.7.0) + oauth2 (~> 1.4) omniauth (~> 1.9) omniauth-rails_csrf_protection (0.1.2) actionpack (>= 4.2) @@ -518,46 +533,47 @@ GEM paper_trail (10.3.1) activerecord (>= 4.2) request_store (~> 1.1) - parallel (1.19.1) - parser (2.7.1.2) - ast (~> 2.4.0) + parallel (1.19.2) + parser (2.7.2.0) + ast (~> 2.4.1) pg (1.1.4) - pg_search (2.3.2) + pg_search (2.3.4) activerecord (>= 5.2) activesupport (>= 5.2) - premailer (1.11.1) + premailer (1.14.2) addressable css_parser (>= 1.6.0) htmlentities (>= 4.0.0) premailer-rails (1.11.1) actionmailer (>= 3) premailer (~> 1.7, >= 1.7.9) - public_suffix (4.0.4) - puma (3.12.4) - rack (2.2.2) - rack-attack (6.3.0) + public_suffix (4.0.6) + puma (4.3.6) + nio4r (~> 2.0) + rack (2.2.3) + rack-attack (6.3.1) rack (>= 1.0, < 3) rack-cors (1.1.1) rack (>= 2.0.0) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.4.2) - actioncable (= 5.2.4.2) - actionmailer (= 5.2.4.2) - actionpack (= 5.2.4.2) - actionview (= 5.2.4.2) - activejob (= 5.2.4.2) - activemodel (= 5.2.4.2) - activerecord (= 5.2.4.2) - activestorage (= 5.2.4.2) - activesupport (= 5.2.4.2) + rails (5.2.4.4) + actioncable (= 5.2.4.4) + actionmailer (= 5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) + activemodel (= 5.2.4.4) + activerecord (= 5.2.4.4) + activestorage (= 5.2.4.4) + activesupport (= 5.2.4.4) bundler (>= 1.3.0) - railties (= 5.2.4.2) + railties (= 5.2.4.4) sprockets-rails (>= 2.0.0) - rails-controller-testing (1.0.4) - actionpack (>= 5.0.1.x) - actionview (>= 5.0.1.x) - activesupport (>= 5.0.1.x) + rails-controller-testing (1.0.5) + actionpack (>= 5.0.1.rc1) + actionview (>= 5.0.1.rc1) + activesupport (>= 5.0.1.rc1) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) @@ -566,9 +582,9 @@ GEM rails-i18n (5.1.3) i18n (>= 0.7, < 2) railties (>= 5.0, < 6) - railties (5.2.4.2) - actionpack (= 5.2.4.2) - activesupport (= 5.2.4.2) + railties (5.2.4.4) + actionpack (= 5.2.4.4) + activesupport (= 5.2.4.4) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) @@ -589,11 +605,11 @@ GEM virtus (~> 1.0.5) wisper (>= 1.6.1) redcarpet (3.5.0) - redis (4.1.3) - regexp_parser (1.7.0) + redis (4.2.2) + regexp_parser (1.8.2) request_store (1.5.0) rack (>= 1.4) - responders (3.0.0) + responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) rest-client (2.1.0) @@ -601,6 +617,7 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) + rexml (3.2.4) rspec (3.9.0) rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) @@ -608,12 +625,12 @@ GEM rspec-cells (0.3.5) cells (>= 4.0.0, < 6.0.0) rspec-rails (< 5.0) - rspec-core (3.9.1) - rspec-support (~> 3.9.1) - rspec-expectations (3.9.1) + rspec-core (3.9.3) + rspec-support (~> 3.9.3) + rspec-expectations (3.9.4) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) - rspec-html-matchers (0.9.2) + rspec-html-matchers (0.9.4) nokogiri (~> 1) rspec (>= 3.0.0.a, < 4) rspec-mocks (3.9.1) @@ -627,7 +644,9 @@ GEM rspec-expectations (~> 3.9.0) rspec-mocks (~> 3.9.0) rspec-support (~> 3.9.0) - rspec-support (3.9.2) + rspec-retry (0.6.2) + rspec-core (> 3.3) + rspec-support (3.9.4) rspec_junit_formatter (0.3.0) rspec-core (>= 2, < 4, != 2.12.0) rubocop (0.71.0) @@ -640,38 +659,42 @@ GEM rubocop-rails (2.0.1) rack (>= 1.1) rubocop (>= 0.70.0) - rubocop-rspec (1.38.1) + rubocop-rspec (1.41.0) rubocop (>= 0.68.1) ruby-ole (1.2.12.2) ruby-progressbar (1.10.1) + ruby2_keywords (0.0.2) rubyzip (2.0.0) - safe_yaml (1.0.5) - sass (3.4.25) - sassc (1.12.1) - ffi (~> 1.9.6) - sass (>= 3.3.0) - sassc-rails (1.3.0) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sassc (2.3.0) + ffi (~> 1.9) + sassc-rails (2.1.2) railties (>= 4.0.0) - sass - sassc (~> 1.9) - sprockets (> 2.11) + sassc (>= 2.0) + sprockets (> 3.0) sprockets-rails tilt searchlight (4.1.0) selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) - simplecov (0.17.1) + seven_zip_ruby (1.3.0) + simplecov (0.18.5) docile (~> 1.1) - json (>= 1.8, < 3) - simplecov-html (~> 0.10.0) - simplecov-html (0.10.2) + simplecov-html (~> 0.11) + simplecov-cobertura (1.3.1) + simplecov (~> 0.8) + simplecov-html (0.12.3) smart_properties (1.15.0) - social-share-button (1.2.1) + social-share-button (1.2.3) coffee-rails spreadsheet (1.2.6) ruby-ole (>= 1.0) - spring (2.1.0) + spring (2.1.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) @@ -682,14 +705,14 @@ GEM babel-source (>= 5.8.11) babel-transpiler sprockets (>= 3.0.0) - sprockets-rails (3.2.1) + sprockets-rails (3.2.2) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) system_test_html_screenshots (0.1.2) actionpack (>= 5.2, < 6.0.a) temple (0.8.2) - terminal-table (1.8.0) + terminal-table (2.0.0) unicode-display_width (~> 1.1, >= 1.1.1) thor (1.0.1) thread_safe (0.3.6) @@ -715,20 +738,20 @@ GEM coercible (~> 1.0) descendants_tracker (~> 0.0, >= 0.0.3) equalizer (~> 0.0, >= 0.0.9) - warden (1.2.8) - rack (>= 2.0.6) + warden (1.2.9) + rack (>= 2.0.9) web-console (3.7.0) actionview (>= 5.0) activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) - webmock (3.8.3) + webmock (3.9.3) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - websocket-driver (0.7.1) + websocket-driver (0.7.3) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.4) + websocket-extensions (0.1.5) wisper (2.0.1) wisper-rspec (1.1.0) xpath (3.2.0) @@ -741,14 +764,14 @@ DEPENDENCIES bootsnap (~> 1.3) byebug (~> 11.0) codecov - decidim (= 0.20.0) - decidim-dev (= 0.20.0) + decidim (= 0.22.0) + decidim-dev (= 0.22.0) decidim-direct_verifications! faker (~> 1.9) letter_opener_web (~> 1.3) listen (~> 3.1) - puma (~> 3.0) - simplecov (~> 0.10, < 0.18) + puma (~> 4.0) + simplecov (~> 0.18.5) spring (~> 2.0) spring-watcher-listen (~> 2.0) uglifier (~> 4.1) diff --git a/lib/decidim/direct_verifications/version.rb b/lib/decidim/direct_verifications/version.rb index 6c55ec4..850ec44 100644 --- a/lib/decidim/direct_verifications/version.rb +++ b/lib/decidim/direct_verifications/version.rb @@ -3,8 +3,8 @@ module Decidim # This holds the decidim-direct_verifications version. module DirectVerifications - VERSION = "0.20" - DECIDIM_VERSION = "0.20.0" - MIN_DECIDIM_VERSION = ">= 0.17.0" + VERSION = "0.22" + DECIDIM_VERSION = "0.22.0" + MIN_DECIDIM_VERSION = ">= 0.22.0" end end From f1f13daa9cf178b2d6d69bff326e68d8d45b4d6c Mon Sep 17 00:00:00 2001 From: Maxim Colls Date: Tue, 3 Nov 2020 12:41:25 +0100 Subject: [PATCH 5/9] Fixed specs --- .../verification/confirm_user_authorization_spec.rb | 3 ++- .../decidim/direct_verifications/user_processor_spec.rb | 3 ++- .../admin/admin_manages_imported_authorizations_spec.rb | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/spec/commands/decidim/direct_verifications/verification/confirm_user_authorization_spec.rb b/spec/commands/decidim/direct_verifications/verification/confirm_user_authorization_spec.rb index b77c52f..f0225f6 100644 --- a/spec/commands/decidim/direct_verifications/verification/confirm_user_authorization_spec.rb +++ b/spec/commands/decidim/direct_verifications/verification/confirm_user_authorization_spec.rb @@ -7,8 +7,9 @@ module DirectVerifications module Verification module Admin describe ConfirmUserAuthorization do - subject { described_class.new(authorization, form) } + subject { described_class.new(authorization, form, session) } + let(:session) { double(:session) } let(:organization) do create(:organization, available_authorizations: ["direct_verifications"]) end diff --git a/spec/lib/decidim/direct_verifications/user_processor_spec.rb b/spec/lib/decidim/direct_verifications/user_processor_spec.rb index 3031cc0..f7a3ace 100644 --- a/spec/lib/decidim/direct_verifications/user_processor_spec.rb +++ b/spec/lib/decidim/direct_verifications/user_processor_spec.rb @@ -5,9 +5,10 @@ module Decidim module DirectVerifications describe UserProcessor do - subject { described_class.new(organization, user) } + subject { described_class.new(organization, user, session) } let(:user) { create(:user, :confirmed, :admin, organization: organization) } + let(:session) { double(:session) } let(:organization) do create(:organization, available_authorizations: ["direct_verifications"]) end diff --git a/spec/system/decidim/direct_verifications/admin/admin_manages_imported_authorizations_spec.rb b/spec/system/decidim/direct_verifications/admin/admin_manages_imported_authorizations_spec.rb index 3ca8563..bf99a36 100644 --- a/spec/system/decidim/direct_verifications/admin/admin_manages_imported_authorizations_spec.rb +++ b/spec/system/decidim/direct_verifications/admin/admin_manages_imported_authorizations_spec.rb @@ -22,10 +22,10 @@ context "when listing authorizations" do it "lists authorizations imported through direct_verifications" do within "table thead" do - expect(page).to have_content(I18n.t("authorizations.index.name", scope: scope).upcase) - expect(page).to have_content(I18n.t("authorizations.index.metadata", scope: scope).upcase) - expect(page).to have_content(I18n.t("authorizations.index.user_name", scope: scope).upcase) - expect(page).to have_content(I18n.t("authorizations.index.created_at", scope: scope).upcase) + expect(page).to have_content(I18n.t("authorizations.index.name", scope: scope)) + expect(page).to have_content(I18n.t("authorizations.index.metadata", scope: scope)) + expect(page).to have_content(I18n.t("authorizations.index.user_name", scope: scope)) + expect(page).to have_content(I18n.t("authorizations.index.created_at", scope: scope)) end within "tr[data-authorization-id=\"#{authorization.id}\"]" do From 2f05e00734b8bfcb14e4b5b2a4377d2757468030 Mon Sep 17 00:00:00 2001 From: Maxim Colls Date: Wed, 4 Nov 2020 09:43:10 +0100 Subject: [PATCH 6/9] Fixed test --- .../admin/admin_manages_imported_authorizations_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/system/decidim/direct_verifications/admin/admin_manages_imported_authorizations_spec.rb b/spec/system/decidim/direct_verifications/admin/admin_manages_imported_authorizations_spec.rb index 3ca8563..551dada 100644 --- a/spec/system/decidim/direct_verifications/admin/admin_manages_imported_authorizations_spec.rb +++ b/spec/system/decidim/direct_verifications/admin/admin_manages_imported_authorizations_spec.rb @@ -6,7 +6,7 @@ let(:organization) { create(:organization) } let(:user) { create(:user, :admin, :confirmed, organization: organization) } - let!(:authorization) { create(:authorization, :direct_verification) } + let!(:authorization) { create(:authorization, :direct_verification, user: user) } let!(:non_direct_authorization) { create(:authorization) } let(:scope) { "decidim.direct_verifications.verification.admin" } From b79c6557502e9cc5d2e88912b5ab2a0881fbee20 Mon Sep 17 00:00:00 2001 From: Maxim Colls Date: Wed, 4 Nov 2020 09:49:30 +0100 Subject: [PATCH 7/9] Added test to cover unscoped authorizations --- .../admin/admin_manages_imported_authorizations_spec.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/system/decidim/direct_verifications/admin/admin_manages_imported_authorizations_spec.rb b/spec/system/decidim/direct_verifications/admin/admin_manages_imported_authorizations_spec.rb index 551dada..fa6a778 100644 --- a/spec/system/decidim/direct_verifications/admin/admin_manages_imported_authorizations_spec.rb +++ b/spec/system/decidim/direct_verifications/admin/admin_manages_imported_authorizations_spec.rb @@ -5,8 +5,10 @@ describe "Admin manages imported authorizations", type: :system do let(:organization) { create(:organization) } let(:user) { create(:user, :admin, :confirmed, organization: organization) } + let(:out_of_scope_user) { create(:user, :confirmed) } let!(:authorization) { create(:authorization, :direct_verification, user: user) } + let!(:out_of_scope_authorization) { create(:authorization, :direct_verification, user: out_of_scope_user) } let!(:non_direct_authorization) { create(:authorization) } let(:scope) { "decidim.direct_verifications.verification.admin" } @@ -36,6 +38,7 @@ end expect(page).not_to have_content(non_direct_authorization.name) + expect(page).not_to have_content(out_of_scope_authorization.user.name) end it "lets users navigate to stats and new import" do From 0c7aa4063dee38efbfa2b3086e7ba7ba8c0a9c5f Mon Sep 17 00:00:00 2001 From: Maxim Colls Date: Wed, 4 Nov 2020 10:03:32 +0100 Subject: [PATCH 8/9] Updated Gemfile.lock after resolving merge conflicts --- Gemfile.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c359109..d98ae76 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -771,7 +771,6 @@ DEPENDENCIES letter_opener_web (~> 1.3) listen (~> 3.1) puma (~> 4.0) - simplecov (~> 0.18.5) spring (~> 2.0) spring-watcher-listen (~> 2.0) uglifier (~> 4.1) From 60d8dc4018245b69f4ab05c8be29c650f589778e Mon Sep 17 00:00:00 2001 From: Maxim Colls Date: Wed, 4 Nov 2020 10:17:21 +0100 Subject: [PATCH 9/9] Fixed UserProcessor call after merging devel --- .../verification/admin/direct_verifications_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/decidim/direct_verifications/verification/admin/direct_verifications_controller.rb b/app/controllers/decidim/direct_verifications/verification/admin/direct_verifications_controller.rb index f0e1aa3..079de91 100644 --- a/app/controllers/decidim/direct_verifications/verification/admin/direct_verifications_controller.rb +++ b/app/controllers/decidim/direct_verifications/verification/admin/direct_verifications_controller.rb @@ -18,7 +18,7 @@ def create enforce_permission_to :create, :authorization @userslist = params[:userlist] - @processor = UserProcessor.new(current_organization, current_user) + @processor = UserProcessor.new(current_organization, current_user, session) @processor.emails = parser_class.new(@userslist).to_h @processor.authorization_handler = current_authorization_handler @stats = UserStats.new(current_organization)