0
1
Fork 0

refs #3971 User supplant fixes

This commit is contained in:
Juan Ferrer 2022-12-02 09:15:43 +01:00
parent 1fa9b1e8b0
commit 5934ee3832
5 changed files with 37 additions and 41 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (22.48.3) stable; urgency=low
hedera-web (22.48.4) stable; urgency=low
* Initial Release.

View File

@ -463,29 +463,43 @@ module.exports = new Class({
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Supplant
/**
* Supplants another user.
*
* @param {String} supplantUser The user name
*/
,async supplantUser(supplantUser) {
const json = await this._conn.send('client/supplant', {supplantUser});
this._conn.token = json;
sessionStorage.setItem('supplantUser', supplantUser);
const resultSet = await this._conn.execQuery(
'SELECT nickname FROM account.myUser');
const userName = resultSet.fetchValue();
Vn.Node.setText(this.$.supplanted, userName);
this.$.supplant.classList.toggle('show', true);
await this.loadMenu();
}
/*
* Ends the user supplanting and restores the original login.
*/
,async onSupplantExitClick() {
this._conn.post('Accounts/logout');
this._conn.fetchToken();
sessionStorage.removeItem('supplantUser');
this.$.supplant.classList.toggle('show', false);
await this.loadMenu();
this._onFormChange();
}
,async supplantInit() {
var user = sessionStorage.getItem('supplantUser');
if (user == null) return;
await this._conn.supplantUser(user);
sessionStorage.setItem('supplantUser', user);
await this.loadMenu();
const res = await this._conn.execQuery(
'SELECT nickname FROM account.myUser');
const userName = res.fetchValue();
Vn.Node.setText(this.$.supplanted, userName);
this.$.supplant.classList.toggle('show', true);
}
,async onSupplantExitClick() {
this.$.supplant.classList.toggle('show', false);
await this._conn.supplantEnd();
sessionStorage.removeItem('supplantUser');
await this.loadMenu();
this._onFormChange();
await this.supplantUser(user);
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Destroy

View File

@ -96,24 +96,6 @@ module.exports = new Class({
this.clearToken();
},
/**
* Supplants another user.
*
* @param {String} supplantUser The user name
*/
async supplantUser(supplantUser) {
const json = await this.send('client/supplant', {supplantUser});
this.token = json;
},
/**
* Ends the user supplanting and restores the last login.
*/
async supplantEnd() {
await this.post('Accounts/logout');
this.fetchToken();
},
/**
* Executes the specified REST service with the given params and calls
* the callback when response is received.

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "hedera-web",
"version": "22.46.19",
"version": "22.48.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "hedera-web",
"version": "22.46.19",
"version": "22.48.4",
"license": "GPL-3.0",
"dependencies": {
"js-yaml": "^3.12.1",

View File

@ -1,6 +1,6 @@
{
"name": "hedera-web",
"version": "22.48.3",
"version": "22.48.4",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"repository": {