Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#62107] Fix UserAuthProviderLink.users association.

Pavel Balashoucad4a3dba119
diff --git a/app/models/auth_provider.rb b/app/models/auth_provider.rb
index 130ae5aab74..087cd8fe95c 100644
--- a/app/models/auth_provider.rb
+++ b/app/models/auth_provider.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
@@ -32,7 +34,10 @@ class AuthProvider < ApplicationRecord
has_many :scim_clients, dependent: :restrict_with_error
has_many :user_auth_provider_links, dependent: :destroy
- has_many :users, through: :user_auth_provider_links
+ has_many :users,
+ -> { where(type: "User") },
+ through: :user_auth_provider_links,
+ source: :principal
validates :display_name, presence: true
validates :display_name, uniqueness: true
diff --git a/spec/requests/scim_v2/schemas_spec.rb b/spec/requests/scim_v2/schemas_spec.rb
index 618e05d7b0f..3d37867a7ba 100644
--- a/spec/requests/scim_v2/schemas_spec.rb
+++ b/spec/requests/scim_v2/schemas_spec.rb
@@ -42,7 +42,7 @@ RSpec.describe "SCIM API Schemas" do
describe "GET /scim_v2/Schemas" do
context "with the feature flag enabled", with_flag: { scim_api: true } do
- it "responds with supported schemas " do
+ it "responds with supported schemas" do
get "/scim_v2/Schemas", {}, headers
response_body = JSON.parse(last_response.body)