--- /dev/null
+Ext.define('PMG.LDAPGroupInputPanel', {
+ extend: 'Proxmox.panel.InputPanel',
+ alias: 'widget.pmgLDAPGroupInputPanel',
+
+ onGetValues: function(values) {
+ if (values.mode === 'profile-any') {
+ values.mode = 'any';
+ } else if (values.mode === 'profile-none') {
+ values.mode = 'none';
+ }
+
+ return values;
+ },
+
+ setValues: function(values) {
+ var me = this;
+
+ if (values.profile !== undefined) {
+ if (values.mode === 'any') {
+ values.mode = 'profile-any';
+ } else if (values.mode === 'none') {
+ values.mode = 'profile-none';
+ }
+ }
+
+ if (values.profile !== undefined) {
+ var groupField = this.lookupReference('groupField');
+ groupField.setProfile(values.profile);
+ }
+
+ me.callParent([values]);
+ },
+
+ controller: {
+
+ xclass: 'Ext.app.ViewController',
+
+ changeMode: function(f, value) {
+ var groupField = this.lookupReference('groupField');
+ groupField.setDisabled(value !== 'group');
+ groupField.setVisible(value === 'group');
+ var profileField = this.lookupReference('profileField');
+ var enabled = ((value != 'any') && (value != 'none'));
+ profileField.setDisabled(!enabled);
+ profileField.setVisible(enabled);
+ },
+
+ changeProfile: function(f, value) {
+ var groupField = this.lookupReference('groupField');
+ groupField.setProfile(value);
+ },
+
+ control: {
+ 'field[name=mode]': {
+ change: 'changeMode'
+ },
+ 'field[name=profile]': {
+ change: 'changeProfile'
+ }
+ },
+ },
+
+ items: [
+ {
+ xtype: 'proxmoxKVComboBox',
+ name: 'mode',
+ comboItems: [
+ [ 'group', gettext('Group member') ],
+ [ 'profile-any', gettext('Existing LDAP address')],
+ [ 'any', gettext('Existing LDAP address') +
+ ' (' + PMG.Utils.anyProfileText + ')'],
+ [ 'profile-none', gettext('Unknown LDAP address')],
+ [ 'none', gettext('Unknown LDAP address') +
+ ' (' + PMG.Utils.anyProfileText + ')'],
+ ],
+ fieldLabel: gettext("Match")
+ },
+ {
+ xtype: 'pmgLDAPProfileSelector',
+ name: 'profile',
+ reference: 'profileField',
+ fieldLabel: gettext("Profile")
+ },
+ {
+ xtype: 'pmgLDAPGroupSelector',
+ name: 'group',
+ reference: 'groupField',
+ fieldLabel: gettext("Group")
+ }
+ ]
+});
+
+Ext.define('PMG.LDAPGroupEditor', {
+ extend: 'Proxmox.window.Edit',
+ alias: 'widget.pmgLDAPGroupEditor',
+
+ width: 500,
+
+ items: { xtype: 'pmgLDAPGroupInputPanel' }
+});
--- /dev/null
+Ext.define('PMG.LDAPGroupSelector', {
+ extend: 'Ext.form.ComboBox',
+ alias: 'widget.pmgLDAPGroupSelector',
+
+ profile: undefined,
+
+ queryMode: 'local',
+
+ store: {
+ fields: [ 'dn' ],
+ filterOnLoad: true,
+ sorters: [
+ {
+ property : 'dn',
+ direction: 'ASC'
+ }
+ ]
+ },
+
+ valueField: 'dn',
+ displayField: 'dn',
+
+ allowBlank: false,
+
+ setProfile: function(profile, force) {
+ var me = this;
+
+ if (!force && (profile === undefined || (me.profile === profile))) {
+ return;
+ }
+
+ me.profile = profile;
+
+ me.setValue('');
+
+ me.store.setProxy({
+ type: 'proxmox',
+ url: '/api2/json/config/ldap/' + me.profile + '/groups'
+ });
+
+ me.store.load();
+ },
+
+ initComponent: function() {
+ var me = this;
+
+ me.callParent();
+
+ if (me.profile !== undefined) {
+ me.setProfile(profile, true);
+ }
+ }
+});
+
--- /dev/null
+Ext.define('PMG.LDAPProfileSelector', {
+ extend: 'Proxmox.form.ComboGrid',
+ alias: 'widget.pmgLDAPProfileSelector',
+
+ store: {
+ fields: [ 'profile', 'disable', 'comment' ],
+ proxy: {
+ type: 'proxmox',
+ url: '/api2/json/config/ldap',
+ },
+ filterOnLoad: true,
+ sorters: [
+ {
+ property : 'profile',
+ direction: 'ASC'
+ }
+ ]
+ },
+
+ valueField: 'profile',
+ displayField: 'profile',
+
+ allowBlank: false,
+
+ listConfig: {
+ columns: [
+ {
+ header: gettext('Profile'),
+ dataIndex: 'profile',
+ hideable: false,
+ width: 100
+ },
+ {
+ header: gettext('Enabled'),
+ width: 80,
+ sortable: true,
+ dataIndex: 'disable',
+ renderer: Proxmox.Utils.format_neg_boolean
+ },
+ {
+ header: gettext('Comment'),
+ sortable: false,
+ renderer: Ext.String.htmlEncode,
+ dataIndex: 'comment',
+ flex: 1
+ }
+ ]
+ },
+
+ initComponent: function() {
+ var me = this;
+
+ me.callParent();
+
+ me.store.load();
+ }
+});
LoginWindow.js \
ServerStatus.js \
ServerAdministration.js \
+ LDAPProfileSelector.js \
+ LDAPGroupSelector.js \
+ LDAPGroupEditor.js \
ObjectGroupList.js \
ObjectGroup.js \
ObjectGroupSelector.js \
config.subject = full_subject(editor.subject, rec.data.receivertest);
config.url = me.baseurl + '/' + editor.subdir + '/' + rec.data.id;
- var win = Ext.createWidget('proxmoxWindowEdit', config);
+ var win = Ext.createWidget(config);
win.load();
win.on('destroy', reload);
return;
}
config.url = me.baseurl + '/' + editor.subdir;
- var win = Ext.createWidget('proxmoxWindowEdit', config);
+ var win = Ext.create(config);
win.on('destroy', reload);
win.show();
}
alias: 'widget.pmgWhoConfiguration',
ogclass: 'who',
- otype_list: [1000, 1001, 1002, 1003, 1004]
+ otype_list: [1000, 1001, 1002, 1003, 1004, 1005]
});
Ext.define('PMG.WhenConfiguration', {
],
onGetValues: function(values) {
- console.log("on get values");
-
- console.dir(values);
-
if (!values.languages) {
values['delete'] = 'languages';
} else if (Ext.isArray(values.languages)) {
values.languages = values.languages.join(' ')
}
- console.dir(values);
-
return values;
},
senderText: gettext('Sender'),
receiverText: gettext('Receiver'),
+ anyProfileText: gettext('Any Profile'),
oclass_text: {
who: gettext('Who Objects'),
object_editors: {
1000: {
+ xtype: 'proxmoxWindowEdit',
subdir: 'regex',
subject: gettext("Regular Expression"),
width: 400,
}
]
},
+ 1005: {
+ xtype: 'pmgLDAPGroupEditor',
+ subdir: 'ldap',
+ subject: gettext("LDAP Group")
+ },
1009: {
+ xtype: 'proxmoxWindowEdit',
subdir: 'receiver_regex',
subject: gettext("Regular Expression"),
receivertest: true,
]
},
1001: {
+ xtype: 'proxmoxWindowEdit',
subdir: 'email',
subject: gettext("Email"),
width: 400,
]
},
1007: {
+ xtype: 'proxmoxWindowEdit',
subdir: 'receiver',
subject: gettext("Email"),
receivertest: true,
]
},
1002: {
+ xtype: 'proxmoxWindowEdit',
subdir: 'domain',
subject: gettext("Domain"),
width: 400,
]
},
1008: {
+ xtype: 'proxmoxWindowEdit',
subdir: 'receiver_domain',
subject: gettext("Domain"),
receivertest: true,
]
},
1003: {
+ xtype: 'proxmoxWindowEdit',
subdir: 'ip',
subject: gettext("IP Address"),
width: 400,
]
},
1004: {
+ xtype: 'proxmoxWindowEdit',
subdir: 'network',
subject: gettext("IP Network"),
width: 400,
]
},
2000: {
+ xtype: 'proxmoxWindowEdit',
subdir: 'timeframe',
subject: gettext("TimeFrame"),
items: [
]
},
4005: {
+ xtype: 'proxmoxWindowEdit',
subdir: 'bcc',
subject: gettext('BCC'),
width: 400,