Small fixes
This commit is contained in:
parent
e14bed9f95
commit
e33ee8ea7c
@ -214,22 +214,28 @@ class Application(object):
|
|||||||
last_collection_allowed = None
|
last_collection_allowed = None
|
||||||
allowed_items = []
|
allowed_items = []
|
||||||
for item in items:
|
for item in items:
|
||||||
log.LOGGER.debug("Testing %s" % (item.name))
|
if isinstance(item, ical.Collection):
|
||||||
if not isinstance(item, ical.Collection):
|
if access.read_authorized(user, item) or \
|
||||||
|
access.write_authorized(user, item):
|
||||||
|
log.LOGGER.info("%s has access to collection %s" % (
|
||||||
|
user, item.name or "/"))
|
||||||
|
last_collection_allowed = True
|
||||||
|
allowed_items.append(item)
|
||||||
|
else:
|
||||||
|
log.LOGGER.info("%s has NO access to collection %s" % (
|
||||||
|
user, item.name or "/"))
|
||||||
|
last_collection_allowed = False
|
||||||
|
else:
|
||||||
# item is not a colleciton, it's the child of the last
|
# item is not a colleciton, it's the child of the last
|
||||||
# collection we've met in the loop. Only add this item
|
# collection we've met in the loop. Only add this item
|
||||||
# if this last collection was allowed.
|
# if this last collection was allowed.
|
||||||
if last_collection_allowed:
|
if last_collection_allowed:
|
||||||
|
log.LOGGER.info("%s has access to item %s" % (
|
||||||
|
user, item.name or "/"))
|
||||||
allowed_items.append(item)
|
allowed_items.append(item)
|
||||||
else:
|
else:
|
||||||
if access.read_authorized(user, item) or \
|
log.LOGGER.info("%s has NO access to item %s" % (
|
||||||
access.write_authorized(user, item):
|
user, item.name or "/"))
|
||||||
log.LOGGER.info("%s has access to %s" % (
|
|
||||||
user, item.name))
|
|
||||||
last_collection_allowed = True
|
|
||||||
allowed_items.append(item)
|
|
||||||
else:
|
|
||||||
last_collection_allowed = False
|
|
||||||
|
|
||||||
if allowed_items:
|
if allowed_items:
|
||||||
# Collections found
|
# Collections found
|
||||||
@ -319,7 +325,7 @@ class Application(object):
|
|||||||
# Display a "Radicale works!" message if the root URL is requested
|
# Display a "Radicale works!" message if the root URL is requested
|
||||||
if environ["PATH_INFO"] == "/":
|
if environ["PATH_INFO"] == "/":
|
||||||
headers = {"Content-type": "text/html"}
|
headers = {"Content-type": "text/html"}
|
||||||
answer = "<!DOCTYPE html>\n<title>Radicale</title>Radicale works!"
|
answer = b"<!DOCTYPE html>\n<title>Radicale</title>Radicale works!"
|
||||||
return client.OK, headers, answer
|
return client.OK, headers, answer
|
||||||
|
|
||||||
collection = collections[0]
|
collection = collections[0]
|
||||||
@ -341,8 +347,9 @@ class Application(object):
|
|||||||
return client.GONE, {}, None
|
return client.GONE, {}, None
|
||||||
else:
|
else:
|
||||||
# Create the collection if it does not exist
|
# Create the collection if it does not exist
|
||||||
if not collection.exists and access.write_authorized(user, collection):
|
if not collection.exists and \
|
||||||
log.LOGGER.debug("creating collection " + collection.name)
|
access.write_authorized(user, collection):
|
||||||
|
log.LOGGER.debug("Creating collection %s" % collection.name)
|
||||||
collection.write()
|
collection.write()
|
||||||
|
|
||||||
if access.read_authorized(user, collection):
|
if access.read_authorized(user, collection):
|
||||||
|
Loading…
Reference in New Issue
Block a user