diff --git a/plugins/scm-auth-ldap-plugin/src/main/java/sonia/scm/auth/ldap/LDAPConfig.java b/plugins/scm-auth-ldap-plugin/src/main/java/sonia/scm/auth/ldap/LDAPConfig.java index f533dd0690..f8ad66d5c6 100644 --- a/plugins/scm-auth-ldap-plugin/src/main/java/sonia/scm/auth/ldap/LDAPConfig.java +++ b/plugins/scm-auth-ldap-plugin/src/main/java/sonia/scm/auth/ldap/LDAPConfig.java @@ -107,6 +107,17 @@ public class LDAPConfig return attributeNameId; } + /** + * Method description + * + * + * @return + */ + public String getAttributeNameMail() + { + return attributeNameMail; + } + /** * Method description * @@ -292,6 +303,10 @@ public class LDAPConfig @XmlElement(name = "attribute-name-id") private String attributeNameId = "uid"; + /** Field description */ + @XmlElement(name = "attribute-name-mail") + private String attributeNameMail = "mail"; + /** Field description */ @XmlElement(name = "base-dn") private String baseDn = "dc=scm-manager,dc=org"; diff --git a/plugins/scm-auth-ldap-plugin/src/main/resources/sonia/scm/auth/ldap/sonia.ldap.js b/plugins/scm-auth-ldap-plugin/src/main/resources/sonia/scm/auth/ldap/sonia.ldap.js index 5169965553..1c78176334 100644 --- a/plugins/scm-auth-ldap-plugin/src/main/resources/sonia/scm/auth/ldap/sonia.ldap.js +++ b/plugins/scm-auth-ldap-plugin/src/main/resources/sonia/scm/auth/ldap/sonia.ldap.js @@ -30,39 +30,62 @@ */ -function sayHello(){ - Ext.Ajax.request({ - url: restUrl + 'hello', - method: 'GET', - disableCaching: true, - success: function(response){ - var msg = response.responseText; - Ext.MessageBox.show({ - title: 'Hello Message', - msg: msg, - buttons: Ext.MessageBox.OK, - icon: Ext.MessageBox.INFO - }); - }, - failure: function(){ - Ext.MessageBox.show({ - title: 'Error', - msg: 'Could not display the hello message', - buttons: Ext.MessageBox.OK, - icon: Ext.MessageBox.ERROR - }); - } - }); -} -loginCallbacks.push(function(){ - var navPanel = Ext.getCmp('navigationPanel'); - var count = navPanel.count() - 1; - navPanel.insertSection(count, { - title: 'Hello World', - items: [{ - label: 'Say Hello', - fn: sayHello - }] - }); -}); \ No newline at end of file +registerGeneralConfigPanel({ + xtype : 'configForm', + title : 'PAM Authentication', + items : [{ + xtype : 'textfield', + fieldLabel : 'Service name', + name : 'service-name', + allowBlank : false + },{ + xtype : 'textfield', + fieldLabel : 'Admin Groups', + name : 'admin-groups', + allowBlank : true + },{ + xtype : 'textfield', + fieldLabel : 'Admin Users', + name : 'admin-users', + allowBlank : true + }], + + onSubmit: function(values){ + this.el.mask('Submit ...'); + Ext.Ajax.request({ + url: restUrl + 'config/auth/ldap.json', + method: 'POST', + jsonData: values, + scope: this, + disableCaching: true, + success: function(response){ + this.el.unmask(); + }, + failure: function(){ + this.el.unmask(); + } + }); + }, + + onLoad: function(el){ + var tid = setTimeout( function(){ el.mask('Loading ...'); }, 100); + Ext.Ajax.request({ + url: restUrl + 'config/auth/ldap.json', + method: 'GET', + scope: this, + disableCaching: true, + success: function(response){ + var obj = Ext.decode(response.responseText); + this.load(obj); + clearTimeout(tid); + el.unmask(); + }, + failure: function(){ + el.unmask(); + clearTimeout(tid); + alert('failure'); + } + }); + } +});