Method: Cfruby::Users::OSXUserManager#users
- Defined in:
- lib/libcfruby/osmodules/osx.rb
#users ⇒ Object
returns a list of all the users on the system
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/libcfruby/osmodules/osx.rb', line 205 def users() users = UserList.new() # get the list of users using niutil textlist = `niutil -list . /users` textlist.each() { |line| line.strip!() user = UserInfo.new() user.username = line[/^[0-9]+\s+(\S+)$/, 1] userlist = `niutil -read . /users/#{user.username}` userlist.each() { |subline| subline.strip!() case(subline) when(/^home:/) user.homedir = subline[/:\s*(.*)$/, 1] when(/^uid:/) user.uid = subline[/:\s*(.*)$/, 1].to_i() when(/^gid:/) user.gid = subline[/:\s*(.*)$/, 1].to_i() when(/^realname:/) user.fullname = subline[/:\s*(.*)$/, 1] end } users[user.username] = user } return(users) end |