Use a common interface for Gerrit permissions
Gerrit has defined permissions for hosts, projects, refs, changes, labels and plugins. But those permissions are not built on one common interface even though their behaviors are almost the same. This makes the life in the PermissionBackend a little bit hard. For example, some general logic for a permission couldn't be shared with others. This commit defines the 'GerritPermission' interface and adapts existing permission class/interface to leverage on this common interface. Change-Id: I56d5afbf0ddd7703fdbdfa3911929dbfab7ad065
This commit is contained in:
@@ -25,7 +25,6 @@ import com.google.gerrit.extensions.api.access.PluginPermission;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -133,11 +132,6 @@ public enum GlobalPermission implements GlobalOrPluginPermission {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeForException() {
|
||||
return toString().toLowerCase(Locale.US).replace('_', ' ');
|
||||
}
|
||||
|
||||
private static GlobalOrPluginPermission resolve(
|
||||
@Nullable String pluginName,
|
||||
String capability,
|
||||
|
||||
Reference in New Issue
Block a user