expose server version via PROPFIND on root collection and display in the UI for authenticated users

This commit is contained in:
Max Berger
2026-04-29 23:13:36 +02:00
parent 98d9257b84
commit cdf9e62e0b
7 changed files with 68 additions and 4 deletions

View File

@@ -2310,6 +2310,40 @@ permissions: RrWw""")
element = prop.find(xmlutils.make_clark("D:href"))
assert element is not None and element.text == "/user/"
def test_version_exposure_authenticated(self) -> None:
"""Test if the version is returned for authenticated users."""
self.configure({"auth": {"type": "none"}})
status, responses = self.propfind("/", """\
<?xml version="1.0" encoding="utf-8"?>
<propfind xmlns="DAV:" xmlns:R="http://radicale.org/ns/">
<prop>
<R:version />
</prop>
</propfind>""", login="user:")
assert status == 207
response = responses["/"]
assert not isinstance(response, int)
status_code, prop = response["RADICALE:version"]
assert status_code == 200
assert prop.text == utils.package_version("radicale")
def test_version_exposure_unauthenticated(self) -> None:
"""Test if the version is hidden for unauthenticated users."""
self.configure({"auth": {"type": "none"}})
# Without login, 'user' will be empty
status, responses = self.propfind("/", """\
<?xml version="1.0" encoding="utf-8"?>
<propfind xmlns="DAV:" xmlns:R="http://radicale.org/ns/">
<prop>
<R:version />
</prop>
</propfind>""")
assert status == 207
response = responses["/"]
assert not isinstance(response, int)
status_code, _ = response["RADICALE:version"]
assert status_code == 404
def test_authentication(self) -> None:
"""Test if server sends authentication request."""
self.configure({"auth": {"type": "htpasswd",