You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2026/02/17 16:10:39 UTC
(tooling-trusted-releases) 01/01: Skip LDAP checks in development environments too
This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit 7028236bdac2b0a6cf2d62566cb08690b2977f1c
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Tue Feb 17 16:10:09 2026 +0000
Skip LDAP checks in development environments too
---
atr/util.py | 4 ++++
atr/worker.py | 9 +++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/atr/util.py b/atr/util.py
index e03ef41e..9fae6d40 100644
--- a/atr/util.py
+++ b/atr/util.py
@@ -639,6 +639,10 @@ async def is_dir_resolve(path: pathlib.Path) -> pathlib.Path | None:
return resolved_path
+def is_ldap_configured() -> bool:
+ return ldap.get_bind_credentials() is not None
+
+
def is_user_viewing_as_admin(uid: str | None) -> bool:
"""Check whether a user is currently viewing the site with active admin privileges."""
if not user.is_admin(uid):
diff --git a/atr/worker.py b/atr/worker.py
index cb8efb72..8a23e699 100644
--- a/atr/worker.py
+++ b/atr/worker.py
@@ -42,6 +42,7 @@ import atr.models.sql as sql
import atr.tasks as tasks
import atr.tasks.checks as checks
import atr.tasks.task as task
+import atr.util as util
# Resource limits, 5 minutes and 3GB
_CPU_LIMIT_SECONDS: Final = 300
@@ -234,9 +235,13 @@ async def _task_process(task_id: int, task_type: str, task_args: list[str] | dic
task_results: results.Results | None
try:
- if asf_uid != "system" and not (conf.ALLOW_TESTS and asf_uid == "test"):
+ # In any of these three cases, we will skip the LDAP check
+ is_system = asf_uid == "system"
+ is_test = conf.ALLOW_TESTS and (asf_uid == "test")
+ is_dev_without_ldap = util.is_dev_environment() and (not util.is_ldap_configured())
+ if not (is_system or is_test or is_dev_without_ldap):
user_account = await ldap.account_lookup(asf_uid)
- if user_account is None or ldap.is_banned(user_account):
+ if (user_account is None) or ldap.is_banned(user_account):
raise RuntimeError(f"Account '{asf_uid}' is banned or does not exist")
handler = tasks.resolve(task_type_member)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org