Helper for allow_caveat and deny_caveat.

    It checks that all operation names are valid before creating the caveat.
180216
def _operation_caveat(cond, ops):
    ''' 
    '''
    for op in ops:
        if op.find(' ') != -1:
            return error_caveat('invalid operation name "{}"'.format(op))
    return _first_party(cond, ' '.join(ops))
811727
def process_deny_action(processors, action, argument):
    """"""
    for processor in processors:
        processor(action, argument)
    db.session.commit()
1186725
def verify(operations, loud=False):
    
    everything_ok, roll_call = check(operations, loud=loud)
    if not everything_ok:
        raise CheckFailedException(roll_call)
    return roll_call
703983
private void enforce(ResponseCtx res) {
        @SuppressWarnings("unchecked")
        Set<Result> results = res.getResults();
        for (Result r : results) {
            if (r.getDecision() != Result.DECISION_PERMIT) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Denying access: " + r.getDecision());
                }
                switch (r.getDecision()) {
                    case Result.DECISION_DENY:
                        throw CXFUtility
                                .getFault(new AuthzDeniedException("Deny"));

                    case Result.DECISION_INDETERMINATE:
                        throw CXFUtility
                                .getFault(new AuthzDeniedException("Indeterminate"));
                    case Result.DECISION_NOT_APPLICABLE:
                        throw CXFUtility
                                .getFault(new AuthzDeniedException("NotApplicable"));
                    default:
                }
            }
        }
        if (logger.isDebugEnabled()) {
            logger.debug("Permitting access!");
        }
    }
1046326
def permitted_to! (privilege, object_or_sym = nil, options = {})
      authorization_engine.permit!(privilege, options_for_permit(object_or_sym, options, true))
    end
176920
function validateListFromOptions (opts, name) {
    if (opts.all) return Array.from(supported[name].values())

    let list = opts[name]
    if (!list) {
      if (name === 'arch') {
        list = hostArch()
      } else {
        list = process[name]
      }
    } else if (list === 'all') {
      return Array.from(supported[name].values())
    }

    if (!Array.isArray(list)) {
      if (typeof list === 'string') {
        list = list.split(/,\s*/)
      } else {
        return unsupportedListOption(name, list, supported[name])
      }
    }

    const officialElectronPackages = usingOfficialElectronPackages(opts)

    for (let value of list) {
      if (officialElectronPackages && !supported[name].has(value)) {
        return unsupportedListOption(name, value, supported[name])
      }
    }

    return list
  }
268434
def allow(self, act, obj=None):
        
        objc = obj.components if obj is not None else []
        try:
            return self.tree[act.components + objc] == 'allow'
        except KeyError:
            return False
1075470
def permitted(refresh = false)
      @permitted = nil if refresh
      @permitted ||=
          if require_admin?
            'Administrators Only'
          elsif require_anon?
            'Anonymous Only'
          elsif allow_anon?
            'Everyone'
          elsif groups.any?
            names = groups.pluck(:name).map{|v| "\"#{v}\""}
            'Members of ' +
                if names.count == 1
                  names.first
                elsif names.count == 2
                  names.join(' or ')
                else
                  names[0...-1].join(', ') + ', or ' + names.last
                end
          else
            'All Users'
          end +
              if non_standard
                ' (Non-Standard)'
              else
                ''
              end
    end
347537
function(cName){
        if(validate.isEmpty(cName)){
            validateParams._warn('ignoring invalid coercion name: ' + cName);
        }
        if(validate.isFunction(validateParams.coercions[cName])){
            return validateParams.coercions[cName];
        }else{
            validateParams._warn("no coercion named '" + cName + "' defined - ignoring");
        }
        return undefined;
    }
819553
def allowed(self, method, _dict, allow):
        
        for key in _dict.keys():
            if key not in allow:
                raise LunrError("'%s' is not an argument for method '%s'"
                                % (key, method))
1279773
def allow(self, ctx, acls):
        '''
        '''
        for acl in acls:
            if self._identity == acl:
                return True
        return False
