mirror of
https://github.com/bjc/prosody.git
synced 2025-04-03 21:27:38 +03:00
mod_admin_shell: Reject attempt to add or remove roles for unrelated hosts
The three-argument version seems to be a left-over from 0.12
This commit is contained in:
parent
e47e8e7ec7
commit
ad83ddfb78
1 changed files with 4 additions and 0 deletions
|
@ -1785,6 +1785,8 @@ function def_env.user:addrole(jid, host, new_role)
|
|||
return nil, "No such host: "..host;
|
||||
elseif prosody.hosts[userhost] and not um.user_exists(username, userhost) then
|
||||
return nil, "No such user";
|
||||
elseif userhost ~= host then
|
||||
return nil, "Can't add roles outside users own host"
|
||||
end
|
||||
return um.add_user_secondary_role(username, host, new_role);
|
||||
end
|
||||
|
@ -1797,6 +1799,8 @@ function def_env.user:delrole(jid, host, role_name)
|
|||
return nil, "No such host: "..host;
|
||||
elseif prosody.hosts[userhost] and not um.user_exists(username, userhost) then
|
||||
return nil, "No such user";
|
||||
elseif userhost ~= host then
|
||||
return nil, "Can't remove roles outside users own host"
|
||||
end
|
||||
return um.remove_user_secondary_role(username, host, role_name);
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue