Primary groups should come first, not last, when ordering groups for inheritance (#500)

This commit is contained in:
Luck 2017-10-15 11:22:38 +01:00
parent 597f2f7b1b
commit 28961b1cfa
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 4 additions and 9 deletions

View File

@ -84,19 +84,13 @@ public class MetaAccumulator {
if (n.isPrefix()) { if (n.isPrefix()) {
Map.Entry<Integer, String> value = n.getPrefix(); Map.Entry<Integer, String> value = n.getPrefix();
if (!prefixes.containsKey(value.getKey())) { prefixes.putIfAbsent(value.getKey(), value.getValue());
prefixes.put(value.getKey(), value.getValue());
}
prefixStack.accumulateToAll(n); prefixStack.accumulateToAll(n);
} }
if (n.isSuffix()) { if (n.isSuffix()) {
Map.Entry<Integer, String> value = n.getSuffix(); Map.Entry<Integer, String> value = n.getSuffix();
if (!suffixes.containsKey(value.getKey())) { suffixes.putIfAbsent(value.getKey(), value.getValue());
suffixes.put(value.getKey(), value.getValue());
}
suffixStack.accumulateToAll(n); suffixStack.accumulateToAll(n);
} }
} }

View File

@ -65,7 +65,8 @@ public class GroupInheritanceComparator implements Comparator<Group> {
// one of them is a primary group, and therefore has priority // one of them is a primary group, and therefore has priority
if (o1Primary != o2Primary) { if (o1Primary != o2Primary) {
return o1Primary ? 1 : -1; // we want the primary group to come first
return o1Primary ? -1 : 1;
} }
} }