]> git.proxmox.com Git - proxmox-widget-toolkit.git/blobdiff - src/window/AuthEditLDAP.js
window: ldap auth edit: set view-model form data explicitly on edit
[proxmox-widget-toolkit.git] / src / window / AuthEditLDAP.js
index e62b514f07abfebd089a5c30eff0bbe077858214..cae7c80f547eae7749295c73674782c587d22ba0 100644 (file)
@@ -29,6 +29,8 @@ Ext.define('Proxmox.panel.LDAPInputPanel', {
 
     type: 'ldap',
 
+    onlineHelp: 'user-realms-ldap',
+
     onGetValues: function(values) {
        if (this.isCreate) {
            values.type = this.type;
@@ -55,7 +57,9 @@ Ext.define('Proxmox.panel.LDAPInputPanel', {
     },
 
     onSetValues: function(values) {
+       let me = this;
        values.anonymous_search = values["bind-dn"] ? 0 : 1;
+       me.getViewModel().set('anonymous_search', values.anonymous_search);
 
        return values;
     },
@@ -90,7 +94,9 @@ Ext.define('Proxmox.panel.LDAPInputPanel', {
            xtype: 'proxmoxcheckbox',
            fieldLabel: gettext('Anonymous Search'),
            name: 'anonymous_search',
-           bind: '{anonymous_search}',
+           bind: {
+               value: '{anonymous_search}',
+           },
        },
        {
            xtype: 'proxmoxtextfield',
@@ -198,7 +204,7 @@ Ext.define('Proxmox.panel.LDAPSyncInputPanel', {
     xtype: 'pmxAuthLDAPSyncPanel',
     mixins: ['Proxmox.Mixin.CBind'],
 
-    editableAttributes: ['email'],
+    editableAttributes: ['firstname', 'lastname', 'email'],
     editableDefaults: ['scope', 'enable-new'],
     default_opts: {},
     sync_attributes: {},
@@ -241,6 +247,11 @@ Ext.define('Proxmox.panel.LDAPSyncInputPanel', {
        Proxmox.Utils.delete_if_default(values, 'sync-defaults-options');
        Proxmox.Utils.delete_if_default(values, 'sync-attributes');
 
+       // Force values.delete to be an array
+       if (typeof values.delete === 'string') {
+          values.delete = values.delete.split(',');
+       }
+
        if (me.isCreate) {
            delete values.delete; // on create we cannot delete values
        }
@@ -280,6 +291,16 @@ Ext.define('Proxmox.panel.LDAPSyncInputPanel', {
     },
 
     column1: [
+       {
+           xtype: 'proxmoxtextfield',
+           name: 'firstname',
+           fieldLabel: gettext('First Name attribute'),
+       },
+       {
+           xtype: 'proxmoxtextfield',
+           name: 'lastname',
+           fieldLabel: gettext('Last Name attribute'),
+       },
        {
            xtype: 'proxmoxtextfield',
            name: 'email',