Module: Appifier::Helpers::User

Defined in:
lib/appifier/helpers/user.rb

Instance Method Summary collapse

Instance Method Details

#current_userString

return the current user name

Returns:

  • (String)

    name



14
15
16
# File 'lib/appifier/helpers/user.rb', line 14

def current_user
  Etc.getpwuid(Process.uid).name
end

#group_rootString

return the ‘root’ group name : root or wheel

Returns:

  • (String)

    name



20
21
22
# File 'lib/appifier/helpers/user.rb', line 20

def group_root
  Etc.getgrgid(0).name
end

#is_root?Bool

facility to verifying if the active process run as root

Returns:

  • (Bool)

    status



26
27
28
29
30
31
32
33
# File 'lib/appifier/helpers/user.rb', line 26

def is_root?
  case Process.uid
  when 0
    true
  else
    false
  end
end

#user_rootString

return the ‘root’ name

Returns:

  • (String)

    name



8
9
10
# File 'lib/appifier/helpers/user.rb', line 8

def user_root
  Etc.getpwuid(0).name
end