Fix single policy rule handling

With commit 43e9df85ab 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
(cherry picked from commit 5bce9a0250)
This commit is contained in:
David Lyle 2017-01-03 14:30:43 -07:00 committed by David Lyle
parent 87ae58b95e
commit 8d9665302a
1 changed files with 1 additions and 1 deletions

View File

@ -152,7 +152,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