Class: User

Inherits:
Object
  • Object
show all
Defined in:
lib/teuton/case_manager/case/builtin/user.rb

Instance Method Summary collapse

Constructor Details

#initialize(teuton_host, param) ⇒ User

Returns a new instance of User.



3
4
5
6
7
8
# File 'lib/teuton/case_manager/case/builtin/user.rb', line 3

def initialize(teuton_host, param)
  @teuton_host = teuton_host
  @parent = teuton_host.parent
  @host = teuton_host.host
  @param = param
end

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


10
11
12
13
14
# File 'lib/teuton/case_manager/case/builtin/user.rb', line 10

def exists?
  @parent.target("User #{@param} exists?")
  @parent.run "id #{@param}", on: @host
  @parent.expect_one [ 'uid=', @param ]
end

#is_member_of?(groupname) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
# File 'lib/teuton/case_manager/case/builtin/user.rb', line 16

def is_member_of?(groupname)
  @parent.target("User #{@param} is member of #{groupname}?")
  @parent.run "id #{@param}", on: @host
  @parent.expect_one [@param, groupname]
end