Verifies that at least one of the values specified in audiences is contained
in the allowedAudiences list.
546986
boolean validateAudience(List<String> allowedAudiences, List<String> audiences) {
		boolean valid = false;

		if (allowedAudiences != null && allowedAudiences.contains(Constants.ALL_AUDIENCES)) {
			return true;
		}
		if (allowedAudiences != null && audiences != null) {
			for (String audience : audiences) {
				for (String allowedAud : allowedAudiences) {
					if (allowedAud.equals(audience)) {
						valid = true;
						break;
					}
				}
			}
		} else if (allowedAudiences == null && (audiences == null || audiences.isEmpty())) {
			valid = true;
		}

		return valid;
	}
1301676
private void validateDebugSettings()
	{

		verifyDiffCheckBox.setSelected(controller.isDiffVerificationEnabled());
		verifyEncodingCheckBox.setSelected(controller
				.isEncodingVerificationEnabled());
		statsOutputCheckBox.setSelected(controller.isStatsOutputEnabled());

		boolean flagA = controller.isDiffVerificationEnabled()
				|| controller.isEncodingVerificationEnabled();

		debugOuputCheckBox.setEnabled(flagA);
		debugOuputCheckBox.setSelected(controller.isDebugOutputEnabled());

		boolean flagB = controller.isDebugOutputEnabled();
		debugOutputLabel.setEnabled(flagA && flagB);
		debugOutputField.setEnabled(flagA && flagB);

	}
141705
private boolean checkMultipleColumnsEditorEnabled() {
        final int size = listEditor.getList().size();
        if (size == 2 && !listEditor.getEditors().isEmpty()) {
            final String cId = listEditor.getEditors().get(0).id().getValue();
            if (!restrictedColumns.contains(cId)) {
                setEditorEnabled(0, true, null);
            }
            return true;
        }
        return false;
    }
1374301
private void verifyPermissionToGrantRoles(Subject subject, Iterable<RoleIdentifier> roleIds) {
        Set<RoleIdentifier> unauthorizedIds = Sets.newTreeSet();
        boolean anyAuthorized = false;

        for (RoleIdentifier roleId : roleIds) {
            // Verify the caller has permission to grant this role
            if (subject.hasPermission(Permissions.grantRole(roleId))) {
                anyAuthorized = true;
            } else {
                unauthorizedIds.add(roleId);
            }
        }

        if (!unauthorizedIds.isEmpty()) {
            // If the caller was not authorized to assign any of the provided roles raise a generic exception, otherwise
            // the exception provides insight as to which roles were unauthorized.  This provides some helpful feedback
            // where appropriate without exposing potentially exploitable information about whether the subject's API key
            // is valid.
            if (!anyAuthorized) {
                throw new UnauthorizedException();
            } else {
                throw new UnauthorizedException("Not authorized for roles: " + Joiner.on(", ").join(unauthorizedIds));
            }
        }
    }
654243
private static <T> boolean containsIdentity(List<T> list, T object) {
		for (T item : list) {
			if (item == object) {
				return true;
			}
		}
		return false;
	}
551736
private void validateArgumentValues()  {
        namedArgumentDefinitions = validatePluginArgumentValues(); // trim the list of plugin-derived argument definitions before validation
        for (final NamedArgumentDefinition argumentDefinition : namedArgumentDefinitions) {
            argumentDefinition.validateValues(this);
        }
        if (positionalArgumentDefinition != null) {
            positionalArgumentDefinition.validateValues(this);
        }
    }
719336
def verify(self, **kwargs):
        
        _spec = self.c_param
        try:
            _allowed = self.c_allowed_values
        except KeyError:
            _allowed = {}

        for (attribute, (typ, required, _, _, na)) in _spec.items():
            if attribute == "*":
                continue

            try:
                val = self._dict[attribute]
            except KeyError:
                if required:
                    raise MissingRequiredAttribute("%s" % attribute)
                continue
            else:
                if typ == bool:
                    pass
                elif not val:
                    if required:
                        raise MissingRequiredAttribute("%s" % attribute)
                    continue

            try:
                _allowed_val = _allowed[attribute]
            except KeyError:
                pass
            else:
                if not self._type_check(typ, _allowed_val, val, na):
                    raise NotAllowedValue(val)

        return True
105914
def validate(self):
        '''
        '''

        self._populate_domain()
        missing = []
        for domain_device in self.domain:
            for truster, trustees in iteritems(self.domain):
                if domain_device not in trustees:
                    missing.append((domain_device, truster, trustees))

        if missing:
            msg = ''
            for item in missing:
                msg += '\n%r is not trusted by %r, which trusts: %r' % \
                    (item[0], item[1], item[2])
            raise DeviceNotTrusted(msg)
        self.device_group = DeviceGroup(
            devices=self.devices,
            device_group_name=self.device_group_name,
            device_group_type=self.device_group_type,
            device_group_partition=self.partition
        )
386398
function verifyOthers() {
      if ( !isTypeString(options.commit) ) {
        errorOption('commit', options.commit);
      }
      if ( !isTypeString(options.tag) ) {
        errorOption('tag', options.tag);
      }
    }
