Apache Solr open-source search software
SOLR-16621: Admin UI fails to grant user permissions that have wildcard role (#1294)
Jan Høydahl6ba00a484bc2
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex d7b96214ea8..3cc189e8815 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -169,6 +169,8 @@ Bug Fixes* SOLR-16613: CryptoKeys should handle RSA padding for OpenJ9 (Kevin Risden)+* SOLR-16621: Admin UI fails to grant user permissions that have wildcard role (janhoy)+Build---------------------* Upgrade forbiddenapis to 3.4 (Uwe Schindler)diff --git a/solr/webapp/web/js/angular/controllers/security.js b/solr/webapp/web/js/angular/controllers/security.jsindex d1b09916a77..64275d5f755 100644--- a/solr/webapp/web/js/angular/controllers/security.js+++ b/solr/webapp/web/js/angular/controllers/security.js@@ -52,8 +52,16 @@ solrAdminApp.controller('SecurityController', function ($scope, $timeout, $cookireturn roles.sort((a, b) => (a.name > b.name) ? 1 : -1);}+ /**+ * Check if user's roles are compatible with permission's roles+ * @param roles list of roles for a permission, where at least one is required+ * @param rolesForUser list of roles for user+ * @return true if user has one of the required roles, or permission has a wildcard role+ */function roleMatch(roles, rolesForUser) {- for (r in rolesForUser) {+ if (roles.includes("*"))+ return true+ for (let r in rolesForUser) {if (roles.includes(rolesForUser[r]))return true;}