Class: Entitlements::Data::Groups::Calculated::Rules::Username

Inherits:
Base
  • Object
show all
Includes:
Contracts::Core
Defined in:
lib/entitlements/data/groups/calculated/rules/username.rb

Constant Summary collapse

C =
::Contracts

Class Method Summary collapse

Class Method Details

.matches(value:, filename: nil, options: {}) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/entitlements/data/groups/calculated/rules/username.rb', line 25

def self.matches(value:, filename: nil, options: {})
  # Username is easy - the value is the uid.
  begin
    Set.new([Entitlements.cache[:people_obj].read(value)].compact)
  rescue Entitlements::Data::People::NoSuchPersonError
    # We are not currently treating this as a fatal error and as such we are just
    # ignoring it. Implementors will want to implement CI-level checks for unknown
    # people if this is a concern.
    Set.new({})
  end
end