class RBT::Users
Public Class Methods
new( shall_we_report = false )
click to toggle source
#¶ ↑
initialize¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/users.rb, line 20 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 47 def passwd_info? @passwd_info end
Also aliased as: passwd_info
reset()
click to toggle source
#¶ ↑
reset¶ ↑
#¶ ↑
Calls superclass method
RBT::LeanPrototype#reset
# File lib/rbt/utility_scripts/users.rb, line 36 def reset super() # ======================================================================= # # === @passwd_info # ======================================================================= # @passwd_info = {} end
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 74 def report cliner { opn; e "#{rev}Available Users ("\ "#{simp(@passwd_info.keys.size.to_s)} #{rev}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 rev+' User: '+Colours.yellow(user_name.ljust(10))+ sfancy( ' UID: '+uid.to_s.rjust(4)+' GID: '+gid.to_s.rjust(4) ) }; e end