Changing User Group & Permissions directly in the database


Hey guys,

I need some assistance here. As the title suggests I want to change users groups and permissions for chunks of users trough a custom php script rather than using the xenforo backend to do it manually.

I have dug through the database and found xf_user to contain the fields (that i think) I want to change:

Are these the only fields that the xenforo backend changes when I set the user group to "custom" rather than "registered" or are there more tables that are altered?

I would look for the php file that writes the groups/permissions but im still having trouble seeing through the entire xenforo system.