def setUp(self): super(PolicyTestCase, self).setUp() rules = oslo_policy.Rules.from_dict({ "true": '@', "example:allowed": '@', "example:denied": "!", "example:get_http": "http://www.example.com", "example:my_file": "role:compute_admin or " "project_id:%(project_id)s", "example:early_and_fail": "! and @", "example:early_or_success": "@ or !", "example:lowercase_admin": "role:admin or role:sysadmin", "example:uppercase_admin": "role:ADMIN or role:sysadmin", }) policy.reset() policy.init() policy.set_rules(rules) self.context = context.RequestContext('fake', 'fake', roles=['member']) self.target = {}
def set_rules(self, rules): policy = congress.common.policy._ENFORCER policy.set_rules(dict((k, common_policy.parse_rule(v)) for k, v in rules.items()))
def set_rules(self, rules): policy = congress.common.policy._ENFORCER policy.set_rules( dict((k, common_policy.parse_rule(v)) for k, v in rules.items()))