Class: User

Inherits:
Object show all
Defined in:
lib/pik/windows_env.rb

Constant Summary collapse

IsUserAnAdmin =
Win32API.new('shell32', 'IsUserAnAdmin', 'v', 'i')

Instance Method Summary collapse

Instance Method Details

#admin?Boolean

determines if the user has admin rights not if the user is a member of the local admins group (allows for nested groups)

Returns:

  • (Boolean)


98
99
100
# File 'lib/pik/windows_env.rb', line 98

def admin?
  true if IsUserAnAdmin.call.nonzero?
end

#domainObject

the logged on user’s domain



91
92
93
# File 'lib/pik/windows_env.rb', line 91

def domain
  ENV['userdomain']
end

#nameObject

the logged on user’s name



86
87
88
# File 'lib/pik/windows_env.rb', line 86

def name
  ENV['username']
end