mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-06 09:55:18 +00:00
Allowing to disable agents actions
This commit is contained in:
parent
919af49658
commit
f9683041b9
@ -12,6 +12,11 @@
|
||||
"wazuh",
|
||||
"ossec"
|
||||
],
|
||||
"agents": {
|
||||
"add": true,
|
||||
"delete": true,
|
||||
"restart": true
|
||||
},
|
||||
"author": "Wazuh, Inc",
|
||||
"license": "GPL-2.0",
|
||||
"repository": {
|
||||
|
@ -43,6 +43,11 @@ app.controller('agentsPreviewController', function ($scope, $mdDialog, DataFacto
|
||||
'name': '', 'ip': ''
|
||||
};
|
||||
$scope.newAgentKey = '';
|
||||
$scope.permissions = {
|
||||
'add': false,
|
||||
'delete':false,
|
||||
'restart': false
|
||||
};
|
||||
|
||||
const notify = new Notifier({location: 'Agents - Preview'});
|
||||
|
||||
@ -264,6 +269,15 @@ app.controller('agentsPreviewController', function ($scope, $mdDialog, DataFacto
|
||||
$mdDialog.hide('#newAgentDialog');
|
||||
};
|
||||
|
||||
var getAgentsPermissions = function () {
|
||||
genericReq.request('GET', '/api/wazuh-api/agents/permissions')
|
||||
.then(function (data, status) {
|
||||
$scope.permissions = data;
|
||||
}, function (data, status) {
|
||||
notify.error("Error while loading agents permissions.");
|
||||
})
|
||||
}
|
||||
getAgentsPermissions();
|
||||
var load = function () {
|
||||
$scope.newAgent = {
|
||||
'name': '', 'ip': ''
|
||||
|
@ -127,15 +127,15 @@
|
||||
<md-divider></md-divider>
|
||||
</div>
|
||||
<div class="agent-buttons">
|
||||
<md-button class="md-fab add-agent-icon" ng-click="showNewAgentDialog($event)" >
|
||||
<md-button ng-if="permissions.add" class="md-fab add-agent-icon" ng-click="showNewAgentDialog($event)" >
|
||||
<md-icon md-font-library="material-icons">add</md-icon>
|
||||
</md-button>
|
||||
|
||||
<md-button class="md-fab restart-agent-icon" ng-click="showRestartConfirm($event)" >
|
||||
<md-button ng-if="permissions.restart" class="md-fab restart-agent-icon" ng-click="showRestartConfirm($event)" >
|
||||
<md-icon md-font-library="material-icons">refresh</md-icon>
|
||||
</md-button>
|
||||
|
||||
<md-button class="md-fab delete-agent-icon" ng-click="showDeletePrompt($event)" >
|
||||
<md-button ng-if="permissions.delete" class="md-fab delete-agent-icon" ng-click="showDeletePrompt($event)" >
|
||||
<md-icon md-font-library="material-icons">delete</md-icon>
|
||||
</md-button>
|
||||
</div>
|
||||
|
@ -12,7 +12,7 @@ module.exports = function (server, options) {
|
||||
var package_info = {};
|
||||
const package_file = '../../package.json';
|
||||
var appVersion = "";
|
||||
|
||||
var permissions = {}
|
||||
// Read Wazuh App package file
|
||||
try {
|
||||
package_info = JSON.parse(fs.readFileSync(path.resolve(__dirname, package_file), 'utf8'));
|
||||
@ -272,7 +272,20 @@ module.exports = function (server, options) {
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
var getAgentsPermissions = function (req, reply) {
|
||||
try {
|
||||
package_info = JSON.parse(fs.readFileSync(path.resolve(__dirname, package_file), 'utf8'));
|
||||
permissions = package_info.agents;
|
||||
reply(permissions);
|
||||
} catch (e) {
|
||||
server.log([blueWazuh, 'initialize', 'error'], 'Could not read the Wazuh package file.');
|
||||
server.log([blueWazuh, 'initialize', 'error'], 'Path: ' + package_file);
|
||||
server.log([blueWazuh, 'initialize', 'error'], 'Exception: ' + e);
|
||||
reply({ 'statusCode': 500, 'error': 8, 'message': 'Could not load agents permissions' }).code(500);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//Handlers - Route request
|
||||
|
||||
@ -530,6 +543,17 @@ module.exports = function (server, options) {
|
||||
path: '/api/wazuh-api/pci/{requirement}',
|
||||
handler: getPciRequirement
|
||||
});
|
||||
|
||||
/*
|
||||
* GET /api/wazuh-api/agents/permissions
|
||||
* Return the permissions on agents
|
||||
*
|
||||
**/
|
||||
server.route({
|
||||
method: 'GET',
|
||||
path: '/api/wazuh-api/agents/permissions',
|
||||
handler: getAgentsPermissions
|
||||
});
|
||||
|
||||
/*
|
||||
* POST /api/wazuh/debug
|
||||
|
Loading…
Reference in New Issue
Block a user