Class: BGSPolicy

Inherits:
Struct
  • Object
show all
Defined in:
app/policies/bgs_policy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bgsObject

Returns the value of attribute bgs

Returns:

  • (Object)

    the current value of bgs



3
4
5
# File 'app/policies/bgs_policy.rb', line 3

def bgs
  @bgs
end

#userObject

Returns the value of attribute user

Returns:

  • (Object)

    the current value of user



3
4
5
# File 'app/policies/bgs_policy.rb', line 3

def user
  @user
end

Instance Method Details

#access?(log_stats: true) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
# File 'app/policies/bgs_policy.rb', line 4

def access?(log_stats: true)
  accessible = user.icn.present? && user.ssn.present? && user.participant_id.present?
  increment_statsd(accessible) if user.loa3? && log_stats
  accessible
end

#increment_statsd(accessible) ⇒ Object



10
11
12
13
14
15
16
# File 'app/policies/bgs_policy.rb', line 10

def increment_statsd(accessible)
  if accessible
    StatsD.increment('api.bgs.policy.success')
  else
    StatsD.increment('api.bgs.policy.failure')
  end
end