Add windows user SID as 'UID' in user resource. Fix #960

This commit is contained in:
Kartik Null Cating-Subramanian 2016-08-25 14:51:53 -04:00 committed by Christoph Hartmann
parent 8de1b9fe7b
commit 89976219b9

View file

@ -448,18 +448,18 @@ module Inspec::Resources
return nil return nil
end end
user = params['User']['Caption'] unless params['User'].nil? user_hash = params['User'] || {}
groups = params['Groups'] group_hashes = params['Groups'] || []
# if groups is no array, generate one # if groups is no array, generate one
groups = [groups] if !groups.is_a?(Array) group_hashes = [group_hashes] unless group_hashes.is_a?(Array)
groups = groups.map { |grp| grp['Caption'] } unless params['Groups'].nil? group_names = group_hashes.map { |grp| grp['Caption'] }
{ {
uid: nil, uid: user_hash['SID'],
user: user, user: user_hash['Caption'],
gid: nil, gid: nil,
group: nil, group: nil,
groups: groups, groups: group_names,
} }
end end