Merge "Show no error on ACL change if sections have empty permissions"

This commit is contained in:
Edwin Kempin
2015-11-13 16:38:29 +00:00
committed by Gerrit Code Review

View File

@@ -231,19 +231,20 @@ public class ProjectAccessScreen extends ProjectScreen {
private Set<String> getDiffs(ProjectAccess wantedAccess, private Set<String> getDiffs(ProjectAccess wantedAccess,
ProjectAccess newAccess) { ProjectAccess newAccess) {
final List<AccessSection> wantedSections = List<AccessSection> wantedSections =
mergeSections(removeEmptyPermissionsAndSections(wantedAccess.getLocal())); mergeSections(removeEmptyPermissionsAndSections(wantedAccess.getLocal()));
final HashSet<AccessSection> same = new HashSet<>(wantedSections); List<AccessSection> newSections =
final HashSet<AccessSection> different = removeEmptyPermissionsAndSections(newAccess.getLocal());
new HashSet<>(wantedSections.size() HashSet<AccessSection> same = new HashSet<>(wantedSections);
+ newAccess.getLocal().size()); HashSet<AccessSection> different =
new HashSet<>(wantedSections.size() + newSections.size());
different.addAll(wantedSections); different.addAll(wantedSections);
different.addAll(newAccess.getLocal()); different.addAll(newSections);
same.retainAll(newAccess.getLocal()); same.retainAll(newSections);
different.removeAll(same); different.removeAll(same);
final Set<String> differentNames = new HashSet<>(); Set<String> differentNames = new HashSet<>();
for (final AccessSection s : different) { for (AccessSection s : different) {
differentNames.add(s.getName()); differentNames.add(s.getName());
} }
return differentNames; return differentNames;