Regression: groups API returns unowned groups when ?owned=true

Summary

A change in https://gitlab.com/gitlab-org/gitlab-ce/commit/2adff699?view=inline#note_40742047 caused the groups API to start returning unowned groups when owned groups are requested (?owned=1).

Steps to reproduce

GET /api/v4/groups?owned=true Cookie: ...

What is the current bug behavior?

Returns groups not owned by the current user

What is the expected correct behavior?

Should only return groups owned by the current user

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)