How to set up different function allowance based on authentication type

I have an app I am making with Realm for practice. In it, I have a default user authentication of anonymous, but the user has the option to log in/ register with email and password. I want the user to be able to use my read products function no matter what, but they should only be able to add a product if they logged in with email and password. I can’t find any information on how to achieve this if anyone can help that would be greatly appreciated.