ui: user edit: clean-up getValues function

values.username just does not exist, and we do not need to delete the
username part anyway, as that field is used to assemble the full
userid by concatenating the name@realm parts.

While at it move this over to let-assignments and do not call setting
expiry explicitly a hack, it's fine and warranted code, because if one
wants to use a datefield's empty value as 0 one needs to do so
explicitly, nothing hacky there..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2024-03-07 10:37:35 +01:00
parent 5dc306fc98
commit d9848071a0

View File

@ -180,29 +180,23 @@ Ext.define('PBS.window.UserEdit', {
},
getValues: function(dirtyOnly) {
var me = this;
let me = this;
var values = me.callParent(arguments);
let values = me.callParent(arguments);
// hack: ExtJS datefield does not submit 0, so we need to set that
if (!values.expire) {
values.expire = 0;
values.expire = 0; // "no expiry" is encoded as 0, so set that explicitly if left empty
}
if (me.isCreate) {
values.userid = values.userid + '@' + values.realm;
delete values.realm;
}
delete values.username;
if (!values.password) {
delete values.password;
}
if (values.realm) {
delete values.realm;
}
return values;
},