We have a little securty issue (that was dumped on my lap)

I need to me able to search a user group/role and see if a person's name appears in that group. We have a function that picks the user's name from their login, and I will pass the group name. Has anybody done something like this before and willing to share the code?