Merge "Fix authentication exception for list comments with anonymous users"

This commit is contained in:
Youssef Elghareeb
2020-04-07 16:50:41 +00:00
committed by Gerrit Code Review

View File

@@ -57,17 +57,12 @@ public class ListChangeComments implements RestReadView<ChangeResource> {
@Override
public Response<Map<String, List<CommentInfo>>> apply(ChangeResource rsrc)
throws AuthException, PermissionBackendException {
if (!rsrc.getUser().isIdentifiedUser()) {
throw new AuthException("Authentication required");
}
/** List change comments does not require authentication */
return Response.ok(getAsMap(listComments(rsrc), rsrc));
}
public List<CommentInfo> getComments(ChangeResource rsrc)
throws AuthException, PermissionBackendException {
if (!rsrc.getUser().isIdentifiedUser()) {
throw new AuthException("Authentication required");
}
public List<CommentInfo> getComments(ChangeResource rsrc) throws PermissionBackendException {
/** List change comments does not require authentication */
return getAsList(listComments(rsrc), rsrc);
}