Visibility of the Web part is managed automatically. If the currently active user is a member of at least one role that is selected in the "View roles" checkbox list in the Web parts properties tab, the part is visible to him, otherwise it is not displayed.
You can programatically check the role membership:
isInRole = SecurityUtility.IsUserInRole(yourRoleName);
As for the profile page, you would probably want to check if the currently active user is the owner of the profile. The standard technique is to pass the username in the URL. You can than retrieve the user name, find it's ID and compare that to the user ID or name of the currently active user:
//retrieve the user name URL parameter
userName = UrlParams.UserProfile.UserName.Value;
//get the user name of the currently active user
userName = Page.User.Identity.Name;
//get the ID of the currently active user. Other overloads enable you to get the user ID by passing the user name to this method.
Guid userId = SecurityUtility.GetUserId();
There are various different strategies to achieve what you want. Let me know if this helps,