The mysql code in the helper should only be called if you are using a mysql connection. The logged in as user rule in php mysql would be defined based on the authentication server behavior being applied with the title "user".
You can create custom rules with DataBridge to make more complex rules to cover any circumstances you need.