Class: Wright::Resource::User

Inherits:
Wright::Resource show all
Defined in:
lib/wright/resource/user.rb

Overview

User resource, represents a user.

Examples:

johndoe = Wright::Resource::User.new('johndoe')
johndoe.home = '/home/johndoe'
johndoe.create

Instance Attribute Summary collapse

Attributes inherited from Wright::Resource

#action, #ignore_failure, #name, #resource_name

Instance Method Summary collapse

Methods inherited from Wright::Resource

#on_update=, #run_action

Constructor Details

#initialize(name) ⇒ User

Initializes a user.



40
41
42
43
44
# File 'lib/wright/resource/user.rb', line 40

def initialize(name)
  super
  @action = :create
  @system = false
end

Instance Attribute Details

#full_nameString



17
18
19
# File 'lib/wright/resource/user.rb', line 17

def full_name
  @full_name
end

#groupsArray<String>



20
21
22
# File 'lib/wright/resource/user.rb', line 20

def groups
  @groups
end

#homeString Also known as: homedir



26
27
28
# File 'lib/wright/resource/user.rb', line 26

def home
  @home
end

#primary_groupString, Integer Also known as: login_group



30
31
32
# File 'lib/wright/resource/user.rb', line 30

def primary_group
  @primary_group
end

#shellString



23
24
25
# File 'lib/wright/resource/user.rb', line 23

def shell
  @shell
end

#systemBool



35
36
37
# File 'lib/wright/resource/user.rb', line 35

def system
  @system
end

#uidInteger



14
15
16
# File 'lib/wright/resource/user.rb', line 14

def uid
  @uid
end

Instance Method Details

#createBool

Creates or updates the user.



50
51
52
53
54
# File 'lib/wright/resource/user.rb', line 50

def create
  might_update_resource do
    @provider.create
  end
end

#removeBool

Removes the user.



60
61
62
63
64
# File 'lib/wright/resource/user.rb', line 60

def remove
  might_update_resource do
    @provider.remove
  end
end