Add provider to LDAP group links

parent 3702eb54
...@@ -36,6 +36,6 @@ class Groups::LdapGroupLinksController < ApplicationController ...@@ -36,6 +36,6 @@ class Groups::LdapGroupLinksController < ApplicationController
end end
def ldap_group_link_params def ldap_group_link_params
params.require(:ldap_group_link).permit(:cn, :group_access) params.require(:ldap_group_link).permit(:cn, :group_access, :provider)
end end
end end
...@@ -9,4 +9,17 @@ class LdapGroupLink < ActiveRecord::Base ...@@ -9,4 +9,17 @@ class LdapGroupLink < ActiveRecord::Base
def access_field def access_field
group_access group_access
end end
def config
Gitlab::LDAP::Config.new(provider)
end
# default to the first LDAP server
def provider
read_attribute(:provider) || Gitlab::LDAP::Config.providers.first
end
def provider_label
config.label
end
end end
...@@ -3,6 +3,15 @@ ...@@ -3,6 +3,15 @@
%fieldset %fieldset
%legend %legend
%div.form-holder %div.form-holder
.form-group.clearfix
= f.label :cn, class: 'control-label' do
LDAP Server
.col-sm-10
- Gitlab::LDAP::Config.servers.each do |server|
.radio-inline
= f.radio_button :provider, server.provider_name
= server.label
.form-group.clearfix .form-group.clearfix
= f.label :cn, class: 'control-label' do = f.label :cn, class: 'control-label' do
LDAP Group cn LDAP Group cn
......
%li %li
= ldap_group_link.cn = ldap_group_link.cn
%small.light== as #{ldap_group_link.human_access} %small.light== as #{ldap_group_link.human_access} on #{ldap_group_link.provider_label}
.pull-right .pull-right
= link_to group_ldap_group_link_path(group, ldap_group_link), method: :delete, class: 'btn btn-danger btn-small' do = link_to group_ldap_group_link_path(group, ldap_group_link), method: :delete, class: 'btn btn-danger btn-small' do
= fa_icon('unlink', text: 'unlink') = fa_icon('unlink', text: 'unlink')
class AddProviderToLdapGroupLinks < ActiveRecord::Migration
def change
add_column :ldap_group_links, :provider, :string
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140914173417) do ActiveRecord::Schema.define(version: 20141010132608) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -155,6 +155,7 @@ ActiveRecord::Schema.define(version: 20140914173417) do ...@@ -155,6 +155,7 @@ ActiveRecord::Schema.define(version: 20140914173417) do
t.integer "group_id", null: false t.integer "group_id", null: false
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "provider"
end end
create_table "members", force: true do |t| create_table "members", force: true do |t|
......
...@@ -44,6 +44,10 @@ module Gitlab ...@@ -44,6 +44,10 @@ module Gitlab
options['uid'] options['uid']
end end
def label
options['label']
end
def sync_ssh_keys? def sync_ssh_keys?
sync_ssh_keys.present? sync_ssh_keys.present?
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment