apsislabs / phi_attrs

HIPAA compliant PHI access logging for Ruby on Rails.
MIT License
27 stars 3 forks source link

Feature/default user #37

Closed Crisfole closed 5 years ago

Crisfole commented 5 years ago

Merge after #34

This piggy backs on the I18n work to add a default current user. It makes the library almost seamless:

instance.allow_phi!

or

instance.allow_phi!(nil, "Becuase I felt like it")

wkirby commented 5 years ago

@Crisfole What is the nil being passed as the first argument?

Crisfole commented 5 years ago

@Crisfole What is the nil being passed as the first argument?

If you have a reason, but no user. Changing to keyword args would be a breaking change. We'd want to create a breaking branch.

wkirby commented 5 years ago

@Crisfole What is the nil being passed as the first argument?

If you have a reason, but no user. Changing to keyword args would be a breaking change. We'd want to create a breaking branch.

To avoid a breaking change, we could do argument inflection. Basically:

def func(user, reason)
  if user.is_a? Hash
    actual_user = user[:user]
    actual_reason = user[:reason]
  else
    actual_user = user
    actual_reason = reason
  end

  [...]
end
Crisfole commented 5 years ago

Can you issue that PR? I'm not totally clear how that will interact with the keyword arguments that already exist.