mirror of
https://github.com/fleetdm/fleet
synced 2026-05-03 21:38:24 +00:00
Changes: - Moved documentation pages into the docs/ folder - Updated routes, poicies, and importer.less - Renamed the "scripts" page to "script-library" to be consistent with the other landing pages for YAML documentation - removed a stray console.log() in the new-licence page script
55 lines
1.5 KiB
JavaScript
Vendored
55 lines
1.5 KiB
JavaScript
Vendored
module.exports = {
|
|
|
|
|
|
friendlyName: 'View policy library',
|
|
|
|
|
|
description: 'Display "Policy library" page.',
|
|
|
|
|
|
exits: {
|
|
|
|
success: {
|
|
viewTemplatePath: 'pages/docs/policy-library'
|
|
},
|
|
badConfig: { responseType: 'badConfig' },
|
|
|
|
},
|
|
|
|
|
|
fn: async function () {
|
|
|
|
if (!_.isObject(sails.config.builtStaticContent) || !_.isArray(sails.config.builtStaticContent.policies)) {
|
|
throw {badConfig: 'builtStaticContent.policies'};
|
|
}
|
|
let policies = _.where(sails.config.builtStaticContent.policies, {kind: 'policy'});
|
|
let macOsPolicies = _.filter(policies, (policy)=>{
|
|
let platformsForThisPolicy = policy.platform.split(', ');
|
|
return _.includes(platformsForThisPolicy, 'darwin');
|
|
});
|
|
let windowsPolicies = _.filter(policies, (policy)=>{
|
|
let platformsForThisPolicy = policy.platform.split(', ');
|
|
return _.includes(platformsForThisPolicy, 'windows');
|
|
});
|
|
let linuxPolicies = _.filter(policies, (policy)=>{
|
|
let platformsForThisPolicy = policy.platform.split(', ');
|
|
return _.includes(platformsForThisPolicy, 'linux');
|
|
});
|
|
let chromePolicies = _.filter(policies, (policy)=>{
|
|
let platformsForThisPolicy = policy.platform.split(', ');
|
|
return _.includes(platformsForThisPolicy, 'chrome');
|
|
});
|
|
// Respond with view.
|
|
return {
|
|
macOsPolicies,
|
|
windowsPolicies,
|
|
linuxPolicies,
|
|
chromePolicies,
|
|
algoliaPublicKey: sails.config.custom.algoliaPublicKey,
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|