Fix: 'query disabled' error
All groups run smoothly with the default value of the 'Query Limit' global capability, but once one group is granted the 'Query Limit' explicitly, other groups users would be deprived the default value and run into 'query disabled' error when they try to open any changes dashboard UI. This issue can be fixed by granting default value(+0..500) of 'Query Limit' to Anonymous Users, but this is inconvenient, and in most cases Admin do not know the root reason of 'query disabled' error. Fixed by always keeping the default capability valid. Change-Id: Ia4c7120df85d519fd5fc7f00a29ab405f959ff5a
This commit is contained in:
		@@ -230,9 +230,18 @@ public class CapabilityControl {
 | 
			
		||||
      List<PermissionRule> ruleList) {
 | 
			
		||||
    int min = 0;
 | 
			
		||||
    int max = 0;
 | 
			
		||||
    for (PermissionRule rule : ruleList) {
 | 
			
		||||
      min = Math.min(min, rule.getMin());
 | 
			
		||||
      max = Math.max(max, rule.getMax());
 | 
			
		||||
    if (ruleList.isEmpty()) {
 | 
			
		||||
      PermissionRange.WithDefaults defaultRange =
 | 
			
		||||
          GlobalCapability.getRange(permissionName);
 | 
			
		||||
      if (defaultRange != null) {
 | 
			
		||||
        min = defaultRange.getDefaultMin();
 | 
			
		||||
        max = defaultRange.getDefaultMax();
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      for (PermissionRule rule : ruleList) {
 | 
			
		||||
        min = Math.min(min, rule.getMin());
 | 
			
		||||
        max = Math.max(max, rule.getMax());
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return new PermissionRange(permissionName, min, max);
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user