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

Allow admin mapping

Oliver Günther32afae17e071
diff --git a/modules/openid_connect/app/models/openid_connect/provider.rb b/modules/openid_connect/app/models/openid_connect/provider.rb
index 8e54cf309ea..18fa645b515 100644
--- a/modules/openid_connect/app/models/openid_connect/provider.rb
+++ b/modules/openid_connect/app/models/openid_connect/provider.rb
@@ -10,7 +10,7 @@ module OpenIDConnect
DISCOVERABLE_ATTRIBUTES_OPTIONAL = %i[end_session_endpoint jwks_uri].freeze
DISCOVERABLE_ATTRIBUTES_ALL = DISCOVERABLE_ATTRIBUTES_MANDATORY + DISCOVERABLE_ATTRIBUTES_OPTIONAL
- MAPPABLE_ATTRIBUTES = %i[login email first_name last_name].freeze
+ MAPPABLE_ATTRIBUTES = %i[login email first_name last_name admin].freeze
store_attribute :options, :oidc_provider, :string
store_attribute :options, :metadata_url, :string
diff --git a/modules/openid_connect/app/services/openid_connect/configuration_mapper.rb b/modules/openid_connect/app/services/openid_connect/configuration_mapper.rb
index 57f6d367737..546916d048b 100644
--- a/modules/openid_connect/app/services/openid_connect/configuration_mapper.rb
+++ b/modules/openid_connect/app/services/openid_connect/configuration_mapper.rb
@@ -45,8 +45,11 @@ module OpenIDConnect
"client_secret" => options["secret"],
"issuer" => options["issuer"],
"host" => options["host"],
+ "port" => options["port"],
+ "scheme" => options["scheme"],
"claims" => options["claims"],
"tenant" => options["tenant"],
+ "post_logout_redirect_uri" => options["post_logout_redirect_uri"],
"limit_self_registration" => options["limit_self_registration"],
"use_graph_api" => options["use_graph_api"],
"acr_values" => options["acr_values"],
@@ -113,7 +116,7 @@ module OpenIDConnect
options["mapping_mail"] = options["attribute_map"]["email"]
options["mapping_firstname"] = options["attribute_map"]["first_name"]
options["mapping_lastname"] = options["attribute_map"]["last_name"]
- options["mapping_uid"] = options["attribute_map"]["uid"]
+ options["mapping_admin"] = options["attribute_map"]["admin"]
end
end
end
diff --git a/modules/openid_connect/config/locales/en.yml b/modules/openid_connect/config/locales/en.yml
index f54137e5ea7..76689750d8c 100644
--- a/modules/openid_connect/config/locales/en.yml
+++ b/modules/openid_connect/config/locales/en.yml
@@ -76,6 +76,9 @@ en:
Provide a custom mapping in the userinfo response to be used for the first name.
mapping_last_name: >
Provide a custom mapping in the userinfo response to be used for the last name.
+ mapping_admin: >
+ Provide a custom mapping in the userinfo response to be used for the admin status.
+ It expects a boolean attribute to be returned.
settings:
metadata_none: I don't have this information
metadata_url: I have a discovery endpoint URL