within (one's) rights
Being allowed by the law to do something or behave a certain way. I'm sorry, sir, but he's within his rights to put these signs on his lawn, even if you find them offensive. They were well within their rights to deny entry to the man, who they claimed was intoxicated and unruly.
within your ˈrights
having the moral or legal right to do something: They were acting perfectly within their rights when they refused to let you into their house.