mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
RBAC: No need to filter permissions on cache hit (#87941)
This commit is contained in:
parent
431fdd4bab
commit
e7d5622969
@ -578,17 +578,10 @@ func (s *Service) searchUserPermissionsFromCache(orgID int64, searchOptions acce
|
||||
return nil, false
|
||||
}
|
||||
|
||||
s.log.Debug("Using cached permissions", "key", key)
|
||||
metrics.MAccessSearchUserPermissionsCacheUsage.WithLabelValues(accesscontrol.CacheHit).Inc()
|
||||
|
||||
s.log.Debug("Using cached permissions", "key", key)
|
||||
filteredPermissions := make([]accesscontrol.Permission, 0)
|
||||
for _, permission := range permissions.([]accesscontrol.Permission) {
|
||||
if PermissionMatchesSearchOptions(permission, &searchOptions) {
|
||||
filteredPermissions = append(filteredPermissions, permission)
|
||||
}
|
||||
}
|
||||
|
||||
return filteredPermissions, true
|
||||
return permissions.([]accesscontrol.Permission), true
|
||||
}
|
||||
|
||||
func PermissionMatchesSearchOptions(permission accesscontrol.Permission, searchOptions *accesscontrol.SearchOptions) bool {
|
||||
|
Loading…
Reference in New Issue
Block a user