Playwright Tests / test (push) Canceled after 0s
Splits fn=admin into two independent modules: the original status dashboard stays at fn=admin, user management moves to a new fn=usr (IntranetController.AdminUsers.cs, fis.usr.js). Both are now reached through a single "Administration" sidemenu dropdown (Systemüberwachung / Benutzerverwaltung) gated by one shared fds_sys > 4 check, per ADR 0015 (supersedes 0014's "fold into one module" choice). Also fixes the password-reset validation to check only a plain 6-char minimum instead of silently also requiring ValidatePassword's default 2-uppercase/2-lowercase/2-digit composition, which contradicted the "mind. 6 Zeichen" message shown to the admin. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
124 lines
5.6 KiB
JavaScript
124 lines
5.6 KiB
JavaScript
let $usr = {
|
|
init2: function () {
|
|
// No external libraries needed — go straight to render.
|
|
$ocms.getScript([], function () { $usr.init3(); });
|
|
},
|
|
init3: function () {
|
|
$fis.cf(true);
|
|
$fis.lf(true);
|
|
$('#activemodule').text($uct.mdl);
|
|
$usr.eM();
|
|
$usr.renderLst();
|
|
},
|
|
/* Default ribbon (nothing selected). */
|
|
eM: function (r) {
|
|
let m = [];
|
|
if (bool(r, false) === true) { m.push({ lbl: $uct.rel, fnc: $usr.renderLst }); }
|
|
return $('#topbar').ocmsmenu(m);
|
|
},
|
|
/* Per-row ribbon shown while a user row is selected (mirrors the Banking module's iMn/eM swap). */
|
|
iMn: function (rw) {
|
|
return $('#topbar').ocmsmenu([
|
|
{ lbl: $uct.pwdreset, fnc: function () { $usr.pwdResetDlg(rw); } },
|
|
{ lbl: $uct.email, fnc: function () { $usr.emailDlg(rw); } },
|
|
{ lbl: $uct.groups, fnc: function () { $usr.groupsDlg(rw); } }
|
|
]);
|
|
},
|
|
renderLst: function () {
|
|
let usrlst = $fis.frm_list(true, true).ldng(1), usrfrm = $$.dc('usrfrm', usrlst);
|
|
$usr.eM(true);
|
|
$ocms.postXT({
|
|
url: $ocms.url('usr/list'), success: function (r) {
|
|
usrfrm.empty();
|
|
let ts = $$.tblset({}, usrfrm);
|
|
let thr = $$.tr(ts.hd);
|
|
$.each([$uct.col_name, $uct.col_email, $uct.col_status], function (i, lbl) {
|
|
$$.th(thr).text(lbl);
|
|
});
|
|
$.each(r.users || [], function (ri, rw) {
|
|
let tr = $$.tr(ts.bdy, { id: 'usr' + rw.useraccount_id });
|
|
$$.td(tr).text(`${rw.firstname || ''} ${rw.name || ''}`.trim());
|
|
$$.td(tr).text(rw.email || '');
|
|
$$.td(tr).text(bool(rw.disabled, false) === true ? $uct.disabled : $uct.active);
|
|
tr.click(function () {
|
|
tr.toggleClass('selected').siblings().rC('selected');
|
|
if (tr.is('.selected') === true) { $usr.iMn(rw); } else { $usr.eM(true); }
|
|
});
|
|
});
|
|
}, error: function () {
|
|
usrfrm.empty();
|
|
$$.dc('usr_err', usrfrm).text($uct.loadfail);
|
|
}, complete: function () { usrlst.ldng(0); }
|
|
});
|
|
},
|
|
pwdResetDlg: function (rw) {
|
|
$ocms.dlgform([
|
|
{ name: 'useraccount_id', type: 'hidden', value: rw.useraccount_id },
|
|
{ name: 'newpassword', label: $uct.pwd_field, type: 'string', note: $uct.pwd_hint }
|
|
], {
|
|
title: $uct.pwdreset,
|
|
button: $uct.pwdreset_btn,
|
|
submit: function (e) {
|
|
let c = $(this).ldng(1);
|
|
let qs = c.serializeObject(true, { typedvalues: true });
|
|
$ocms.postXT({
|
|
url: $ocms.url('usr/pwdreset'), data: qs, success: function (response) {
|
|
alert(response.emailed === true ? $uct.pwdreset_sent : $uct.pwdreset_noemail);
|
|
c.trigger('modal_close');
|
|
}, error: function (jqXHR) {
|
|
let code = ((jqXHR || {}).responseJSON || {}).error;
|
|
alert($uct.err[code] || $uct.err_generic);
|
|
}, complete: function () { c.ldng(0); $usr.renderLst(); }
|
|
});
|
|
}
|
|
});
|
|
},
|
|
emailDlg: function (rw) {
|
|
$ocms.dlgform([
|
|
{ name: 'useraccount_id', type: 'hidden', value: rw.useraccount_id },
|
|
{ name: 'email', label: $uct.email_field, type: 'email', required: true, value: rw.email }
|
|
], {
|
|
title: $uct.email,
|
|
submit: function (e) {
|
|
let c = $(this).ldng(1);
|
|
let qs = c.serializeObject(true, { typedvalues: true });
|
|
$ocms.postXT({
|
|
url: $ocms.url('usr/email'), data: qs, success: function () {
|
|
c.trigger('modal_close');
|
|
}, error: function (jqXHR) {
|
|
let code = ((jqXHR || {}).responseJSON || {}).error;
|
|
alert($uct.err[code] || $uct.err_generic);
|
|
}, complete: function () { c.ldng(0); $usr.renderLst(); }
|
|
});
|
|
}
|
|
});
|
|
},
|
|
groupsDlg: function (rw) {
|
|
let f = $$.dc('usr_groups_dlg');
|
|
$ocms.postXT({
|
|
url: $ocms.url('usr/groups'), data: { useraccount_id: rw.useraccount_id }, success: function (r) {
|
|
$.each(r.groups || [], function (gi, g) {
|
|
let row = $$.dc('usr_group_row', f);
|
|
let cid = 'usrg' + g.usergroup_id;
|
|
let cb = $$.i({ type: 'checkbox', id: cid }).prop('checked', bool(g.member, false)).appendTo(row);
|
|
$$.lbl(g.name, { for: cid }).appendTo(row);
|
|
cb.change(function () {
|
|
let checked = cb.prop('checked');
|
|
$ocms.postXT({
|
|
url: $ocms.url('usr/groupset'),
|
|
data: { useraccount_id: rw.useraccount_id, usergroup_id: g.usergroup_id, member: checked },
|
|
error: function () {
|
|
cb.prop('checked', !checked);
|
|
alert($uct.err_generic);
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
});
|
|
$ocms.dlg(f, { title: string($uct.groups_title, [`${rw.firstname || ''} ${rw.name || ''}`.trim()]), size: [420, 380] });
|
|
}
|
|
};
|
|
let $$usr = { init2: $usr.init2, auth: {} };
|
|
export default $$usr;
|