This function is a getter not a setter. I don't think we need to test instance of, as we are only testing : if no identity then return default role (usually guest).