Merge "Display error if modifying access rights for a ref is forbidden"
This commit is contained in:
@@ -118,4 +118,13 @@ public class AccessSection extends RefConfigSection implements
|
||||
public String toString() {
|
||||
return "AccessSection[" + getName() + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (!super.equals(obj) || !(obj instanceof AccessSection)) {
|
||||
return false;
|
||||
}
|
||||
return new HashSet<Permission>(permissions).equals(new HashSet<Permission>(
|
||||
((AccessSection) obj).permissions));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
package com.google.gerrit.common.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -220,4 +221,23 @@ public class Permission implements Comparable<Permission> {
|
||||
int index = NAMES_LC.indexOf(a.getName().toLowerCase());
|
||||
return 0 <= index ? index : NAMES_LC.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (!(obj instanceof Permission)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Permission other = (Permission) obj;
|
||||
if (!name.equals(other.name) || exclusiveGroup != other.exclusiveGroup) {
|
||||
return false;
|
||||
}
|
||||
return new HashSet<PermissionRule>(rules)
|
||||
.equals(new HashSet<PermissionRule>(other.rules));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return name.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,4 +257,19 @@ public class PermissionRule implements Comparable<PermissionRule> {
|
||||
}
|
||||
return Integer.parseInt(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (!(obj instanceof PermissionRule)) {
|
||||
return false;
|
||||
}
|
||||
final PermissionRule other = (PermissionRule)obj;
|
||||
return action.equals(other.action) && force == other.force
|
||||
&& min == other.min && max == other.max && group.equals(other.group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return group.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,4 +48,17 @@ public abstract class RefConfigSection {
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (!(obj instanceof RefConfigSection)) {
|
||||
return false;
|
||||
}
|
||||
return name.equals(((RefConfigSection) obj).name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return name.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user