Load all policies as loaded Policy objects.
508969
public static function loadAll()
  {
    $list = [];
    foreach (self::getProfileList() as $definition) {
      $list[$definition['name']] = self::loadProfileByName($definition['name']);
    }
    return $list;
  }
690122
def Policy(self, data=None, subset=None):
        """"""
        return self.factory.get_object(jssobjects.Policy, data, subset)
1335640
def policies(options = {})
      batches = Enumerator.new do |y|
        options = options.merge(role_name: @name)
        resp = @client.list_role_policies(options)
        resp.each_page do |page|
          batch = []
          page.data.policy_names.each do |p|
            batch << RolePolicy.new(
              role_name: @name,
              name: p,
              client: @client
            )
          end
          y.yield(batch)
        end
      end
      RolePolicy::Collection.new(batches)
    end
272698
def parse_policies(self, fetched_policy, params):
        
        api_client = params['api_client']
        policy = {}
        policy['name'] = fetched_policy.pop('PolicyName')
        policy['id'] = fetched_policy.pop('PolicyId')
        policy['arn'] = fetched_policy.pop('Arn')
        # Download version and document
        policy_version = api_client.get_policy_version(PolicyArn = policy['arn'], VersionId = fetched_policy['DefaultVersionId'])
        policy_version = policy_version['PolicyVersion']
        policy['PolicyDocument'] = policy_version['Document']
        # Get attached IAM entities
        policy['attached_to'] = {}
        attached_entities = handle_truncated_response(api_client.list_entities_for_policy, {'PolicyArn': policy['arn']}, ['PolicyGroups', 'PolicyRoles', 'PolicyUsers'])
        for entity_type in attached_entities:
            resource_type = entity_type.replace('Policy', '').lower()
            if len(attached_entities[entity_type]):
                policy['attached_to'][resource_type] = []
            for entity in attached_entities[entity_type]:
                name_field = entity_type.replace('Policy', '')[:-1] + 'Name'
                resource_name = entity[name_field]
                policy['attached_to'][resource_type].append({'name': resource_name})
        # Save policy
        self.policies[policy['id']] = policy
569143
@Override
    public void refresh() {
        FileReader fr = null;
        if (file != null) {
            try {
                fr = new FileReader(file);
            } catch (Exception e) {
                System.err.println("Unable to read policy file " + file + ": " + e.getMessage());
            }
        }
        loadPolicy(fr, skipDefaultPolicies);
    }
448161
def _updatePolicyElements(policy_item, regkey):
    '''
    
    '''
    for child in policy_item.getiterator():
        if 'valueName' in child.attrib:
            if 'key' not in child.attrib:
                child.attrib['key'] = regkey
    return policy_item
448802
public void setPolicies(RetryPolicy[] policies) {
		this.policies = Arrays.asList(policies).toArray(new RetryPolicy[policies.length]);
	}
1316679
def load(self):
        """"""

        for drpins in self.iload(self.entry):
            self.drps[drpins.name] = drpins

        return self
510894
private <T> void load(YamlSourceLoader<T> loader, YamlPolicyCreator<T> creator)
            throws IOException
    {
        int index = 1;
        try (final YamlSourceLoader<T> loader1 = loader) {
            for (T yamlDoc : loader1.loadAll()) {
                String ident = identity + "[" + index + "]";
                if (null == yamlDoc) {
                    continue;
                }
                try {
                    Policy yamlPolicy = creator.createYamlPolicy(
                            yamlDoc,
                            identity + "[" + index + "]",
                            index
                    );
                    all.add(yamlPolicy);
                    ruleSet.addAll(yamlPolicy.getRuleSet().getRules());
                } catch (AclPolicySyntaxException e) {
                    validationError(ident, e.getMessage());
                    logger.debug(
                            "ERROR parsing a policy in file: " +
                            identity +
                            "[" +
                            index +
                            "]. Reason: " +
                            e.getMessage(), e
                    );
                }
                index++;
            }

        }
    }
1178262
public void reloadPolicies(String scanPolicyName) {
        DefaultComboBoxModel<String> policies = new DefaultComboBoxModel<>();
        for (String policy : extension.getPolicyManager().getAllPolicyNames()) {
            policies.addElement(policy);
        }
        getPolicySelector().setModel(policies);
        getPolicySelector().setSelectedItem(scanPolicyName);
    }
1239189
def loadalldatas():
    """"""
    dependency_order = ['common', 'profiles', 'blog', 'democomments']
    for app in dependency_order:
        project.recursive_load(os.path.join(paths.project_paths.manage_root, app))
248212
public void setPolicies(java.util.Collection<Policy> policies) {
        if (policies == null) {
            this.policies = null;
            return;
        }

        this.policies = new java.util.ArrayList<Policy>(policies);
    }
904988
private function loadModelRules()
    {
        foreach ($this->rules['modelRules'] as $modelClass => $modelPolicy) {
            $resourceId = call_user_func_array($this->config['modelResourceGenerator'], [$modelClass]);
            $this->acl->addResource(new Resource($resourceId));
            $modelAccessPolicy = [];
            if (isset($modelPolicy['access'])) {
                $modelAccessPolicy = $modelPolicy['access'];
            }
            foreach ($modelAccessPolicy as $ruleSet => $privileges) {
                foreach ($privileges as $privilege) {
                    $this->enforceRuleset($ruleSet, ['privileges' => $privilege, 'resources' => $resourceId]);
                }
            }
            $this->loadModelFieldPolicy($modelClass, $modelPolicy);
        }
    }
927861
def export_roles(path_prefix='/', region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    if not conn:
        return None
    results = odict.OrderedDict()
    roles = get_all_roles(path_prefix, region, key, keyid, profile)
    for role in roles:
        name = role.role_name
        _policies = conn.list_role_policies(name, max_items=100)
        _policies = _policies.list_role_policies_response.list_role_policies_result.policy_names
        policies = {}
        for policy_name in _policies:
            _policy = conn.get_role_policy(name, policy_name)
            _policy = salt.utils.json.loads(_unquote(
                _policy.get_role_policy_response.get_role_policy_result.policy_document
            ))
            policies[policy_name] = _policy
        role_sls = []
        role_sls.append({"name": name})
        role_sls.append({"policies": policies})
        role_sls.append({'policy_document': salt.utils.json.loads(_unquote(role.assume_role_policy_document))})
        role_sls.append({"path": role.path})
        results["manage role " + name] = {"boto_iam_role.present": role_sls}
    return __utils__['yaml.safe_dump'](
        results,
        default_flow_style=False,
        indent=2)
170848
def select(self, names):
        """"""
        return PolicyCollection(
            [p for p in self.policies if p.name in names], self.options)
595893
public function registerPolicies()
    {
        foreach ($this->policies as $key => $value) {
            IlluminateGate::policy($key, $value);
        }
    }
136641
public static Policies load(File rootPath, final Set<Attribute> forcedContext)  {
        return new Policies(PoliciesCache.fromDir(rootPath, forcedContext));
    }