Module: Wright::Util::User Private
- Defined in:
- lib/wright/util/user.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Various user utility functions.
Class Method Summary collapse
-
.group_to_gid(group) ⇒ Integer
private
Returns a group’s gid.
-
.next_free_gid(gid_range) ⇒ Integer
private
Returns the next free gid in a range.
-
.next_free_uid(uid_range) ⇒ Integer
private
Returns the next free uid in a range.
-
.safe_getgrnam(groupname) ⇒ Struct::Group?
private
Returns a group entry.
-
.safe_getpwnam(username) ⇒ Struct::Passwd?
private
Returns a user entry.
-
.user_to_uid(user) ⇒ Integer
private
Returns a user’s uid.
Class Method Details
.group_to_gid(group) ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a group’s gid.
37 38 39 |
# File 'lib/wright/util/user.rb', line 37 def self.group_to_gid(group) to_id(group, :group) end |
.next_free_gid(gid_range) ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the next free gid in a range.
73 74 75 |
# File 'lib/wright/util/user.rb', line 73 def self.next_free_gid(gid_range) next_free_id(gid_range, :gid) end |
.next_free_uid(uid_range) ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the next free uid in a range.
59 60 61 |
# File 'lib/wright/util/user.rb', line 59 def self.next_free_uid(uid_range) next_free_id(uid_range, :uid) end |
.safe_getgrnam(groupname) ⇒ Struct::Group?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a group entry.
122 123 124 125 126 |
# File 'lib/wright/util/user.rb', line 122 def self.safe_getgrnam(groupname) Etc.getgrnam(groupname) rescue ArgumentError nil end |
.safe_getpwnam(username) ⇒ Struct::Passwd?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a user entry.
106 107 108 109 110 |
# File 'lib/wright/util/user.rb', line 106 def self.safe_getpwnam(username) Etc.getpwnam(username) rescue ArgumentError nil end |
.user_to_uid(user) ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a user’s uid.
20 21 22 |
# File 'lib/wright/util/user.rb', line 20 def self.user_to_uid(user) to_id(user, :user) end |