This is the magic function that checks a users's username and groups against a list of usersnames and groups for the role required to perform a function.