Rotation but not position locking contraint

I hope these kind of questions are welcome here as well.
Anyways, I was wondering if there’s a way to constrain two objects together so they can move free but are locked on more than one axis. Like Adv. Ballsocket with Move Freely but that works on more than one axis.