Merge "Remove unused functions from policy enforcer"

This commit is contained in:
Jenkins 2014-08-11 16:52:54 +00:00 committed by Gerrit Code Review
commit f1220c3774
2 changed files with 0 additions and 21 deletions

View File

@ -76,16 +76,6 @@ class Enforcer(object):
_target = target or {}
return self._check(context, _action, _target, self.exc, action=action)
def check(self, context, action, target):
"""Verifies that the action is valid on the target in this context.
:param context: Heat request context
:param action: String representing the action to be checked
:param target: Dictionary representing the object of the action.
:returns: A non-False value if access is allowed.
"""
return self._check(context, action, target)
def check_is_admin(self, context):
"""Whether or not roles contains 'admin' role according to policy.json
@ -93,6 +83,3 @@ class Enforcer(object):
:returns: A non-False value if the user is admin according to policy
"""
return self._check(context, 'context_is_admin', target={}, exc=None)
def clear(self):
self.enforcer.clear()

View File

@ -124,14 +124,6 @@ class TestPolicyEnforcer(HeatTestCase):
# Everything should be allowed
enforcer.enforce(ctx, action)
def test_clear(self):
self.stub_policyfile('deny_stack_user.json')
enforcer = policy.Enforcer()
enforcer.load_rules(force_reload=True)
enforcer.clear()
self.assertEqual({}, enforcer.enforcer.rules)
def test_set_rules_overwrite_true(self):
self.stub_policyfile('deny_stack_user.json')