Skip to content

Commit

Permalink
fix: useLegacyAdapter should check the VO
Browse files Browse the repository at this point in the history
  • Loading branch information
aldbr committed Dec 6, 2023
1 parent 01491bf commit ec898e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/DIRAC/ConfigurationSystem/Client/PathFinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,20 @@ def useLegacyAdapter(system, service=None) -> bool:
:return: bool -- True if DiracX should be used
"""
from DIRAC.Core.Security.ProxyInfo import getProxyInfo

# Check if DiracX is enabled for this service
system, service = divideFullName(system, service)
value = gConfigurationData.extractOptionFromCFG(f"/DiracX/LegacyClientEnabled/{system}/{service}")
return (value or "no").lower() in ("y", "yes", "true", "1")
isServiceEnabled = (value or "no").lower() in ("y", "yes", "true", "1")
# Check if DiracX is enabled for this VO
result = getProxyInfo()
if not result["OK"]:
return False
value = gConfigurationData.extractOptionFromCFG(f"/Registry/Groups/{result['Value']['group']}/VO")
isVOEnabled = value not in getDisabledDiracxVOs()

return isServiceEnabled and isVOEnabled


def getServiceURL(system, service=None, setup=False):
Expand Down
2 changes: 1 addition & 1 deletion src/DIRAC/Core/Security/DiracX.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def DiracXClient() -> _DiracClient:
proxyLocation = getDefaultProxyLocation()
diracxToken = diracxTokenFromPEM(proxyLocation)
if not diracxToken:
raise ValueError(f"No dirax token in the proxy file {proxyLocation}")
raise ValueError(f"No diracx token in the proxy file {proxyLocation}")

with NamedTemporaryFile(mode="wt") as token_file:
token_file.write(json.dumps(diracxToken))
Expand Down

0 comments on commit ec898e1

Please sign in to comment.