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
end
user = params['User']['Caption'] unless params['User'].nil?
groups = params['Groups']
user_hash = params['User'] || {}
group_hashes = params['Groups'] || []
# if groups is no array, generate one
groups = [groups] if !groups.is_a?(Array)
groups = groups.map { |grp| grp['Caption'] } unless params['Groups'].nil?
group_hashes = [group_hashes] unless group_hashes.is_a?(Array)
group_names = group_hashes.map { |grp| grp['Caption'] }
{
uid: nil,
user: user,
uid: user_hash['SID'],
user: user_hash['Caption'],
gid: nil,
group: nil,
groups: groups,
groups: group_names,
}
end