Get User By Role

That seems like a poor hack. There is functionality built in for Roles, ie the “you don’t have permission to view this page”. Is there no way to accomplish getting all the site members permissions?