-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose scan template level control scanning options #88
Expose scan template level control scanning options #88
Conversation
def control_scanning=(enable) | ||
global_controls_scan = REXML::XPath.first(@xml, 'ScanTemplate/ControlsScan/globalControlsScanEnabled') | ||
if global_controls_scan.attributes['enabled'] == '1' | ||
warn 'Updating the local controls scanning option when the global is enabled has no effect.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this raise an exception? The UI grays out the corresponding check box when the global option is enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to shy away from adding checks like this to duplicate UI logic. What happens if it is enabled and you try to save? Will Nexpose throw or return an error? If it does and that message is clear enough, then this check only saves a small roundtrip and avoids the gem having to repeat UI validation.
On a separate note, I see "control" and "controls" in different places. What's the official term? We should use that where possible (if we aren't). My gut is "controls", but UX/Doc would be the final word.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a separate note, I see "control" and "controls" in different places. What's the official term? We should use that where possible (if we aren't). My gut is "controls", but UX/Doc would be the final word.
The UX is Control Scanning in the Nexpose UI. The XML nodes use Controls Scan which was a previous iteration in the UX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to shy away from adding checks like this to duplicate UI logic. What happens if it is enabled and you try to save? Will Nexpose throw or return an error? If it does and that message is clear enough, then this check only saves a small roundtrip and avoids the gem having to repeat UI validation.
The API will silently ignore it. Do you think the warning should be removed or is appropriate? My initial thought was to add a warning but I could be swayed to remove it since it seems to be harmless (I learned this afterwards).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd just go ahead and remove it. I could see a workflow where an admin goes through an modifies the templates first before flipping the global switch.
As to names, let's make sure we are using the singular "control" then (except in the XML, where there's no choice). Don't need to rework anything not in this commit, but worth auditing at some point.
@mdaines-r7 There you go. 👍 |
Sorry, forgot this was pending. You want a release? |
Expose scan template level control scanning options
@mdaines-r7 That'd be great. |
done. |
ScanTemplate#control_scanning?
ScanTemplate#control_scanning=