92545
protected function _validateTermsAndConditions()
    {
        $blValid = true;
        $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        if ($oConfig->getConfigParam('blConfirmAGB') && !$oConfig->getRequestParameter('ord_agb')) {
            $blValid = false;
        }

        if ($oConfig->getConfigParam('blEnableIntangibleProdAgreement')) {
            $oBasket = $this->getBasket();

            $blDownloadableProductsAgreement = $oConfig->getRequestParameter('oxdownloadableproductsagreement');
            if ($blValid && $oBasket->hasArticlesWithDownloadableAgreement() && !$blDownloadableProductsAgreement) {
                $blValid = false;
            }

            $blServiceProductsAgreement = $oConfig->getRequestParameter('oxserviceproductsagreement');
            if ($blValid && $oBasket->hasArticlesWithIntangibleAgreement() && !$blServiceProductsAgreement) {
                $blValid = false;
            }
        }

        return $blValid;
    }
188931
def _check_allowed_values(self, parameters):
        
        for key, allowed_values in self.ALLOWED_VALUES:
            self.log([u"Checking allowed values for parameter '%s'", key])
            if key in parameters:
                value = parameters[key]
                if value not in allowed_values:
                    self._failed(u"Parameter '%s' has value '%s' which is not allowed." % (key, value))
                    return
        self.log(u"Passed")
737099
def limited_audience_list(activitable:)
      # The target audience is either a group or a person,
      # which means we can add it as it is in the audience list.
      return [activitable.display_name] unless activitable.is_a?(Circle)

      activitable.contacts.pluck(:display_name)
    end
1213308
def _verify_params(self):
        
        reserved_in_use = self._RESERVED_PARAMS.intersection(self.extra_params)
        if reserved_in_use:
            raise ValueError("Using a reserved parameter", reserved_in_use)
402872
private boolean isPossibleValue(PdfName value, PdfName[] accepted) {
		for (int i = 0; i < accepted.length; i++) {
			if (accepted[i].equals(value)) {
				return true;
			}
		}
		return false;
	}
1190885
def sanity_check(
        state: MediatorTransferState,
        channelidentifiers_to_channels: ChannelMap,
) -> None:
    

    # if a transfer is paid we must know the secret
    all_transfers_states = itertools.chain(
        (pair.payee_state for pair in state.transfers_pair),
        (pair.payer_state for pair in state.transfers_pair),
    )
    if any(state in STATE_TRANSFER_PAID for state in all_transfers_states):
        assert state.secret is not None

    # the "transitivity" for these values is checked below as part of
    # almost_equal check
    if state.transfers_pair:
        first_pair = state.transfers_pair[0]
        assert state.secrethash == first_pair.payer_transfer.lock.secrethash

    for pair in state.transfers_pair:
        payee_channel = get_payee_channel(
            channelidentifiers_to_channels=channelidentifiers_to_channels,
            transfer_pair=pair,
        )

        # Channel could have been removed
        if not payee_channel:
            continue

        assert is_send_transfer_almost_equal(
            send_channel=payee_channel,
            send=pair.payee_transfer,
            received=pair.payer_transfer,
        )
        assert pair.payer_state in pair.valid_payer_states
        assert pair.payee_state in pair.valid_payee_states

    for original, refund in zip(state.transfers_pair[:-1], state.transfers_pair[1:]):
        assert original.payee_address == refund.payer_address
        payer_channel = get_payer_channel(
            channelidentifiers_to_channels=channelidentifiers_to_channels,
            transfer_pair=refund,
        )

        # Channel could have been removed
        if not payer_channel:
            continue

        transfer_sent = original.payee_transfer
        transfer_received = refund.payer_transfer
        assert is_send_transfer_almost_equal(
            send_channel=payer_channel,
            send=transfer_sent,
            received=transfer_received,
        )

    if state.waiting_transfer and state.transfers_pair:
        last_transfer_pair = state.transfers_pair[-1]
        payee_channel = get_payee_channel(
            channelidentifiers_to_channels=channelidentifiers_to_channels,
            transfer_pair=last_transfer_pair,
        )
        # Channel could have been removed
        if payee_channel:
            transfer_sent = last_transfer_pair.payee_transfer
            transfer_received = state.waiting_transfer.transfer

            assert is_send_transfer_almost_equal(
                send_channel=payee_channel,
                send=transfer_sent,
                received=transfer_received,
            )
112705
private function isValidAudienceType(string $audienceType): void
    {
        $allowedAudienceType = $this->getAllowedAudienceType();
        if (!\in_array($audienceType, $allowedAudienceType, true)) {
            throw new InvalidTypeException(sprintf(
                'audienceType must be either "%s".',
                implode(', ', $allowedAudienceType)
            ));
        }
    }
1335229
def CheckDataStoreAccess(self, token, subjects, requested_access="r"):
    """"""
    if any(not x for x in subjects):
      raise ValueError("Subjects list can't contain empty URNs.")
    subjects = list(map(rdfvalue.RDFURN, subjects))

    return (ValidateAccessAndSubjects(requested_access, subjects) and
            ValidateToken(token, subjects) and
            (token.supervisor or
             self._CheckAccessWithHelpers(token, subjects, requested_access)))