comparison mod_invites_register/mod_invites_register.lua @ 4348:46fb40d7f65a

mod_invites_register: Add user to groups included in an invite
author Matthew Wild <mwild1@gmail.com>
date Sun, 17 Jan 2021 17:44:51 +0000
parents ee8e7f5196b4
children 205a027d86f3
comparison
equal deleted inserted replaced
4347:0ec482e617bb 4348:46fb40d7f65a
141 module:log("debug", "Importing roles from invite"); 141 module:log("debug", "Importing roles from invite");
142 local roles = validated_invite.additional_data.roles; 142 local roles = validated_invite.additional_data.roles;
143 if roles then 143 if roles then
144 module:open_store("roles"):set(contact_username, roles); 144 module:open_store("roles"):set(contact_username, roles);
145 end 145 end
146
147 local groups = validated_invite.additional_data.groups;
148 if groups then
149 module:log("Adding to groups...");
150 for _, group in ipairs(groups) do
151 module:open_store("groups", "map"):set(group, contact_username, true);
152 end
153 end
146 end 154 end
147 end); 155 end);
148 156
149 -- Equivalent of user-registered but for when the account already existed 157 -- Equivalent of user-registered but for when the account already existed
150 -- (i.e. password reset) 158 -- (i.e. password reset)