Is it possible to assign users to a group upon registration?

I have a similar request. Here is the use-case:

  1. I assign a group G to a category C so that the category is only visible by G members.
  2. I assign g.c@example.org to C with anonymous email-in enabled.
  3. I send an email to g.c@example.org, with a number of emails in Cc so that they become staged.
  4. When the user wants to confirm their account, I want them assigned to G, OR
    4bis. I want to assign them to G before they activate their account.

Any clue? (using API, SQL, or some eventual admin feature)