Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-15825: Security UI 'hasPermission' check should check if the user has the all permission if the requested permission is not defined (#437)

Timothy Potterf49734e5f73b
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 35c6534f54d..de6a00c66f3 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -458,6 +458,9 @@ Bug Fixes
* SOLR-15813: Schema designer not handling `update.autoCreateFields` stored as a string (vs. boolean) in the config overlay (Timothy Potter)
+* SOLR-15825: Security UI 'hasPermission' check should check if the user has the "all" permission if the requested permission is not defined
+ to match how the backend works (Timothy Potter)
+
================== 8.11.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
diff --git a/solr/webapp/web/js/angular/controllers/security.js b/solr/webapp/web/js/angular/controllers/security.js
index 54e1d6c74ae..b1bae4d0afc 100644
--- a/solr/webapp/web/js/angular/controllers/security.js
+++ b/solr/webapp/web/js/angular/controllers/security.js
@@ -282,8 +282,12 @@ solrAdminApp.controller('SecurityController', function ($scope, $timeout, $cooki
};
$scope.hasPermission = function(permissionName) {
- var rolesForPermission = $scope.permissionsTable.filter(p => permissionName === p.name).flatMap(p => p.roles);
- return (rolesForPermission.length > 0 && roleMatch(rolesForPermission, $scope.getCurrentUserRoles()));
+ var matched = $scope.permissionsTable.filter(p => permissionName === p.name);
+ if (matched.length === 0 && permissionName !== "all") {
+ // this permission is not explicitly defined, but "all" will apply if it is defined
+ matched = $scope.permissionsTable.filter(p => "all" === p.name);
+ }
+ return matched.length > 0 && roleMatch(matched.flatMap(p => p.roles), $scope.getCurrentUserRoles());
};
$scope.refreshSecurityPanel = function() {