...
- A minor is a normal user that has a link in the table
minor_accounts
(keydecidim_minor_id
). This table links two users, a tutor and a minor. - Similarly, a tutor is a normal user that has a link to the table
minor_accounts
(keydecidim_tutor_id
).
- A confirmed and verified (using the system's configured workflow) user account (that is not itself a minor, called a tutor from now on) can create a new minor account from the profile menu page.
- The tutor introduces the minor's personal data (name, email, birth date), this data remains encrypted in the table
minor_accounts
in a JSONB field (minor_data
). - After saving the data, a new user is created in the table
decidim_users
but blocked. No personal data will be stored in this user yet, except for the email. Attributes for the model will be:blocked: true, blocked_at: Time.current, name: "Pending minor user"
. No emails are sent at this point (no confirmation or invitation emails). - Tutor can now click on the "verify minor" and is redirected to the authorization controller in order to verify the minor's data. This verification handler might ask for more personal data to authorize this user.
- Depending on the configuration of the module (see
Decidim::Kids.minor_authorization_age_attributes
), check that the age returned by the verification is in the configured range. If not, remove the verification. - If the verification goes through, the
Authorization
gets stored, and the user is unblocked and personal data is transferred from the tableminor_accounts->minor_data
to the user created (the minor). - An email is sent to the new user (aka: confirm the email), once is confirmed it can log in (maybe automatically). A notification to the tutor will be sent when the minor confirms the email.
A minor account can be promoted to a normal user account by just removing the relationships existing in the decidim_kids_minor_accounts
and decidim_kids_minor_data
.
See the README file for instructions on how to set up an automated script to do that automatically.