Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2012-10-03 06:38:21 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2012-10-03 06:38:21 (GMT)
commit8a76552620edf7c259f5b79507e93d752b048326 (patch)
treee985597f863212d06980e68e303a3c65c5ad9d84
parent829bb6886778fc035dc5c0cb01e593e8dd317e4f (diff)
Process [DEFAULT] section as defaults for not found users in authorization.conf
-rw-r--r--sugar_network/node/auth.py8
1 files changed, 6 insertions, 2 deletions
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')