From bfc09c185d57efd3b1c3cc41cf6597bace852b36 Mon Sep 17 00:00:00 2001 From: iodeslykos <42@iodeslykos.com> Date: Wed, 24 Jan 2024 16:17:52 -0700 Subject: [PATCH] Remove admin check, allowedToManageHooks is enough --- .../plugins/github/webhook/WebhookManager.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java b/src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java index 3a7d6f25c..91496a1f6 100644 --- a/src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java +++ b/src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java @@ -166,18 +166,14 @@ public void unregisterFor(GitHubRepositoryName name, List } private GHRepository repoWithWebhookAccess(GitHubRepositoryName name) { - FluentIterableWrapper reposAllowedtoManageWebhooks = from(name.resolve(allowedToManageHooks())); - if (!reposAllowedtoManageWebhooks.first().isPresent()) { + FluentIterableWrapper reposAllowedToManageWebhooks = from(name.resolve(allowedToManageHooks())); + if (!reposAllowedToManageWebhooks.first().isPresent()) { LOGGER.debug("There are no github repos configured to allow webhook management for: {}", name); return null; } - com.google.common.base.Optional repoWithAdminAccess = reposAllowedtoManageWebhooks - .firstMatch(withAdminAccess()); - if (!repoWithAdminAccess.isPresent()) { - LOGGER.debug("None of the github repos configured have admin access for: {}", name); - return null; - } - GHRepository repo = repoWithAdminAccess.get(); + com.google.common.base.Optional repoAllowedToManageWebhooks = reposAllowedToManageWebhooks + .first(); + GHRepository repo = repoAllowedToManageWebhooks.get(); return repo; }