Class: User
Constant Summary collapse
- IsUserAnAdmin =
Win32API.new('shell32', 'IsUserAnAdmin', 'v', 'i')
Instance Method Summary collapse
-
#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).
-
#domain ⇒ Object
the logged on user’s domain.
-
#name ⇒ Object
the logged on user’s name.
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)
98 99 100 |
# File 'lib/pik/windows_env.rb', line 98 def admin? true if IsUserAnAdmin.call.nonzero? end |
#domain ⇒ Object
the logged on user’s domain
91 92 93 |
# File 'lib/pik/windows_env.rb', line 91 def domain ENV['userdomain'] end |
#name ⇒ Object
the logged on user’s name
86 87 88 |
# File 'lib/pik/windows_env.rb', line 86 def name ENV['username'] end |