From fa98b91f8a18a40d2e257977ddbb6d1ad322b307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=20=C4=86epi=C4=87?= Date: Fri, 16 Aug 2024 13:19:23 +0200 Subject: [PATCH 1/7] Add .idea to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a2f36b5..278ca04 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ # rspec failure tracking .rspec_status coverage +.idea From 0df1bfbc612c0935936423e1fb8dba51207313da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=20=C4=86epi=C4=87?= Date: Fri, 16 Aug 2024 13:59:14 +0200 Subject: [PATCH 2/7] Change provider_groups to groups --- README.md | 2 +- lib/infinum_azure/config.rb | 2 +- spec/rails_app/config/application.rb | 2 +- spec/rails_app/db/migrate/20181109120000_create_users.rb | 2 +- spec/rails_app/db/schema.rb | 7 +++---- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 05a6475..77c0fd5 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Or install it yourself as: InfinumAzure.configure do |config| config.resource_name = 'User' config.resource_attributes = [:uid, :email, :first_name, :last_name, :avatar_url, - :deactivated_at, :provider_groups, :employee] + :deactivated_at, :groups, :employee] config.user_migration_scope = -> { resource_class.where(provider: 'infinum_id') } config.user_migration_operation = -> (record, resource) { diff --git a/lib/infinum_azure/config.rb b/lib/infinum_azure/config.rb index 606126b..3ceba64 100644 --- a/lib/infinum_azure/config.rb +++ b/lib/infinum_azure/config.rb @@ -6,7 +6,7 @@ class Config PROVIDER_INFINUM_AZURE = 'infinum_azure' UID = 'uid' DEFAULT_RESOURCE_ATTRIBUTES = [ - :uid, :email, :first_name, :last_name, :avatar_url, :deactivated_at, :provider_groups, :employee + :uid, :email, :first_name, :last_name, :avatar_url, :deactivated_at, :groups, :employee ].freeze attr_accessor :resource_name diff --git a/spec/rails_app/config/application.rb b/spec/rails_app/config/application.rb index 3e3109d..76a5a8d 100644 --- a/spec/rails_app/config/application.rb +++ b/spec/rails_app/config/application.rb @@ -14,7 +14,7 @@ class Application < Rails::Application InfinumAzure.config.resource_name = 'User' InfinumAzure.config.resource_attributes = [ - :uid, :email, :first_name, :last_name, :avatar_url, :deactivated_at, :provider_groups, :employee + :uid, :email, :first_name, :last_name, :avatar_url, :deactivated_at, :groups, :employee ] end end diff --git a/spec/rails_app/db/migrate/20181109120000_create_users.rb b/spec/rails_app/db/migrate/20181109120000_create_users.rb index 26166e6..59feab2 100644 --- a/spec/rails_app/db/migrate/20181109120000_create_users.rb +++ b/spec/rails_app/db/migrate/20181109120000_create_users.rb @@ -15,7 +15,7 @@ def change # rubocop:disable Metrics/MethodLength t.string :uid t.datetime :deactivated_at - t.string :provider_groups + t.string :groups t.boolean :employee t.datetime :remember_created_at diff --git a/spec/rails_app/db/schema.rb b/spec/rails_app/db/schema.rb index f7bf752..371f373 100644 --- a/spec/rails_app/db/schema.rb +++ b/spec/rails_app/db/schema.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -12,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 20_181_109_120_000) do +ActiveRecord::Schema[7.0].define(version: 2018_11_09_120000) do create_table 'users', force: :cascade do |t| t.string 'email', default: '', null: false t.string 'first_name' @@ -21,7 +19,7 @@ t.string 'provider' t.string 'uid' t.datetime 'deactivated_at', precision: nil - t.string 'provider_groups' + t.string 'groups' t.boolean 'employee' t.datetime 'remember_created_at', precision: nil t.string 'remember_token' @@ -29,4 +27,5 @@ t.datetime 'updated_at', precision: nil, null: false t.index ['email'], name: 'index_users_on_email', unique: true end + end From 630a6935a5844205d8f360685c7dd0a166610f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=20=C4=86epi=C4=87?= Date: Fri, 16 Aug 2024 16:14:20 +0200 Subject: [PATCH 3/7] Add groups :propagate to NORMALIZATIONS --- .../infinum_azure/resources/params.rb | 3 ++- spec/rails_app/db/test.sqlite3 | Bin 32768 -> 36864 bytes .../api/webhooks_controller_spec.rb | 1 + .../infinum_azure/resources/params_spec.rb | 5 +++-- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/services/infinum_azure/resources/params.rb b/app/services/infinum_azure/resources/params.rb index 7ccc6e7..4edf29f 100644 --- a/app/services/infinum_azure/resources/params.rb +++ b/app/services/infinum_azure/resources/params.rb @@ -16,7 +16,8 @@ class Params employee: { procedure: ->(value) { value&.include?('employees') }, target_name: :groups - } + }, + groups: :propagate }.freeze def self.normalize(payload) diff --git a/spec/rails_app/db/test.sqlite3 b/spec/rails_app/db/test.sqlite3 index abb3f4b91f942c57a5ea24132883bd8e699b17b2..3768252e940835b781b36771dbdf2a9ffeb47643 100644 GIT binary patch delta 986 zcmb7DL2J}N6wY)to2=VSdkR=9Lt$x4iyp+2h^#i?f|ONS&{Le2i~5b@M{A?pdE&Ypoy68|KCGXY=;Qlhhc$tr>N@-3HUHKz$#_5$2KW z4P6n0W!Zf6%;_9B@SyYXi37_ojjaZhi+I_$x(F3`h>9+sJhr|G^^(DHD*!zMsdI1rTx)AU=Y}cmz=_7@-4>13ac;H^<-r5x4Qhn&S>v`8Y8Dn4)!`fP+tc|zD{%*Ti-4_PsT zKIX10>zrv$@*6_1V@wrSGFBy4h>~d$%G^hxSo~XM6o(mPky!@(hf!m@r|b644tSCG z`}ua$xnlhUk5k^<1LnZ2+jnhnQa}H4?dE-b*7S$_-KU2R?C$S5&mo~6e(kCWVARd~ zChs6d)m*@>T$f&Ned~Zm3VO8_9axu|b(yaAzFO-RsI`qaGC<9iha5LKtn;Ny$am|k JclE=|m0x?U2(SPE delta 239 zcmZozz|_#dG(lRBg@J*A1BhXOWulI;Gz)`X+6!L(9}Mi=TN(JR`M2^(^L^sU-=bnwv9~on72ioUxI6@_t@9dk*IySH}=ng-}1wz))8OPd^ve2nD6gyp+_6_|oFk zqT=}cy!h1I#LOHe1%E#UC9s&1f`$@AY_c>@FiW!*EBodm9v8;R>AbvpMX9-|xk;%- z@g@1$sd-8YWr;<}8Hq(Y3QEaEsfi`2De;LVN(w1JR!L@V>g1z*3Y-dl{vir}p*}vF YrTCsXGV*R_3}6=6%o6a2e^Gz{0QaXt%>V!Z diff --git a/spec/requests/infinum_azure/api/webhooks_controller_spec.rb b/spec/requests/infinum_azure/api/webhooks_controller_spec.rb index b87ac23..1aa4cf8 100644 --- a/spec/requests/infinum_azure/api/webhooks_controller_spec.rb +++ b/spec/requests/infinum_azure/api/webhooks_controller_spec.rb @@ -46,6 +46,7 @@ last_name: user_params[:last_name], avatar_url: azure_params[:avatar_url], deactivated_at: nil, + groups: 'employees', employee: true } diff --git a/spec/services/infinum_azure/resources/params_spec.rb b/spec/services/infinum_azure/resources/params_spec.rb index 36000b0..af47f50 100644 --- a/spec/services/infinum_azure/resources/params_spec.rb +++ b/spec/services/infinum_azure/resources/params_spec.rb @@ -10,7 +10,8 @@ email: 'email', first_name: 'first_name', last_name: 'last_name', - avatar_url: 'avatar_url' + avatar_url: 'avatar_url', + groups: 'groups' } end @@ -18,7 +19,7 @@ let(:params) { propagating_params } it 'just propagates the attributes marked as :propagate' do - expect(normalized_hash).to eq(params.merge(deactivated_at: nil, employee: nil)) + expect(normalized_hash).to eq(params.merge(deactivated_at: nil, employee: false)) end end From c53321ee35f617744974ff8c0b0cb21a096dbd7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=20=C4=86epi=C4=87?= Date: Mon, 19 Aug 2024 09:50:57 +0200 Subject: [PATCH 4/7] Change version to 4.0.0 --- CHANGELOG.md | 5 +++++ Gemfile.lock | 2 +- lib/infinum_azure/version.rb | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8933b9b..e139a9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## [Unreleased] +## [4.0.0] - 2024-08-16 + +### Changed +- Change provider_groups to groups and add groups attribute to Params + ## [3.0.0] - 2024-06-12 ### Changed diff --git a/Gemfile.lock b/Gemfile.lock index aa0be57..c3ae0c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - infinum_azure (3.0.0) + infinum_azure (4.0.0) bundler devise omniauth-infinum_azure (>= 0.3.0, < 2.0) diff --git a/lib/infinum_azure/version.rb b/lib/infinum_azure/version.rb index db10860..219dc0e 100644 --- a/lib/infinum_azure/version.rb +++ b/lib/infinum_azure/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module InfinumAzure - VERSION = '3.0.0' + VERSION = '4.0.0' end From bafcd2010bd6e1e879041c27adf5867a3036dcb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=20=C4=86epi=C4=87?= Date: Mon, 19 Aug 2024 10:16:41 +0200 Subject: [PATCH 5/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 77c0fd5..a28aa93 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ Configuration options: * *last_name* _string_ * *avatar_url* _string_ * *deactivated_at* _datetime_ -* *provider_groups* _jsonb array_ +* *groups* _jsonb array_ * *employee* _boolean_ 2. Add following rows to resource model: From 562c2a47da294b5f5f72809299481500ae821eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=20=C4=86epi=C4=87?= Date: Mon, 19 Aug 2024 10:23:56 +0200 Subject: [PATCH 6/7] Fix rubocop warnings --- spec/rails_app/db/schema.rb | 5 +++-- spec/support/factory_bot.rb | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/rails_app/db/schema.rb b/spec/rails_app/db/schema.rb index 371f373..6b1ce4b 100644 --- a/spec/rails_app/db/schema.rb +++ b/spec/rails_app/db/schema.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -10,7 +12,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2018_11_09_120000) do +ActiveRecord::Schema[7.0].define(version: 20_181_109_120_000) do create_table 'users', force: :cascade do |t| t.string 'email', default: '', null: false t.string 'first_name' @@ -27,5 +29,4 @@ t.datetime 'updated_at', precision: nil, null: false t.index ['email'], name: 'index_users_on_email', unique: true end - end diff --git a/spec/support/factory_bot.rb b/spec/support/factory_bot.rb index 63fd4b0..1ba9fff 100644 --- a/spec/support/factory_bot.rb +++ b/spec/support/factory_bot.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'pathname' FactoryBot.definition_file_paths = [Pathname.new(File.expand_path('../factories', __dir__))] From 53d2e55dc7ea47081858fb5a9b3845f7d59b5066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=20=C4=86epi=C4=87?= Date: Mon, 19 Aug 2024 11:12:50 +0200 Subject: [PATCH 7/7] Rename version from 4.0.0 to 3.1.0 --- CHANGELOG.md | 2 +- Gemfile.lock | 2 +- lib/infinum_azure/version.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e139a9f..405d485 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## [Unreleased] -## [4.0.0] - 2024-08-16 +## [3.1.0] - 2024-08-16 ### Changed - Change provider_groups to groups and add groups attribute to Params diff --git a/Gemfile.lock b/Gemfile.lock index c3ae0c4..e640f86 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - infinum_azure (4.0.0) + infinum_azure (3.1.0) bundler devise omniauth-infinum_azure (>= 0.3.0, < 2.0) diff --git a/lib/infinum_azure/version.rb b/lib/infinum_azure/version.rb index 219dc0e..083b77b 100644 --- a/lib/infinum_azure/version.rb +++ b/lib/infinum_azure/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module InfinumAzure - VERSION = '4.0.0' + VERSION = '3.1.0' end