From b21390936a02764cc5aee8cfeef3d2f8419da4fc Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 22 Jun 2015 16:53:11 +0200 Subject: [PATCH] Make provider a select for identities form in admin area Signed-off-by: Dmitriy Zaporozhets --- app/views/admin/identities/_form.html.haml | 6 +++--- lib/gitlab/o_auth/provider.rb | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 lib/gitlab/o_auth/provider.rb diff --git a/app/views/admin/identities/_form.html.haml b/app/views/admin/identities/_form.html.haml index 1c34706a12..f0f3c3ff22 100644 --- a/app/views/admin/identities/_form.html.haml +++ b/app/views/admin/identities/_form.html.haml @@ -8,11 +8,11 @@ .form-group = f.label :provider, class: 'control-label' .col-sm-10 - = f.text_field :provider, required: true, autocomplete: "off", class: 'form-control', required: true + = f.select :provider, Gitlab::OAuth::Provider.names, { allow_blank: false }, class: 'form-control' .form-group - = f.label :extern_uid, class: 'control-label' + = f.label :extern_uid, "Identifier", class: 'control-label' .col-sm-10 - = f.text_field :extern_uid, required: true, autocomplete: "off", class: 'form-control', required: true + = f.text_field :extern_uid, required: true, class: 'form-control', required: true .form-actions = f.submit 'Save changes', class: "btn btn-save" diff --git a/lib/gitlab/o_auth/provider.rb b/lib/gitlab/o_auth/provider.rb new file mode 100644 index 0000000000..f986499a27 --- /dev/null +++ b/lib/gitlab/o_auth/provider.rb @@ -0,0 +1,19 @@ +module Gitlab + module OAuth + class Provider + def self.names + providers = [] + + Gitlab.config.ldap.servers.values.each do |server| + providers << server['provider_name'] + end + + Gitlab.config.omniauth.providers.each do |provider| + providers << provider['name'] + end + + providers + end + end + end +end