class RBT::Users
Public Class Methods
new( shall_we_report = false )
click to toggle source
#¶ ↑
initialize¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/users.rb, line 19 def initialize( shall_we_report = false ) reset unless is_on_windows? # skip this if we are on windows Etc.passwd { |user| # user id, group id @passwd_info[user.name] = [ user.uid, user.gid ] @superuser_name = user.name if user.uid == 0 } end report if shall_we_report end
Public Instance Methods
fetch_user(name)
click to toggle source
passwd_info?()
click to toggle source
#¶ ↑
passwd_info
?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/users.rb, line 43 def passwd_info? @passwd_info end
Also aliased as: passwd_info
reset()
click to toggle source
Private Instance Methods
report()
click to toggle source
#¶ ↑
report¶ ↑
We will report with some useful information to the user.
#¶ ↑
# File lib/rbt/utility_scripts/users.rb, line 70 def report cliner { opn; e 'Available Users ('+ simp(@passwd_info.keys.size.to_s)+' in total):' } sort_by_uid = @passwd_info.sort_by {|key, value| uid = value[0] uid } e; sort_by_uid.each { |entry| user_name = entry.first uid = entry[1][0].to_s gid = entry[1][1].to_s e ' User: '+Colours.bold_yellow(user_name.ljust(10))+ sfancy(' UID: '+uid.to_s.rjust(4)+' GID: '+gid.to_s.rjust(4)) }; e end