In one requirement I need to hide some sites (from the top right menu ) depending on the role of the user . 

Right now if the user X doesn't have the access to site ABC but he can still sees the site in the top right My Site menu. When he clicks on it he goes there and sees message saying you are not authorized. Instead of this I want to hide those site which the user doesn't have access to.

Is there any way to do so?