Esempio n. 1
0
 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 = {}
Esempio n. 2
0
 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 = {}
Esempio n. 3
0
 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()))
Esempio n. 4
0
 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)
Esempio n. 5
0
 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()))
Esempio n. 6
0
 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)