Query LDAP to obtain the network ACLs of a given user,
			parse the ACLs, and return the results in a dict of the form
			acls[group][cidr] = description
354542
def getACLs(self, base, searchstr):
		
		acls = dict()
		res = self.query(base, searchstr, ['cn', 'ipHostNumber'])
		for dn,attr in res:
			cn = attr['cn'][0]
			dests = dict()
			if attr.has_key('ipHostNumber'):
				for entry in attr['ipHostNumber']:
					dest = entry.split('#', 1)[0].replace(" ", "")
					if len(entry.split('#', 1)) == 2:
						desc = entry.split('#', 1)[1].strip()
					else:
						desc = ""
					if not is_ip(dest):
						print dest, desc
						raise InputError(dest, "Invalid IP format")
					dests[dest] = desc
			acls[cn] = dests
		return acls
1117639
def _get_user(self, username, attrs=ALL_ATTRS):
        """"""

        username = ldap.filter.escape_filter_chars(username)
        user_filter = self.user_filter_tmpl % {
            'username': self._uni(username)
        }
        r = self._search(self._byte_p2(user_filter), attrs, self.userdn)

        if len(r) == 0:
            return None

        # if NO_ATTR, only return the DN
        if attrs == NO_ATTR:
            dn_entry = r[0][0]
        # in other cases, return everything (dn + attributes)
        else:
            dn_entry = r[0]
        return dn_entry
786351
def cidr_netmask(cidr):
    '''
    
    '''
    ips = netaddr.IPNetwork(cidr)
    return six.text_type(ips.netmask)
1108803
def get_group(id):
    
    acl_url = urljoin(_acl_url(), 'groups/{}'.format(id))
    try:
        r = http.get(acl_url)
        return r.json()
    except DCOSHTTPException as e:
        if e.response.status_code != 400:
            raise
1217873
def _get_anon_bind(self):
        
        r = self._search(
            'cn=config',
            '(objectClass=*)',
            ['nsslapd-allow-anonymous-access'],
            scope=ldap.SCOPE_BASE
        )
        dn, attrs = r[0]
        state = attrs.get('nsslapd-allow-anonymous-access')[0].decode('utf-8', 'ignore')
        if state in ['on', 'off', 'rootdse']:
            r = state
        else:
            r = None
        self._anon_bind = r
454525
def get_group_permissions(self):
        
        if self._group_permissions is None:
            self._group_permissions = set()

            if self.settings.FIND_GROUP_PERMS:
                try:
                    self._load_group_permissions()
                except ldap.LDAPError as e:
                    results = ldap_error.send(self.backend.__class__,
                                              context='get_group_permissions',
                                              exception=e)
                    if len(results) == 0:
                        logger.warning("Caught LDAPError loading group permissions: %s",
                                       pprint.pformat(e))

        return self._group_permissions
964655
public function getAllForUser(\ACL $userACL, array $restrictions = [])
    {
        $base_ids = array_keys($userACL->get_granted_base());

        $qb = $this
            ->createQueryBuilder('f');

        $qb->where($qb->expr()->isNull('f.baseId'))
            ->orWhere($qb->expr()->eq('f.public', $qb->expr()->literal(true)));

        if (count($restrictions) > 0 && count($base_ids) > 0) {
            $base_ids = array_intersect($base_ids, $restrictions);
        }

        if (empty($base_ids) && count($restrictions) > 0) {
            $base_ids = $restrictions;
        }

        if (count($base_ids) > 0) {
            $qb->orWhere($qb->expr()->in('f.baseId', $base_ids));
        }

        $qb->orderBy('f.updatedOn', 'DESC');

        return $qb->getQuery()->getResult();
    }
1157986
def build_acl_ip(self, network_obj):
        " "

        if str(network_obj) == '0.0.0.0/0':
            acl = "any "
        else:
            acl = "%(ip)s %(mask)s " % {'ip': network_obj.network,
                                        'mask': network_obj.netmask}
        return acl
348911
def fetch(self):
        
        params = values.of({})

        payload = self._version.fetch(
            'GET',
            self._uri,
            params=params,
        )

        return IpAddressInstance(
            self._version,
            payload,
            account_sid=self._solution['account_sid'],
            ip_access_control_list_sid=self._solution['ip_access_control_list_sid'],
            sid=self._solution['sid'],
        )
230803
def parse_authority(cls, authority):
        ''''''
        userinfo, sep, host = authority.partition('@')

        if not sep:
            return '', userinfo
        else:
            return userinfo, host
805398
def query(self, base, filterstr, attrlist=None):
		
		return self.conn.search_s(base, ldap.SCOPE_SUBTREE, filterstr, attrlist)
893023
def get_permissions(self):
        
        path = Client.urls['all_permissions']
        conns = self._call(path, 'GET')
        return conns
1108881
def complete_set_acls(self, cmd_param_text, full_cmd, *rest):
        
        possible_acl = [
            "digest:",
            "username_password:",
            "world:anyone:c",
            "world:anyone:cd",
            "world:anyone:cdr",
            "world:anyone:cdrw",
            "world:anyone:cdrwa",
        ]
        complete_acl = partial(complete_values, possible_acl)
        completers = [self._complete_path, complete_acl, complete_labeled_boolean("recursive")]
        return complete(completers, cmd_param_text, full_cmd, *rest)
442630
def get(self, acl):
        
        return self._instance._client.acls.get(self._instance.name, acl)
906202
def _parse_acl_config(self, acl_config):
        
        parsed_acls = dict()
        for acl in acl_config['aclList']:
            parsed_acls[acl['name']] = set()
            for rule in acl['sequence']:
                parsed_acls[acl['name']].add(rule['text'])
        return parsed_acls
772186
def read_acls(self):
        
        group = self[self.sampler_group]['acls']
        return {param: group[param].value for param in group.keys()}
138768
def access_keys(opts):
    '''
    
    '''
    # TODO: Need a way to get all available users for systems not supported by pwd module.
    #       For now users pattern matching will not work for publisher_acl.
    keys = {}
    publisher_acl = opts['publisher_acl']
    acl_users = set(publisher_acl.keys())
    if opts.get('user'):
        acl_users.add(opts['user'])
    acl_users.add(salt.utils.user.get_user())
    for user in acl_users:
        log.info('Preparing the %s key for local communication', user)
        key = mk_key(opts, user)
        if key is not None:
            keys[user] = key

    # Check other users matching ACL patterns
    if opts['client_acl_verify'] and HAS_PWD:
        log.profile('Beginning pwd.getpwall() call in masterapi access_keys function')
        for user in pwd.getpwall():
            user = user.pw_name
            if user not in keys and salt.utils.stringutils.check_whitelist_blacklist(user, whitelist=acl_users):
                keys[user] = mk_key(opts, user)
        log.profile('End pwd.getpwall() call in masterapi access_keys function')

    return keys