Retrieve ACLs, ACLs rules and interface bindings from switch
779775
def _get_dynamic_acl_info(self, switch_ip):
        """"""
        cmds = ["enable",
                "show ip access-lists dynamic",
                "show ip access-lists summary dynamic"]
        switch = self._switches.get(switch_ip)

        _, acls, bindings = self._run_eos_cmds(cmds, switch)

        parsed_acls = self._parse_acl_config(acls)
        parsed_bindings = self._parse_binding_config(bindings)

        return parsed_acls, parsed_bindings
241717
private function getAcl(): ?array {

		if (!$this->issetCache('acl')) {
		
			$query =
				'SELECT r.*, m.name AS module_name' .
				' FROM `rules` AS r' .
				' INNER JOIN `acl` AS a ON a.rule_id = r.id'.
				' INNER JOIN `modules` AS m ON r.module_id = m.id'.
				' WHERE a.group_id = ?';
			
			$this->db->setQuery($query);
			$this->setCache('acl', $this->db->loadObjectList($this->groupId));

		}

		return $this->getCache('acl');
		
	}
156774
def parse_acl(xml)
      grants = {}
      rexml_document(xml).elements.each("AccessControlPolicy/AccessControlList/Grant") do |grant|
        grants.merge!(extract_grantee(grant))
      end
      grants
    end
357295
private AccessControlList findAccessList( AccessControlManager acm,
                                              String path ) throws RepositoryException {
        AccessControlPolicy[] policy = acm.getPolicies(path);

        if (policy != null && policy.length > 0) {
            return (AccessControlList)policy[0];
        }

        policy = acm.getEffectivePolicies(path);
        if (policy != null && policy.length > 0) {
            return (AccessControlList)policy[0];
        }

        return null;
    }
760328
def get_expected_acls(self):
        
        security_groups = db_lib.get_security_groups()

        expected_acls = collections.defaultdict(set)
        for sg in security_groups:
            in_rules, out_rules = self._format_rules_for_eos(sg['rules'])
            ingress_acl_name = self._acl_name(sg['id'],
                                              n_const.INGRESS_DIRECTION)
            egress_acl_name = self._acl_name(sg['id'],
                                             n_const.EGRESS_DIRECTION)
            expected_acls[ingress_acl_name].update(in_rules)
            expected_acls[egress_acl_name].update(out_rules)
        return expected_acls
696232
function getPolicies(controller, action) {
		var policies = config.policies;
		var currentPolicies = [];
		if (policies[controller] && policies[controller][action]) {
			currentPolicies = policies[controller][action];
		} else if (Object.isString(policies[controller])) {
			currentPolicies = policies[controller];
		} else if (policies[controller] && policies[controller]['*']) {
			currentPolicies = policies[controller]['*'];
		} else if (policies['*']) {
			currentPolicies = policies['*'];
		}

		if (currentPolicies === true) {
			currentPolicies = [];
		}

		if (!Object.isArray(currentPolicies)) {
			currentPolicies = [currentPolicies];
		}

		currentPolicies = currentPolicies.map(function(policy) {
			var policyPath = path.join(config.rootDir, config.paths.policies, policy);
			return require(policyPath);
		});
		return currentPolicies;
	}
311445
def __process_acl(self, load, auth_list):
        '''
        
        '''
        if 'eauth' not in load:
            return auth_list
        fstr = '{0}.process_acl'.format(load['eauth'])
        if fstr not in self.auth:
            return auth_list
        try:
            return self.auth[fstr](auth_list, self.opts)
        except Exception as e:
            log.debug('Authentication module threw %s', e)
            return auth_list
299625
def get_interfaces
      mac_keys = facts.keys.select { |f| f =~ /net\.interface\..*\.mac_address/ }
      names = mac_keys.map do |key|
        key.sub('net.interface.', '').sub('.mac_address', '') if facts[key] != 'none'
      end
      names.compact
    end
260878
def get_rules(family='ipv4'):
    '''
    

    '''
    nft_family = _NFTABLES_FAMILIES[family]
    rules = []
    cmd = '{0} --numeric --numeric --numeric ' \
          'list tables {1}'. format(_nftables_cmd(),
                                    nft_family)
    out = __salt__['cmd.run'](cmd, python_shell=False)
    if not out:
        return rules

    tables = re.split('\n+', out)
    for table in tables:
        table_name = table.split(' ')[1]
        cmd = '{0} --numeric --numeric --numeric ' \
              'list table {1} {2}'.format(_nftables_cmd(),
                                          nft_family, table_name)
        out = __salt__['cmd.run'](cmd, python_shell=False)
        rules.append(out)
    return rules
737844
def to_dict(cls, acl):
        
        return {
            "perms": acl.perms,
            "id": {
                "scheme": acl.id.scheme,
                "id": acl.id.id
            }
        }
512389
private function getPathListCurrentAcl(): string
    {
        return sprintf(self::PATH_LIST_CURRENT_ACL, $this->appDir, explode('\\', get_class($this))[3]);
    }
937188
function addAcls(app, config) {
  config.acls = config.acls || []

  return Promise.resolve(Object.keys(app.models)).mapSeries(modelName => {
    const Model = app.models[modelName]

    if (typeof Model._templates !== 'function') {
      return null
    }

    return Promise.resolve(Object.keys(Model._templates()))
      .mapSeries(templateName => {
        const fnNameRemote = `_template_${templateName}_remote`

        return Promise.resolve(config.acls).mapSeries(acl => {
          const templateAcl = Object.assign({}, acl)

          templateAcl.model = modelName
          templateAcl.property = fnNameRemote
          debug('Create ACL entry for %s.%s ', modelName, fnNameRemote)
          return app.models.ACL.create(templateAcl)
        })
      })
  })
}
25083
def all(self):
        """"""
        return self._instance._client.acls.all(self._instance.name)
983666
def _get_interface_info(interface):
    '''
    
    '''
    adapter_mode = _get_adapter_mode_info(interface.name)
    if adapter_mode == 'disabled':
        return _get_base_interface_info(interface)
    elif adapter_mode == 'ethercat':
        return _get_ethercat_interface_info(interface)
    return _get_tcpip_interface_info(interface)
657663
function getBindingAccessors(node, context) {
  var bindings = {},
    parser = new Parser(node, context, options.bindingGlobals),
    binding_string = this.getBindingsString(node);

  if (binding_string) {
    binding_string = this.preProcessBindings(binding_string);
    bindings = parser.parse(binding_string || '');
  }

  arrayForEach(this.otherProviders, function(p) {
    extend(bindings, p.getBindingAccessors(node, context, parser, bindings));
  });

  objectForEach(bindings, this.preProcessBindings.bind(this));

  return bindings;
}
949823
function readAllSecure(user, options) {
    // jscs:disable
    // jshint -W040
    const self = this;
    // jshint +W040
    // jscs:enable
    const shield = self.constructor.shield;
    const action = 'read';
    const rules = shield.getApplicableRules(action);
    return shield._fetchAll.call(self, options)
        .then(function runShieldRules(collection) {
            // TODO: investigate what happens if fetch returns nothing (err?)
            return collection.mapThen((mdl) => applyRules(rules, mdl, user))
                .then(function resolveResult() {
                    return collection;
                });
        });
}
420716
def meth_acl(args):
    ''' '''
    r = fapi.get_repository_method_acl(args.namespace, args.method,
                                                    args.snapshot_id)
    fapi._check_response_code(r, 200)
    acls = sorted(r.json(), key=lambda k: k['user'])
    return map(lambda acl: '{0}\t{1}'.format(acl['user'], acl['role']), acls)