Sha256: 4e3ba9ea26155a6de540456ba49eb80bc2a2940b80ec702c31f3729af9ff5e59

Contents?: true

Size: 673 Bytes

Versions: 4

Compression:

Stored size: 673 Bytes

Contents

require 'etc'

module Dockdev
  module UserInfo
    include TR::CondUtils

    def self.user_info(login = nil)
      login = Etc.getlogin if is_empty?(login)
      res = { login: login }
      begin
        res[:uid] = Etc.getpwnam(login).uid
      rescue Exception => ex
        res[:uid] = nil
      end
      res
    end

    def self.group_info(login = nil)
      login = Etc.getlogin if is_empty?(login)
      res = {  }
      begin
        gnm = Etc.getgrnam(login)
        res[:group_name] = gnm.name
        res[:gid] = gnm.gid
      rescue Exception => ex
        p ex
        res[:group_name] = ""
        res[:gid] = nil
      end
      res
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dockdev-0.4.2 lib/dockdev/user_info.rb
dockdev-0.4.1 lib/dockdev/user_info.rb
dockdev-0.3.8 lib/dockdev/user_info.rb
dockdev-0.3.7 lib/dockdev/user_info.rb