2017-12-19 17:43:59 +00:00
|
|
|
require('ui/modules').get('app/wazuh', []).service('appState', function ($cookies, $window) {
|
2017-10-30 09:14:36 +00:00
|
|
|
return {
|
|
|
|
getExtensions: () => {
|
2018-01-17 17:55:59 +00:00
|
|
|
const data = {
|
2017-10-30 09:14:36 +00:00
|
|
|
extensions: $cookies.getObject('extensions')
|
|
|
|
};
|
2018-01-17 17:55:59 +00:00
|
|
|
|
|
|
|
if(typeof data.extensions === 'undefined'){
|
|
|
|
return {
|
|
|
|
extensions : {
|
2018-01-23 11:52:02 +00:00
|
|
|
audit : true,
|
|
|
|
pci : true,
|
|
|
|
oscap : true,
|
|
|
|
aws : true,
|
|
|
|
virustotal: true
|
2018-01-17 17:55:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return data;
|
2017-10-30 09:14:36 +00:00
|
|
|
},
|
2017-11-13 11:49:22 +00:00
|
|
|
setExtensions: extensions => {
|
2017-12-19 17:43:59 +00:00
|
|
|
var exp = new Date();
|
|
|
|
exp.setDate(exp.getDate() + 365);
|
2017-10-30 09:14:36 +00:00
|
|
|
if (extensions) {
|
2017-12-19 17:43:59 +00:00
|
|
|
$cookies.putObject('extensions', extensions, { 'expires': exp });
|
2017-10-30 09:14:36 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
getClusterInfo: () => {
|
|
|
|
return $cookies.getObject('_clusterInfo');
|
|
|
|
},
|
2017-11-13 11:49:22 +00:00
|
|
|
setClusterInfo: cluster_info => {
|
2017-12-19 17:43:59 +00:00
|
|
|
var exp = new Date();
|
|
|
|
exp.setDate(exp.getDate() + 365);
|
2017-10-30 09:14:36 +00:00
|
|
|
if (cluster_info) {
|
2017-12-19 17:43:59 +00:00
|
|
|
$cookies.putObject('_clusterInfo', cluster_info, { 'expires': exp });
|
2017-10-30 09:14:36 +00:00
|
|
|
}
|
2017-12-03 14:30:47 +00:00
|
|
|
},
|
|
|
|
getCurrentPattern: () => {
|
|
|
|
return $cookies.getObject('_currentPattern');
|
|
|
|
},
|
|
|
|
setCurrentPattern: newPattern => {
|
2017-12-19 17:43:59 +00:00
|
|
|
var exp = new Date();
|
|
|
|
exp.setDate(exp.getDate() + 365);
|
2017-12-03 14:30:47 +00:00
|
|
|
if (newPattern) {
|
2017-12-19 17:43:59 +00:00
|
|
|
$cookies.putObject('_currentPattern', newPattern, { 'expires': exp });
|
2017-12-03 14:30:47 +00:00
|
|
|
}
|
2017-12-12 16:59:19 +00:00
|
|
|
},
|
|
|
|
getCurrentAPI: () => {
|
|
|
|
return $cookies.getObject('API');
|
|
|
|
},
|
|
|
|
removeCurrentAPI: () => {
|
|
|
|
return $cookies.remove('API');
|
|
|
|
},
|
|
|
|
setCurrentAPI: API => {
|
2017-12-19 17:43:59 +00:00
|
|
|
var exp = new Date();
|
|
|
|
exp.setDate(exp.getDate() + 365);
|
2017-12-12 16:59:19 +00:00
|
|
|
if (API) {
|
2017-12-19 17:43:59 +00:00
|
|
|
$cookies.putObject('API', API, { 'expires': exp});
|
2017-12-12 16:59:19 +00:00
|
|
|
}
|
2017-10-30 09:14:36 +00:00
|
|
|
}
|
|
|
|
};
|
2017-12-12 16:59:19 +00:00
|
|
|
});
|