use of com.google.gerrit.server.permissions.GlobalPermission in project gerrit by GerritCodeReview.
the class Capabilities method parse.
private GlobalOrPluginPermission parse(IdString id) throws ResourceNotFoundException {
String name = id.get();
Optional<GlobalPermission> perm = globalPermission(name);
if (perm.isPresent()) {
return perm.get();
}
int dash = name.lastIndexOf('-');
if (dash < 0) {
throw new ResourceNotFoundException(id);
}
String pluginName = name.substring(0, dash);
String capability = name.substring(dash + 1);
if (pluginName.isEmpty() || capability.isEmpty()) {
throw new ResourceNotFoundException(id);
}
return new PluginPermission(pluginName, capability);
}
Aggregations