From 8a76552620edf7c259f5b79507e93d752b048326 Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Wed, 03 Oct 2012 06:38:21 +0000 Subject: Process [DEFAULT] section as defaults for not found users in authorization.conf --- diff --git a/sugar_network/node/auth.py b/sugar_network/node/auth.py index 131cda5..a190edc 100644 --- a/sugar_network/node/auth.py +++ b/sugar_network/node/auth.py @@ -48,6 +48,10 @@ def _validate(request, role): if exists(config_path): _config.read(config_path) - if _config.has_option(request.principal, role): - return _config.get(request.principal, role).strip().lower() in \ + user = request.principal + if not _config.has_section(user): + user = 'DEFAULT' + + if _config.has_option(user, role): + return _config.get(user, role).strip().lower() in \ ('true', 'on', '1', 'allow') -- cgit v0.9.1