From 5bce9a02509d123dcf1c96e43562dd7ed80a0f05 Mon Sep 17 00:00:00 2001 From: David Lyle Date: Tue, 3 Jan 2017 14:30:43 -0700 Subject: [PATCH] Fix single policy rule handling With commit 43e9df85ab286ddee96e9cff97f551781baf70d1 the handling of single policy rules was broken and always returned True for a single rule. One of the visible results is that the Admin Dashboard showed up incorrectly for users that lacked permission to see it. Additionally, panel in the Admin Dashboard were also visible. This patch fixes single rule handling, and the visible effects. Closes-Bug: #1653792 Change-Id: I0c8a0d7b230b6c6b7ee048af84646ca95daee340 --- horizon/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/horizon/base.py b/horizon/base.py index a373a70df..93630e735 100644 --- a/horizon/base.py +++ b/horizon/base.py @@ -153,7 +153,7 @@ class HorizonComponent(object): for rule in self.policy_rules: rule_param = rule if not any(isinstance(r, (list, tuple)) for r in rule): - rule_param = list(rule) + rule_param = (rule,) if policy_check(rule_param, request): return True return False