From b2bdbdd06874941dbfd8f8fe9f33b16e97376bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Bol=C3=ADvar?= Date: Thu, 11 Jul 2024 09:16:01 +0200 Subject: [PATCH 1/4] Install module with UB OAuth and verifications --- Gemfile | 1 + Gemfile.lock | 8 ++++++++ .../20240711071117_add_ub_roles_to_users.decidim_ub.rb | 8 ++++++++ db/schema.rb | 3 ++- 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20240711071117_add_ub_roles_to_users.decidim_ub.rb diff --git a/Gemfile b/Gemfile index 85f00a6..190d675 100644 --- a/Gemfile +++ b/Gemfile @@ -12,6 +12,7 @@ gem "decidim", "0.28.1" gem "decidim-templates", "0.28.1" gem "decidim-decidim_awesome", git: "https://github.com/decidim-ice/decidim-module-decidim_awesome", branch: "develop" +gem "decidim-ub", git: "https://github.com/Platoniq/decidim-module-ub" gem "bootsnap", "~> 1.3" diff --git a/Gemfile.lock b/Gemfile.lock index 757124a..06f9444 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,10 @@ +GIT + remote: https://github.com/Platoniq/decidim-module-ub + revision: 252f0d2ddf3767ec822cd2b1c61acb103a90c1c1 + specs: + decidim-ub (0.1.0) + decidim-core (>= 0.28.0, < 0.29) + GIT remote: https://github.com/decidim-ice/decidim-module-decidim_awesome revision: b2800256f5e147452438686029b3990c89fb21be @@ -883,6 +890,7 @@ DEPENDENCIES decidim-decidim_awesome! decidim-dev (= 0.28.1) decidim-templates (= 0.28.1) + decidim-ub! figaro (~> 1.2) letter_opener_web (~> 2.0) listen (~> 3.1) diff --git a/db/migrate/20240711071117_add_ub_roles_to_users.decidim_ub.rb b/db/migrate/20240711071117_add_ub_roles_to_users.decidim_ub.rb new file mode 100644 index 0000000..0266461 --- /dev/null +++ b/db/migrate/20240711071117_add_ub_roles_to_users.decidim_ub.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true +# This migration comes from decidim_ub (originally 20240709154301) + +class AddUbRolesToUsers < ActiveRecord::Migration[6.0] + def change + add_column :decidim_users, :ub_roles, :jsonb, default: [] + end +end diff --git a/db/schema.rb b/db/schema.rb index 89c88bc..ae7e8ed 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2024_07_03_090227) do +ActiveRecord::Schema.define(version: 2024_07_11_071117) do # These are extensions that must be enabled in order to support this database enable_extension "ltree" @@ -1633,6 +1633,7 @@ t.datetime "officialized_at" t.jsonb "officialized_as" t.datetime "admin_terms_accepted_at" + t.jsonb "ub_roles", default: [] t.index ["confirmation_token"], name: "index_decidim_users_on_confirmation_token", unique: true t.index ["decidim_organization_id"], name: "index_decidim_users_on_decidim_organization_id" t.index ["email", "decidim_organization_id"], name: "index_decidim_users_on_email_and_decidim_organization_id", unique: true, where: "((deleted_at IS NULL) AND (managed = false) AND ((type)::text = 'Decidim::User'::text))" From 7e4102e9b1c0e50924a972ba99207448c49a611c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Bol=C3=ADvar?= Date: Thu, 11 Jul 2024 09:50:53 +0200 Subject: [PATCH 2/4] Install ub from RubyGems --- Gemfile | 2 +- Gemfile.lock | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index 190d675..fc95c08 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem "decidim", "0.28.1" gem "decidim-templates", "0.28.1" gem "decidim-decidim_awesome", git: "https://github.com/decidim-ice/decidim-module-decidim_awesome", branch: "develop" -gem "decidim-ub", git: "https://github.com/Platoniq/decidim-module-ub" +gem "decidim-ub" gem "bootsnap", "~> 1.3" diff --git a/Gemfile.lock b/Gemfile.lock index 06f9444..7266fe4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,10 +1,3 @@ -GIT - remote: https://github.com/Platoniq/decidim-module-ub - revision: 252f0d2ddf3767ec822cd2b1c61acb103a90c1c1 - specs: - decidim-ub (0.1.0) - decidim-core (>= 0.28.0, < 0.29) - GIT remote: https://github.com/decidim-ice/decidim-module-decidim_awesome revision: b2800256f5e147452438686029b3990c89fb21be @@ -354,6 +347,8 @@ GEM decidim-templates (0.28.1) decidim-core (= 0.28.1) decidim-forms (= 0.28.1) + decidim-ub (0.1.0) + decidim-core (>= 0.28.0, < 0.29) decidim-verifications (0.28.1) decidim-core (= 0.28.1) declarative-builder (0.1.0) @@ -890,7 +885,7 @@ DEPENDENCIES decidim-decidim_awesome! decidim-dev (= 0.28.1) decidim-templates (= 0.28.1) - decidim-ub! + decidim-ub figaro (~> 1.2) letter_opener_web (~> 2.0) listen (~> 3.1) From e19526f9cfcd0b864423b6b29bc21b3439182f17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Bol=C3=ADvar?= Date: Thu, 11 Jul 2024 09:57:36 +0200 Subject: [PATCH 3/4] Manually configure UB module --- config/initializers/ub.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 config/initializers/ub.rb diff --git a/config/initializers/ub.rb b/config/initializers/ub.rb new file mode 100644 index 0000000..4b75fcc --- /dev/null +++ b/config/initializers/ub.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +Decidim::Ub.configure do |config| + config.omniauth = { + enabled: ENV["UB_CLIENT_ID"].present?, + icon_path: ENV.fetch("UB_ICON", "media/images/ub_logo.svg"), + client_id: ENV["UB_CLIENT_ID"].presence, + client_secret: ENV["UB_CLIENT_SECRET"].presence, + site: ENV["UB_SITE"].presence, + authorize_url: ENV["UB_AUTHORIZE_URL"].presence, + token_url: ENV["UB_TOKEN_URL"].presence + } +end From eacca618fe465ab76b9a40ce16bdd43b7f4702ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Bol=C3=ADvar?= Date: Fri, 12 Jul 2024 12:41:11 +0200 Subject: [PATCH 4/4] Bump decidim-ub version from 0.1.0 to 0.1.1 --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7266fe4..8a4e8b9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -347,7 +347,7 @@ GEM decidim-templates (0.28.1) decidim-core (= 0.28.1) decidim-forms (= 0.28.1) - decidim-ub (0.1.0) + decidim-ub (0.1.1) decidim-core (>= 0.28.0, < 0.29) decidim-verifications (0.28.1) decidim-core (= 0.28.1)