def auth_check(self,
                   auth_list,
                   funs,
                   args,
                   tgt,
                   tgt_type='glob',
                   groups=None,
                   publish_validate=False):
        '''
        Returns a bool which defines if the requested function is authorized.
        Used to evaluate the standard structure under external master
        authentication interfaces, like eauth, peer, peer_run, etc.
        '''
        if self.opts.get('auth.enable_expanded_auth_matching', False):
            return self.auth_check_expanded(auth_list, funs, args, tgt, tgt_type, groups, publish_validate)
        if publish_validate:
            v_tgt_type = tgt_type
            if tgt_type.lower() in ('pillar', 'pillar_pcre'):
                v_tgt_type = 'pillar_exact'
            elif tgt_type.lower() == 'compound':
                v_tgt_type = 'compound_pillar_exact'
            v_minions = set(self.check_minions(tgt, v_tgt_type))
            minions = set(self.check_minions(tgt, tgt_type))
            mismatch = bool(minions.difference(v_minions))
            # If the non-exact match gets more minions than the exact match
            # then pillar globbing or PCRE is being used, and we have a
            # problem
            if mismatch:
                return False
        # compound commands will come in a list so treat everything as a list
        if not isinstance(funs, list):
            funs = [funs]
            args = [args]
        try:
            for num, fun in enumerate(funs):
                for ind in auth_list:
                    if isinstance(ind, six.string_types):
                        # Allowed for all minions
                        if self.match_check(ind, fun):
                            return True
                    elif isinstance(ind, dict):
                        if len(ind) != 1:
                            # Invalid argument
                            continue
                        valid = next(six.iterkeys(ind))
                        # Check if minions are allowed
                        if self.validate_tgt(
                            valid,
                            tgt,
                            tgt_type):
                            # Minions are allowed, verify function in allowed list
                            if isinstance(ind[valid], six.string_types):
                                if self.match_check(ind[valid], fun):
                                    return True
                            elif isinstance(ind[valid], list):
                                for cond in ind[valid]:
                                    # Function name match
                                    if isinstance(cond, six.string_types):
                                        if self.match_check(cond, fun):
                                            return True
                                    # Function and args match
                                    elif isinstance(cond, dict):
                                        if len(cond) != 1:
                                            # Invalid argument
                                            continue
                                        fcond = next(six.iterkeys(cond))
                                        # cond: {
                                        #   'mod.func': {
                                        #       'args': [
                                        #           'one.*', 'two\\|three'],
                                        #       'kwargs': {
                                        #           'functioin': 'teach\\|feed',
                                        #           'user': 'mother\\|father'
                                        #           }
                                        #       }
                                        #   }
                                        if self.match_check(fcond,
                                                            fun):  # check key that is function name match
                                            acond = cond[fcond]
                                            if not isinstance(acond, dict):
                                                # Invalid argument
                                                continue
                                            # whitelist args, kwargs
                                            arg_list = args[num]
                                            cond_args = acond.get('args', [])
                                            good = True
                                            for i, cond_arg in enumerate(cond_args):
                                                if len(arg_list) <= i:
                                                    good = False
                                                    break
                                                if cond_arg is None:  # None == '.*' i.e. allow any
                                                    continue
                                                if not self.match_check(cond_arg,
                                                                        arg_list[i]):
                                                    good = False
                                                    break
                                            if not good:
                                                continue
                                            # Check kwargs
                                            cond_kwargs = acond.get('kwargs', {})
                                            arg_kwargs = {}
                                            for a in arg_list:
                                                if isinstance(a,
                                                              dict) and '__kwarg__' in a:
                                                    arg_kwargs = a
                                                    break
                                            for k, v in six.iteritems(cond_kwargs):
                                                if k not in arg_kwargs:
                                                    good = False
                                                    break
                                                if v is None:  # None == '.*' i.e. allow any
                                                    continue
                                                if not self.match_check(v,
                                                                        arg_kwargs[k]):
                                                    good = False
                                                    break
                                            if good:
                                                return True
        except __HOLE__:
            return False
        return False
dataset/ETHPy150Open saltstack/salt/salt/utils/minions.py/CkMinions.auth_check