commit
c953211175
@ -264,9 +264,6 @@ class Application(object):
|
|||||||
|
|
||||||
path = environ["PATH_INFO"]
|
path = environ["PATH_INFO"]
|
||||||
|
|
||||||
# Find collection(s)
|
|
||||||
items = ical.Collection.from_path(path, environ.get("HTTP_DEPTH", "0"))
|
|
||||||
|
|
||||||
# Get function corresponding to method
|
# Get function corresponding to method
|
||||||
function = getattr(self, environ["REQUEST_METHOD"].lower())
|
function = getattr(self, environ["REQUEST_METHOD"].lower())
|
||||||
|
|
||||||
@ -280,17 +277,21 @@ class Application(object):
|
|||||||
else:
|
else:
|
||||||
user = password = None
|
user = password = None
|
||||||
|
|
||||||
read_allowed_items, write_allowed_items = \
|
|
||||||
self.collect_allowed_items(items, user)
|
|
||||||
|
|
||||||
is_authenticated = auth.is_authenticated(user, password)
|
is_authenticated = auth.is_authenticated(user, password)
|
||||||
|
is_valid_user = is_authenticated or not user
|
||||||
|
|
||||||
if ((read_allowed_items or write_allowed_items)
|
if is_valid_user:
|
||||||
and (not user or is_authenticated)) or \
|
items = ical.Collection.from_path(path,
|
||||||
(is_authenticated and function == self.propfind) or \
|
environ.get("HTTP_DEPTH", "0"))
|
||||||
function == self.options or not items:
|
read_allowed_items, write_allowed_items = \
|
||||||
# Collections found, or authenticated PROPFIND request,
|
self.collect_allowed_items(items, user)
|
||||||
# or OPTIONS request, or no items at all
|
else:
|
||||||
|
read_allowed_items, write_allowed_items = None, None
|
||||||
|
|
||||||
|
if is_valid_user and (
|
||||||
|
(read_allowed_items or write_allowed_items) or
|
||||||
|
(is_authenticated and function == self.propfind) or
|
||||||
|
function == self.options):
|
||||||
status, headers, answer = function(
|
status, headers, answer = function(
|
||||||
environ, read_allowed_items, write_allowed_items, content,
|
environ, read_allowed_items, write_allowed_items, content,
|
||||||
user)
|
user)
|
||||||
|
Loading…
Reference in New Issue
Block a user