def policy(self, rules, default_rule='allow'): # Inject an allow and deny rule rules['allow'] = '@' rules['deny'] = '!' # Parse the rules rules = dict((k, policy.parse_rule(v)) for k, v in rules.items()) rules = policy.Rules(rules, default_rule) # Set the rules policy.set_rules(rules)
def policy(self, rules, default_rule='allow'): # Inject an allow and deny rule rules['allow'] = '@' rules['deny'] = '!' # Parse the rules rules = dict((k, policy.parse_rule(v)) for k, v in rules.items()) rules = policy.Rules(rules, default_rule) # Set the rules policy.set_rules(rules)
def policy(self, rules, default_rule="allow"): # Inject an allow and deny rule rules["allow"] = "@" rules["deny"] = "!" # Parse the rules rules = dict((k, policy.parse_rule(v)) for k, v in rules.items()) rules = policy.Rules(rules, default_rule) # Set the rules policy.set_rules(rules)
def init_policy(): LOG.info('Initializing Policy') policy_files = utils.find_config(cfg.CONF.policy_file) if len(policy_files) == 0: msg = 'Unable to determine appropriate policy json file' raise exceptions.ConfigurationError(msg) LOG.info('Using policy_file found at: %s' % policy_files[0]) with open(policy_files[0]) as fh: policy_json = fh.read() rules = policy.Rules.load_json(policy_json, cfg.CONF.policy_default_rule) policy.set_rules(rules)
def init_policy(): LOG.info("Initializing Policy") policy_files = utils.find_config(cfg.CONF.policy_file) if len(policy_files) == 0: msg = "Unable to determine appropriate policy json file" raise exceptions.ConfigurationError(msg) LOG.info("Using policy_file found at: %s" % policy_files[0]) with open(policy_files[0]) as fh: policy_json = fh.read() rules = policy.Rules.load_json(policy_json, cfg.CONF.policy_default_rule) policy.set_rules(rules)