As a security officer, I want staff accesses to cases logged even if those accesses occur while impersonating the doctor or patient.

These 2 lines can be replace with a single line using to_param. to_param returns the is on a model or nil if the model is nil. Called on a string it returns self, and called on an int, it returns to_s. So this would work with the advantage of being much clearer:
```
user_id = (@current_user || current_user).to_param
```