Class: OsCtld::DB::Users
- Inherits:
-
PooledList
- Object
- List
- PooledList
- OsCtld::DB::Users
- Defined in:
- lib/osctld/db/users.rb
Instance Attribute Summary
Attributes inherited from List
Instance Method Summary collapse
- #add(user) ⇒ Object
- #by_ugid(ugid) ⇒ Object
-
#initialize(*_) ⇒ Users
constructor
A new instance of Users.
- #remove(user) ⇒ Object
Methods inherited from PooledList
#contains?, #each_by_ids, #find, #select_by_ids
Methods inherited from List
#contains?, #count, #each, #find, #get, instance, #sync
Constructor Details
#initialize(*_) ⇒ Users
Returns a new instance of Users.
14 15 16 17 |
# File 'lib/osctld/db/users.rb', line 14 def initialize(*_) super @ugid_index = OsCtl::Lib::Index.new(&:ugid) end |
Instance Method Details
#add(user) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/osctld/db/users.rb', line 19 def add(user) sync do OsCtld::UGidRegistry << user.ugid super @ugid_index << user end end |
#by_ugid(ugid) ⇒ Object
39 40 41 |
# File 'lib/osctld/db/users.rb', line 39 def by_ugid(ugid) sync { @ugid_index[ugid] } end |
#remove(user) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/osctld/db/users.rb', line 27 def remove(user) sync do unless OsCtld::SystemUsers.include?(user.sysusername) OsCtld::UGidRegistry.remove(user.ugid) end super @ugid_index.delete(user) user end end |