272260
function sanitizeOperatorPosition(opPosition) {
            opPosition = opPosition || OPERATOR_POSITION.before_newline;

            var validPositionValues = Object.values(OPERATOR_POSITION);

            if (!in_array(opPosition, validPositionValues)) {
                throw new Error("Invalid Option Value: The option 'operator_position' must be one of the following values\n" +
                    validPositionValues +
                    "\nYou passed in: '" + opPosition + "'");
            }

            return opPosition;
        }
492281
protected void validateArgumentList(String[] args, boolean supportsTarget, boolean supportsDefaultTarget) {
        checkRequiredArguments(args, !supportsTarget || supportsDefaultTarget);

        // If the command supports a target name
        // skip the first argument if it is the target name.
        int firstArg = 1;
        if (supportsTarget) {
            if (!supportsDefaultTarget) {
                firstArg = 2;
            } else {
                if (args.length > 1) {
                    String primArg = args[1];
                    if (!primArg.startsWith("-"))
                        firstArg = 2;
                }
            }
        }

        // Arguments and values come in pairs (expect -password).
        // Anything outside of that pattern is invalid.
        // Loop through, jumping in pairs except when we encounter
        // -password -- that may be an interactive prompt which won't
        // define a value.
        for (int i = firstArg; i < args.length; i++) {
            String argName = getArgName(args[i]);
            if (!isKnownArgument(argName)) {
                throw new IllegalArgumentException(getMessage("invalidArg", argName));
            }
            // Everything we accept as an arg expects an name=value pair.
            // If we see anything without the =value pair, error
            if (!args[i].contains("=")) {
                throw new IllegalArgumentException(getMessage("missingValue", argName));
            }
        }
    }
151754
def _validate_options(self):
        '''
        
        '''
        if self.obfuscate_hostname and not self.obfuscate:
            raise ValueError(
                'Option `obfuscate_hostname` requires `obfuscate`')
        if self.analyze_image_id is not None and len(self.analyze_image_id) < 12:
            raise ValueError(
                'Image/Container ID must be at least twelve characters long.')
        if self.enable_schedule and self.disable_schedule:
            raise ValueError(
                'Conflicting options: --enable-schedule and --disable-schedule')
        if self.analyze_container and (self.register or self.unregister):
            raise ValueError('Registration not supported with '
                             'image or container analysis.')
        if self.to_json and self.to_stdout:
            raise ValueError(
                'Conflicting options: --to-stdout and --to-json')
        if self.payload and not self.content_type:
            raise ValueError(
                '--payload requires --content-type')
        if not self.legacy_upload:
            if self.group:
                raise ValueError(
                    '--group is not supported at this time.')
            if self.analyze_image_id:
                raise ValueError(
                    '--analyze-image-id is not supported at this time.')
            if self.analyze_file:
                raise ValueError(
                    '--analyze-file is not supported at this time.')
            if self.analyze_mountpoint:
                raise ValueError(
                    '--analyze-mountpoint is not supported at this time.')
            if self.analyze_container:
                raise ValueError(
                    '--analyze-container is not supported at this time.')
418890
def check_restrictions(restrictions, element, keys, verbose):
    
    params = OrderedDict(zip(keys, element))
    for restrict in restrictions:
        if not eval(replace_param_occurrences(restrict, params)):
            if verbose:
                print("skipping config", get_instance_string(params), "reason: config fails restriction")
            return False
    return True
726248
def opt_allow_select_scan(self, allow):
        
        allow = allow.lower() in ("true", "t", "yes", "y")
        self.conf["allow_select_scan"] = allow
        self.engine.allow_select_scan = allow
422211
def _passes_filter(self, proxy):


        '''  '''
        
        ''' validate proxy based on provided filters '''
        if self.allowed_countries is not None and proxy['country'] not in self.allowed_countries:
            return False
        if self.denied_countries is not None and  proxy['country'] in self.denied_countries:
            return False
        if self.https_only and proxy['https'] == False:
            return False

        if not self.all_ports and str(proxy.port) not in self.ports:
            return False

        return True