fleet/ee/vulnerability-dashboard/api/controllers/get-patch-progress-for-a-single-team.js
Eric b1945b2128
Add fleet-vulnerability-dashboard repo to ee/ folder (#17428)
Closes: https://github.com/fleetdm/confidential/issues/4057

Changes:
- Added the contents of the fleet-vulnerability-dashboard repo to
ee/vulnerability-dashboard
- Added a github workflow to deploy the vulnerability dashboard on
Heroku
- Added a github workflow to test changes to the vulnerability-dashboard
- Updated the website's custom configuration to enable
auto-approvals/review requests to files in the
ee/vulnerability-dashboard folder
2024-03-13 13:06:11 -05:00

62 lines
2.2 KiB
JavaScript

module.exports = {
friendlyName: 'Get patch progress for a single team',
description: 'Returns patch progress for operating systems and critical software filtered to only be results for a team.',
inputs: {
teamApid: {
description: 'The ID of the Team to filter by, or 0 to only include hosts with no team, or undefined to not filter by any team.',
type: 'number',
},
},
exits: {
success: {
outputType: {},
description: 'Patch progress has been successfully filtered to a team'
}
},
fn: async function ({teamApid}) {
let osComplianceInfo = await sails.helpers.getComplianceInformation.with({teamApid, complianceType: 'operatingSystem' });
let chromeComplianceInfo = await sails.helpers.getComplianceInformation.with({teamApid, complianceType: 'chrome' });
let safariComplianceInfo = await sails.helpers.getComplianceInformation.with({teamApid, complianceType: 'safari' });
let firefoxComplianceInfo = await sails.helpers.getComplianceInformation.with({teamApid, complianceType: 'firefox' });
let microsoftOfficeComplianceInfo = await sails.helpers.getComplianceInformation.with({teamApid, complianceType: 'microsoftOffice' });
let flashComplianceInfo = await sails.helpers.getComplianceInformation.with({teamApid, complianceType: 'flash' });
let patchProgressForThisTeam = {
operatingSystem: osComplianceInfo.patchProgress,
chrome: chromeComplianceInfo.patchProgress,
safari: safariComplianceInfo.patchProgress,
firefox: firefoxComplianceInfo.patchProgress,
microsoftOffice: microsoftOfficeComplianceInfo.patchProgress,
flash: flashComplianceInfo.patchProgress,
};
let complaintVersionsInUse = {
operatingSystem: osComplianceInfo.compliantVersionsInUse,
chrome: chromeComplianceInfo.compliantVersionsInUse,
safari: safariComplianceInfo.compliantVersionsInUse,
firefox: firefoxComplianceInfo.compliantVersionsInUse,
microsoftOffice: microsoftOfficeComplianceInfo.compliantVersionsInUse,
flash: flashComplianceInfo.compliantVersionsInUse,
};
// All done.
return {
patchProgressForThisTeam,
complaintVersionsInUse,
};
}
};