luci-base: tie cached system features to user session
Store the cached system feature flags keyed by the current session id, this ensures that the features are refreshed on login. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
119c6319cb
commit
6dba41cadc
1 changed files with 10 additions and 2 deletions
|
@ -823,9 +823,14 @@
|
|||
},
|
||||
|
||||
probeSystemFeatures: function() {
|
||||
var sessionid = classes.rpc.getSessionID();
|
||||
|
||||
if (sysFeatures == null) {
|
||||
try {
|
||||
sysFeatures = JSON.parse(window.sessionStorage.getItem('sysFeatures'));
|
||||
var data = JSON.parse(window.sessionStorage.getItem('sysFeatures'));
|
||||
|
||||
if (this.isObject(data) && this.isObject(data[sessionid]))
|
||||
sysFeatures = data[sessionid];
|
||||
}
|
||||
catch (e) {}
|
||||
}
|
||||
|
@ -837,7 +842,10 @@
|
|||
expect: { '': {} }
|
||||
})().then(function(features) {
|
||||
try {
|
||||
window.sessionStorage.setItem('sysFeatures', JSON.stringify(features));
|
||||
var data = {};
|
||||
data[sessionid] = features;
|
||||
|
||||
window.sessionStorage.setItem('sysFeatures', JSON.stringify(data));
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
|
|
Loading…
Reference in a new issue