Conditionally define groups controller