Some question before doing this
1- do you want to set the group your self or the hack set it by looking at there permission
2- what happen if the hack is to set the group by searching. If you give two group the same permission do these two group merge into one group
3- if you want to set it your self, the only way I can think of is to set each user in there profile. How many group do you want to have