def setUp(self): super(PolicyTestCase, self).setUp() rules = { "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(dict((k, common_policy.parse_rule(v)) for k, v in rules.items())) self.context = context.RequestContext('fake', 'fake', roles=['member']) self.target = {}
def setUp(self): super(PolicyTestCase, self).setUp() rules = { "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( dict((k, common_policy.parse_rule(v)) for k, v in rules.items())) 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, default_rule): policy.reset() rules = dict((k, common_policy.parse_rule(v)) for k, v in self.rules.items()) policy.init(rules=rules, default_rule=default_rule, use_conf=False)
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, default_rule): policy.reset() rules = dict( (k, common_policy.parse_rule(v)) for k, v in self.rules.items()) policy.init(rules=rules, default_rule=default_rule, use_conf=False)