NHS organisations facing court action over unlawful policies