Class: Inspec::Resources::DarwinUser
- Defined in:
- lib/resources/user.rb
Overview
we do not use ‘finger’ for MacOS, because it is harder to parse data with it instead we use ‘dscl’ to request user data
Instance Attribute Summary
Attributes inherited from UnixUser
Attributes inherited from UserInfo
Instance Method Summary collapse
Methods inherited from UnixUser
#identity, #initialize, #parse_id_entries, #parse_value
Methods inherited from UserInfo
Methods included from Converter
Constructor Details
This class inherits a constructor from Inspec::Resources::UnixUser
Instance Method Details
#meta_info(username) ⇒ Object
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/resources/user.rb', line 353 def (username) cmd = inspec.command("dscl -q . -read /Users/#{username} NFSHomeDirectory PrimaryGroupID RecordName UniqueID UserShell") return nil if cmd.exit_status != 0 params = SimpleConfig.new( cmd.stdout.chomp, assignment_re: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/, group_re: nil, multiple_values: false, ).params { home: params['NFSHomeDirectory'], shell: params['UserShell'], } end |