Skip to content

Commit

Permalink
Update FilteredAsset's site_id
Browse files Browse the repository at this point in the history
-Add site_ids attribute, array of 1 or more site IDs
-Change site_id to get first ID from site_ids

Note that consoles which do not have Asset Linking enabled can use
site_id without any issues. However, consoles with Asset Linking enabled
should use site_ids instead.
  • Loading branch information
gschneider-r7 committed Jul 7, 2015
1 parent 5db6228 commit f12226b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/nexpose/filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,11 @@ class FilteredAsset
attr_reader :vuln_count
attr_reader :risk_score

# The first Site ID returned for this asset.
# Not recommended if Asset Linking feature is enabled.
attr_reader :site_id
# Array of Site IDs for the asset. Use when Asset Linking is enabled.
attr_reader :site_ids
attr_reader :last_scan

def initialize(json)
Expand All @@ -387,7 +391,11 @@ def initialize(json)
@malware_count = json['malwareCount'].to_i
@vuln_count = json['vulnCount'].to_i
@risk_score = json['riskScore'].to_f
@site_id = json['siteID']
@site_ids = []
json['sitePermissions'].each do |site_perm|
@site_ids << site_perm['siteID']
end
@site_id = @site_ids.first
@last_scan = Time.at(json['lastScanDate'].to_i / 1000)
end
end
Expand Down

0 comments on commit f12226b

Please sign in to comment.