How can I get the user's group in the project?

I’m using GitLab CE, and devided all the users by “groups”, to manage their permission about the project, then try to use git hook check the user’s group, but I dont know how can i get the user’s group by gitlab api, except to scan all the “groups” i set.