We were checking the uid, whereas we should have checked the gid (cherry picked from commit 98cd752a) (cherry picked from commit 2c8ae283)
mentioned in commit 1944dbbd