# HG changeset patch # User Kim Alvefur # Date 1680167348 -7200 # Node ID c2616274bef76fed56bf3b2c7ae627f294c5217e # Parent 16b47c3b44f3bf56b0f2872fbc41ed34feaab56f mod_invites: Record roles as ordered list, first becoming primary role For mod_invites_register to apply on user creation. diff -r 16b47c3b44f3 -r c2616274bef7 plugins/mod_invites.lua --- a/plugins/mod_invites.lua Thu Mar 30 11:05:40 2023 +0200 +++ b/plugins/mod_invites.lua Thu Mar 30 11:09:08 2023 +0200 @@ -257,7 +257,7 @@ end local allow_reset; - local roles; + local roles = {}; local groups = {}; while #arg > 0 do @@ -282,7 +282,7 @@ print(" --group GROUPID Add the user to the group with the given ID") print(" Can be specified multiple times") print() - print("--role and --admin override each other; the last one wins") + print("--role and --admin can be specified multiple times; the first role becomes the primary role, the rest become secondary roles") print("--group can be specified multiple times; the user will be added to all groups.") print() print("--reset and the other options cannot be mixed.") @@ -297,14 +297,14 @@ end allow_reset = username; elseif value == "--admin" then - roles = { ["prosody:admin"] = true }; + table.insert(roles, "prosody:admin"); elseif value == "--role" then local rolename = arg[1]; if not rolename then print("Please supply a role name"); return 2; end - roles = { [rolename] = true }; + table.insert(roles, rolename); table.remove(arg, 1); elseif value == "--group" or value == "-g" then local groupid = arg[1];