summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-22 16:53:11 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-22 16:53:11 +0200
commitb21390936a02764cc5aee8cfeef3d2f8419da4fc (patch)
tree708159d606d1c6b9797704261bfd17383fb01d68
parent8f89a4884744cf633fcff218dcfc657a8ff922b4 (diff)
downloadgitlab-ce-b21390936a02764cc5aee8cfeef3d2f8419da4fc.tar.gz
Make provider a select for identities form in admin area
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--app/views/admin/identities/_form.html.haml6
-rw-r--r--lib/gitlab/o_auth/provider.rb19
2 files changed, 22 insertions, 3 deletions
diff --git a/app/views/admin/identities/_form.html.haml b/app/views/admin/identities/_form.html.haml
index 1c34706a124..f0f3c3ff221 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 00000000000..f986499a27c
--- /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