GetGroups: Add debug logs that show up in traces
Change-Id: I6487fbe34c56a46d5970b508d72085b219833e23 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
committed by
David Pursehouse
parent
03b28c5758
commit
13e7f25170
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.server.restapi.account;
|
||||
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.gerrit.entities.Account;
|
||||
import com.google.gerrit.entities.AccountGroup;
|
||||
import com.google.gerrit.exceptions.NoSuchGroupException;
|
||||
@@ -42,6 +43,8 @@ import java.util.Set;
|
||||
*/
|
||||
@Singleton
|
||||
public class GetGroups implements RestReadView<AccountResource> {
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
private final GroupControl.Factory groupControlFactory;
|
||||
private final GroupJson json;
|
||||
|
||||
@@ -63,11 +66,22 @@ public class GetGroups implements RestReadView<AccountResource> {
|
||||
try {
|
||||
ctl = groupControlFactory.controlFor(uuid);
|
||||
} catch (NoSuchGroupException e) {
|
||||
logger.atFine().log("skipping non-existing group %s", uuid);
|
||||
continue;
|
||||
}
|
||||
if (ctl.isVisible() && ctl.canSeeMember(userId)) {
|
||||
visibleGroups.add(json.format(ctl.getGroup()));
|
||||
|
||||
if (!ctl.isVisible()) {
|
||||
logger.atFine().log("skipping non-visible group %s", uuid);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ctl.canSeeMember(userId)) {
|
||||
logger.atFine().log(
|
||||
"skipping group %s because member %d cannot be seen", uuid, userId.get());
|
||||
continue;
|
||||
}
|
||||
|
||||
visibleGroups.add(json.format(ctl.getGroup()));
|
||||
}
|
||||
return Response.ok(visibleGroups);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user