is_authorized returns True when no auth method is set

This commit is contained in:
Guillaume Ayoub 2012-08-08 18:44:25 +02:00
parent 45afac5353
commit b4a7ada5f2
2 changed files with 46 additions and 47 deletions

View File

@ -46,7 +46,7 @@ except ImportError:
from urlparse import urlparse
# pylint: enable=F0401,E0611
from radicale import config, ical, log, storage, xmlutils, access
from radicale import access, config, ical, log, storage, xmlutils
VERSION = "git"
@ -199,10 +199,7 @@ class Application(object):
function = getattr(self, environ["REQUEST_METHOD"].lower())
# Check rights
if not items or not access or function == self.options:
# No collection, or no auth, or OPTIONS request: don't check rights
status, headers, answer = function(environ, items, content, None)
else:
if items and function != self.options:
# Ask authentication backend to check rights
authorization = environ.get("HTTP_AUTHORIZATION", None)

View File

@ -38,6 +38,8 @@ def load():
def is_authenticated(user, password):
"""Check if the user is authenticated."""
if AUTH is None:
return True
return AUTH.is_authenticated(user, password) if user else False