Added caching and role filtering to get_user function