Add provider to LDAP group links

parent 3702eb54
......@@ -36,6 +36,6 @@ class Groups::LdapGroupLinksController < ApplicationController
end
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
......@@ -9,4 +9,17 @@ class LdapGroupLink < ActiveRecord::Base
def access_field
group_access
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
......@@ -3,6 +3,15 @@
%fieldset
%legend
%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
= f.label :cn, class: 'control-label' do
LDAP Group cn
......
%li
= 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
= 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')
class AddProviderToLdapGroupLinks < ActiveRecord::Migration
def change
add_column :ldap_group_links, :provider, :string
end
end
......@@ -11,7 +11,7 @@
#
# 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
enable_extension "plpgsql"
......@@ -155,6 +155,7 @@ ActiveRecord::Schema.define(version: 20140914173417) do
t.integer "group_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "provider"
end
create_table "members", force: true do |t|
......
......@@ -44,6 +44,10 @@ module Gitlab
options['uid']
end
def label
options['label']
end
def sync_ssh_keys?
sync_ssh_keys.present?
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