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

[33869] Use `auth_source` link for parsing

Oliver Günther46741d8579f9
diff --git a/lib/api/v3/users/user_representer.rb b/lib/api/v3/users/user_representer.rb
index 0bcaf665b7c..ad718cb1197 100644
--- a/lib/api/v3/users/user_representer.rb
+++ b/lib/api/v3/users/user_representer.rb
@@ -171,7 +171,7 @@ module API
##
# Used while parsing JSON to initialize `auth_source_id` through the given link.
def initialize_embedded_links!(data)
- auth_source_id = parse_auth_source_id data, "authSource"
+ auth_source_id = parse_auth_source_id data, "auth_source"
if auth_source_id
auth_source = AuthSource.find_by_unique auth_source_id
diff --git a/spec/requests/api/v3/user/create_user_resource_spec.rb b/spec/requests/api/v3/user/create_user_resource_spec.rb
index 2f389ca141f..4e5d7e30f3b 100644
--- a/spec/requests/api/v3/user/create_user_resource_spec.rb
+++ b/spec/requests/api/v3/user/create_user_resource_spec.rb
@@ -102,7 +102,7 @@ describe ::API::V3::Users::UsersAPI, type: :request do
context 'ID' do
before do
parameters[:_links] = {
- authSource: {
+ auth_source: {
href: "/api/v3/auth_sources/#{auth_source.id}"
}
}
@@ -122,7 +122,7 @@ describe ::API::V3::Users::UsersAPI, type: :request do
context 'name' do
before do
parameters[:_links] = {
- authSource: {
+ auth_source: {
href: "/api/v3/auth_sources/#{auth_source.name}"
}
}
@@ -142,15 +142,15 @@ describe ::API::V3::Users::UsersAPI, type: :request do
context 'invalid identifier' do
before do
parameters[:_links] = {
- authSource: {
+ auth_source: {
href: "/api/v3/auth_sources/foobar"
}
}
end
- it 'returns an error for the authSource attribute' do
+ it 'returns an error for the auth_source attribute' do
send_request
-
+
attr = JSON.parse(last_response.body).dig "_embedded", "details", "attribute"
expect(last_response.status).to eq 422