Comparison

core/sessionmanager.lua @ 12648:f299e570a0fe

mod_authz_internal: Use util.roles, some API changes and config support This commit was too awkward to split (hg record didn't like it), so: - Switch to the new util.roles lib to provide a consistent representation of a role object. - Change API method from get_role_info() to get_role_by_name() (touches sessionmanager and usermanager) - Change get_roles() to get_user_roles(), take a username instead of a JID This is more consistent with all other usermanager API methods. - Support configuration of custom roles and permissions via the config file (to be documented).
author Matthew Wild <mwild1@gmail.com>
date Tue, 19 Jul 2022 18:02:02 +0100
parent 12642:9061f9621330
child 12662:07424992d7fc
comparison
equal deleted inserted replaced
12647:a661292d074a 12648:f299e570a0fe
131 session.type = "c2s_unbound"; 131 session.type = "c2s_unbound";
132 end 132 end
133 133
134 local role; 134 local role;
135 if role_name then 135 if role_name then
136 role = hosts[session.host].authz.get_role_info(role_name); 136 role = hosts[session.host].authz.get_role_by_name(role_name);
137 else 137 else
138 role = hosts[session.host].authz.get_user_default_role(username); 138 role = hosts[session.host].authz.get_user_default_role(username);
139 end 139 end
140 if role then 140 if role then
141 sessionlib.set_role(session, role); 141 sessionlib.set_role(session, role);