Class: Inspec::Resources::UserInfo
- Inherits:
 - 
      Object
      
        
- Object
 - Inspec::Resources::UserInfo
 
 
- Includes:
 - Converter
 
- Defined in:
 - lib/resources/users.rb
 
Overview
This is an abstract class that every user provoider has to implement. A user provider implements a system abstracts and helps the InSpec resource hand-over system specific behavior to those providers
Direct Known Subclasses
Instance Attribute Summary collapse
- 
  
    
      #inspec  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute inspec.
 
Instance Method Summary collapse
- 
  
    
      #collect_user_details  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
returns the full information list for a user.
 - 
  
    
      #credentials(_username)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
returns a hash with meta-data about user credentials { mindays: 1, maxdays: 1, warndays: 1, } this method is optional and may not be implemented by each provider.
 - 
  
    
      #identity(_username)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
returns a hash with user-specific values: { uid: ”, user: ”, gid: ”, group: ”, groups: ”, }.
 - 
  
    
      #initialize(inspec)  ⇒ UserInfo 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of UserInfo.
 - 
  
    
      #list_users  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
returns an array with users.
 - 
  
    
      #meta_info(_username)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
returns optional information about a user, eg shell.
 - 
  
    
      #user_details(username)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
retuns all aspects of the user as one hash.
 
Methods included from Converter
Constructor Details
#initialize(inspec) ⇒ UserInfo
Returns a new instance of UserInfo.
      282 283 284  | 
    
      # File 'lib/resources/users.rb', line 282 def initialize(inspec) @inspec = inspec end  | 
  
Instance Attribute Details
#inspec ⇒ Object (readonly)
Returns the value of attribute inspec.
      281 282 283  | 
    
      # File 'lib/resources/users.rb', line 281 def inspec @inspec end  | 
  
Instance Method Details
#collect_user_details ⇒ Object
returns the full information list for a user
      332 333 334 335 336  | 
    
      # File 'lib/resources/users.rb', line 332 def collect_user_details list_users.map { |username| user_details(username.chomp) } end  | 
  
#credentials(_username) ⇒ Object
returns a hash with meta-data about user credentials
mindays: 1,
maxdays: 1,
warndays: 1,
this method is optional and may not be implemented by each provider
      310 311 312  | 
    
      # File 'lib/resources/users.rb', line 310 def credentials(_username) nil end  | 
  
#identity(_username) ⇒ Object
returns a hash with user-specific values:
uid: '',
user: '',
gid: '',
group: '',
groups: '',
  
      294 295 296  | 
    
      # File 'lib/resources/users.rb', line 294 def identity(_username) raise 'user provider must implement the `identity` method' end  | 
  
#list_users ⇒ Object
returns an array with users
      315 316 317  | 
    
      # File 'lib/resources/users.rb', line 315 def list_users raise 'user provider must implement the `list_users` method' end  | 
  
#meta_info(_username) ⇒ Object
returns optional information about a user, eg shell
      299 300 301  | 
    
      # File 'lib/resources/users.rb', line 299 def (_username) nil end  | 
  
#user_details(username) ⇒ Object
retuns all aspects of the user as one hash
      320 321 322 323 324 325 326 327 328 329  | 
    
      # File 'lib/resources/users.rb', line 320 def user_details(username) item = {} id = identity(username) item.merge!(id) unless id.nil? = (username) item.merge!() unless .nil? cred = credentials(username) item.merge!(cred) unless cred.nil? item end  |