When Rick told Carol to leave, he no longer was an authority figure at the prison. He had relinquished leadership to the Council. He was not even a member of the Council at that time.
If anyone had the right to tell Carol to leave, it should have been the Council, not Rick.
Just about everybody makes Rick look weak at this point.