You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ja...@apache.org on 2023/01/20 08:39:43 UTC
[solr] branch branch_9x updated: SOLR-16621: Admin UI fails to grant user permissions that have wildcard role (#1294)
This is an automated email from the ASF dual-hosted git repository.
janhoy pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new add816a6e64 SOLR-16621: Admin UI fails to grant user permissions that have wildcard role (#1294)
add816a6e64 is described below
commit add816a6e64050743ba445a236151756e3614c49
Author: Jan Høydahl <ja...@users.noreply.github.com>
AuthorDate: Fri Jan 20 09:38:53 2023 +0100
SOLR-16621: Admin UI fails to grant user permissions that have wildcard role (#1294)
---
solr/CHANGES.txt | 2 ++
solr/webapp/web/js/angular/controllers/security.js | 10 +++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 100b5b22123..4d1d3904e35 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -143,6 +143,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.js
index 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, $cooki
return 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;
}