Respond to all authenticated PROPFIND requests

This commit is contained in:
Christoph Polcin
2014-01-05 20:54:17 +01:00
parent 2ddec14535
commit 83db27303f
2 changed files with 67 additions and 48 deletions

View File

@@ -283,10 +283,14 @@ class Application(object):
read_allowed_items, write_allowed_items = \
self.collect_allowed_items(items, user)
is_authenticated = auth.is_authenticated(user, password)
if ((read_allowed_items or write_allowed_items)
and (not user or auth.is_authenticated(user, password))) or \
and (not user or is_authenticated)) or \
(is_authenticated and function == self.propfind) or \
function == self.options or not items:
# Collections found, or OPTIONS request, or no items at all
# Collections found, or authenticated PROPFIND request,
# or OPTIONS request, or no items at all
status, headers, answer = function(
environ, read_allowed_items, write_allowed_items, content,
user)
@@ -294,7 +298,7 @@ class Application(object):
status, headers, answer = NOT_ALLOWED
if ((status, headers, answer) == NOT_ALLOWED and
not auth.is_authenticated(user, password) and
not is_authenticated and
config.get("auth", "type") != "None"):
# Unknown or unauthorized user
log.LOGGER.info("%s refused" % (user or "Anonymous user"))