18F/identity-idp

View on GitHub
app/policies/two_factor_authentication/phone_policy.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

module TwoFactorAuthentication
  class PhonePolicy
    def initialize(user)
      @mfa_user = MfaContext.new(user)
    end

    def configured?
      mfa_user.phone_configurations.any?
    end

    def enabled?
      mfa_user.phone_configurations.any?(&:mfa_enabled?)
    end

    def visible?
      true
    end

    private

    attr_reader :mfa_user
  end
end