From ca9c148705461430e84fa4a3cd0cf3608e41b608 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Tue, 17 May 2011 00:10:36 +0200 Subject: [PATCH] Set calendars always personal with authentication activated --- config | 3 --- radicale/__init__.py | 3 --- radicale/acl/LDAP.py | 5 ++--- radicale/acl/htpasswd.py | 3 +-- radicale/config.py | 1 - 5 files changed, 3 insertions(+), 12 deletions(-) diff --git a/config b/config index 45349e36..49e4d90f 100644 --- a/config +++ b/config @@ -36,9 +36,6 @@ stock = utf-8 # Access method # Value: None | htpasswd | LDAP type = None -# Personal calendars only available for logged in users -# If True, /alice/calendar will only be available for alice -personal = True # Htpasswd filename htpasswd_filename = /etc/radicale/users # Htpasswd encryption method diff --git a/radicale/__init__.py b/radicale/__init__.py index 024524b8..5e62f1f0 100644 --- a/radicale/__init__.py +++ b/radicale/__init__.py @@ -169,9 +169,6 @@ class Application(object): if not calendar or not self.acl: # No calendar or no acl, don't check rights status, headers, answer = function(environ, calendar, content) - elif calendar.owner is None and config.getboolean("acl", "personal"): - # No owner and personal calendars, don't check rights - status, headers, answer = function(environ, calendar, content) else: # Ask authentication backend to check rights log.LOGGER.info( diff --git a/radicale/acl/LDAP.py b/radicale/acl/LDAP.py index 9a95982e..16162b96 100644 --- a/radicale/acl/LDAP.py +++ b/radicale/acl/LDAP.py @@ -32,15 +32,14 @@ from radicale import config, log BASE = config.get("acl", "ldap_base") ATTRIBUTE = config.get("acl", "ldap_attribute") CONNEXION = ldap.initialize(config.get("acl", "ldap_url")) -PERSONAL = config.getboolean("acl", "personal") BINDDN = config.get("acl", "ldap_binddn") PASSWORD = config.get("acl", "ldap_password") def has_right(owner, user, password): """Check if ``user``/``password`` couple is valid.""" - if (user != owner and PERSONAL) or not user: - # User is not owner and personal calendars, or no user given, forbidden + if not user or (owner and user != owner): + # No user given, or owner is set and is not user, forbidden return False if BINDDN and PASSWORD: diff --git a/radicale/acl/htpasswd.py b/radicale/acl/htpasswd.py index d6600ee2..d1000498 100644 --- a/radicale/acl/htpasswd.py +++ b/radicale/acl/htpasswd.py @@ -34,7 +34,6 @@ from radicale import config FILENAME = config.get("acl", "htpasswd_filename") -PERSONAL = config.getboolean("acl", "personal") ENCRYPTION = config.get("acl", "htpasswd_encryption") @@ -64,6 +63,6 @@ def has_right(owner, user, password): for line in open(FILENAME).readlines(): if line.strip(): login, hash_value = line.strip().split(":") - if login == user and (not PERSONAL or user == owner): + if login == user and (not owner or owner == user): return globals()["_%s" % ENCRYPTION](hash_value, password) return False diff --git a/radicale/config.py b/radicale/config.py index a4a780fb..c86ccb36 100644 --- a/radicale/config.py +++ b/radicale/config.py @@ -50,7 +50,6 @@ INITIAL_CONFIG = { "stock": "utf-8"}, "acl": { "type": "None", - "personal": "True", "httpasswd_filename": "/etc/radicale/users", "httpasswd_encryption": "crypt", "ldap_url": "ldap://localhost:389/",