diff --git a/ui/scripts/globalSettings.js b/ui/scripts/globalSettings.js index e65a00b290c..598c9c542c8 100644 --- a/ui/scripts/globalSettings.js +++ b/ui/scripts/globalSettings.js @@ -14,6 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. + (function(cloudStack) { cloudStack.sections['global-settings'] = { title: 'label.menu.global.settings', @@ -81,6 +82,129 @@ } } }, + + ldapConfiguration:{ + type:'select', + title:'LDAP Configuration', + listView:{ + id:'ldap', + label:'LDAP Configuration', + fields:{ + hostname: {label: 'Hostname'}, + queryfilter: {label: 'Query Filter'}, + searchbase: {label: 'Search Base'}, + port: {label: 'LDAP Port'}, + ssl: { + label: 'SSL' + + } + + }, + dataProvider:function(args){ + var data = {}; + listViewDataProvider(args, data); + $.ajax({ + url: createURL('ldapConfig&listall=true'), //Need a list LDAP configuration API call which needs to be implemented + data: data, + success: function(json) { + var items = json.ldapconfigresponse.ldapconfig; + args.response.success({data:items}); + }, + error: function(data) { + args.response.error(parseXMLHttpResponse(data)); + } + }); + }, + + actions: { + add:{ + + label: 'Configure LDAP', + + messages: { + confirm: function(args) { + return 'Do you really want to configure LDAP ? '; + }, + notification: function(args) { + return 'LDAP configured'; + } + }, + + createForm: { + + title: 'Configure LDAP', + fields:{ + name:{label: 'Bind Username' , validation: {required:true} }, + password: {label: 'Bind Password', validation: {required: true },isPassword:true }, + hostname: {label:'Hostname' , validation:{required:true}}, + queryfilter: {label:'Query Filter' , validation: {required:true}}, + searchbase: {label:'SearchBase',validation:{required:true}}, + ssl: { + label:'SSL' , + isBoolean:true, + isChecked:false + + }, + port: { label: 'Port' , defaultValue: '389' }, + truststore:{ label:'Trust Store' , isHidden:true , dependsOn:'ssl',validation:{required:true} }, + truststorepassword:{ label:'Trust Store Password' ,isHidden:true , dependsOn:'ssl', validation:{required:true}} + + } + + + }, + + + action:function(args) { + var array = []; + array.push("&binddn=" + todb(args.data.name)); + array.push("&bindpass=" + todb(args.data.password)); + array.push("&hostname=" + todb(args.data.hostname)); + array.push("&searchbase=" +todb(args.data.searchbase)); + array.push("&queryfilter=" +todb(args.data.queryfilter)); + array.push("&port=" +todb(args.data.port)); + + if(args.$form.find('.form-item[rel=ssl]').find('input[type=checkbox]').is(':Checked')== true) { + + array.push("&ssl=true"); + if(args.data.truststore != "") + array.push("&truststore=" +todb(args.data.truststore)); + + if(args.data.truststorepassword !="") + array.push("&truststorepass=" +todb(args.data.truststorepassword)); + + } + + else + array.push("&ssl=false"); + + $.ajax({ + url: createURL("ldapConfig" + array.join("")), + dataType: "json", + async: true, + success: function(json) { + var items = json.ldapconfigresponse.ldapconfig; + args.response.success({ + data: items + }); + + } + + }); + + + } + } + + } + + + + } + + + + }, hypervisorCapabilities: { type: 'select', title: 'label.hypervisor.capabilities',