Maybe it's a silly question, I have searched for a similar question and the most similar that I have found is this Refusing a user permission to click a URL but they are talking about showing partial information. My requirement is a little bit different.
Normally, when you are not logged in, you are redirected to the login page. In my site I have two roles. Each role has its own dashboard. For example user X is logged in and has role Y, if user X enters a url to a section of role P (a section where he does not have permissions) what is the best way to handle this? I have three options:
- Redirect to his (user X's) dashboard immediately without saying nothing.
- Show a message saying he does not have permission to view the section. Include a link to his dashboard in the message.
- Show the login form saying "Please log in as role P".
IMPORTANT: Users cannot register as role Y being role P and vice versa, so, I cannot invite user X to register to become other role.