We were checking the uid, whereas we should have checked the gid (cherry picked from commit 98cd752a) (cherry picked from commit 2c8ae283) (cherry picked from commit 017fddd9)