Checks that the given access flags do not contain invalid flags. This
method also checks that mutually incompatible flags are not set
simultaneously.

@param access
the access flags to be checked
@param possibleAccess
the valid access flags.
337035
static void checkAccess(final int access, final int possibleAccess) {
        if ((access & ~possibleAccess) != 0) {
            throw new IllegalArgumentException("Invalid access flags: "
                    + access);
        }
        int pub = (access & Opcodes.ACC_PUBLIC) == 0 ? 0 : 1;
        int pri = (access & Opcodes.ACC_PRIVATE) == 0 ? 0 : 1;
        int pro = (access & Opcodes.ACC_PROTECTED) == 0 ? 0 : 1;
        if (pub + pri + pro > 1) {
            throw new IllegalArgumentException(
                    "public private and protected are mutually exclusive: "
                            + access);
        }
        int fin = (access & Opcodes.ACC_FINAL) == 0 ? 0 : 1;
        int abs = (access & Opcodes.ACC_ABSTRACT) == 0 ? 0 : 1;
        if (fin + abs > 1) {
            throw new IllegalArgumentException(
                    "final and abstract are mutually exclusive: " + access);
        }
    }
292794
public ExpiryPolicyBuilder<K, V> access(Duration access) {
    if (access != null && access.isNegative()) {
      throw new IllegalArgumentException("Access duration must be positive");
    }
    return access((a, b) -> access);
  }
1171017
protected void checkAccess()
        throws EFapsException
    {
        for (final Instance instance : getInstances()) {
            if (!instance.getType().hasAccess(instance, AccessTypeEnums.DELETE.getAccessType(), null)) {
                LOG.error("Delete not permitted for Person: {} on Instance: {}", Context.getThreadContext().getPerson(),
                                instance);
                throw new EFapsException(getClass(), "execute.NoAccess", instance);
            }
        }
    }
942119
protected function parseAccess($access)
    {
        $parts = explode(':', $access, 2);
        if (count($parts) != 2) {
            $message = sprintf(
                'Access "<error>%s</error>" is not valid, please use the format: permission:address',
                $access
            );
            throw new InvalidArgumentException($message);
        }

        if (!in_array($parts[0], ['allow', 'deny'])) {
            $message = sprintf(
                "The permission type '<error>%s</error>' is not valid; it must be one of 'allow' or 'deny'",
                $parts[0]
            );
            throw new InvalidArgumentException($message);
        }

        list($permission, $address) = $parts;

        $this->validateAddress($address);

        // Normalize the address so that we can compare accurately with the
        // current value returned from the API.
        if ($address == 'any') {
            $address = '0.0.0.0/0';
        } elseif ($address && !strpos($address, '/')) {
            $address .= '/32';
        }

        return ["address" => $address, "permission" => $permission];
    }
1023798
public static String toStringAccess(int access) throws ApplicationException {
	String res = toStringAccess(access, null);
	if (res != null) return res;
	throw new ApplicationException(
		"invalid access type [" + access + "], access types are Component.ACCESS_PACKAGE, Component.ACCESS_PRIVATE, Component.ACCESS_PUBLIC, Component.ACCESS_REMOTE");
    }
1172680
private boolean hasViewPermissionWorkaroundForNonExistantPipelineBug_4477(CaseInsensitiveString pipelineName, Username username) {
        if (!goConfigService.hasPipelineNamed(pipelineName)) {
            throw new RecordNotFoundException(Pipeline, pipelineName);
        }

        if (securityService.isUserAdmin(username)) {
            return true;
        }

        // we check if pipeline exists because this method returns true in case the group or pipeline does not exist!
        return securityService.hasViewPermissionForPipeline(username, pipelineName.toString());
    }
535210
public final void checkApplicableIn(ItemGroup parent) {
        if (!isApplicableIn(parent)) {
            throw new AccessDeniedException(
                    Messages.TopLevelItemDescriptor_NotApplicableIn(getDisplayName(), parent.getFullDisplayName()));
        }
    }
326174
protected boolean shouldAuthorize(Authentication authentication, Authorizable controlledObject)
    {
        Assert.state(getAccessDecisionManager() != null, "The AccessDecisionManager can not be null!");
        boolean authorize = false;
        try
        {
            if (authentication != null)
            {
                List<ConfigAttribute> cad = getConfigAttributeDefinition(controlledObject);
                if (cad != null)
                {
                    getAccessDecisionManager().decide(authentication, null, cad);
                }
                authorize = true;
            } else {
                // authentication must be disabled, going through
                authorize = true;
            }
        }
        catch (AccessDeniedException e)
        {
            authorize = false;
            // This means the secured objects should not be authorized
        }
        return authorize;
    }
814094
def _IsUnparsedFlagAccessAllowed(self, name):
    """"""
    if _UNPARSED_FLAG_ACCESS_ENV_NAME in os.environ:
      # We've been told explicitly what to do.
      allow_unparsed_flag_access = (
          os.getenv(_UNPARSED_FLAG_ACCESS_ENV_NAME) == '1')
    elif self.__dict__['__reset_called']:
      # Raise exception if .Reset() was called. This mostly happens in tests.
      allow_unparsed_flag_access = False
    elif _helpers.IsRunningTest():
      # Staged "rollout", based on name of the flag so that we don't break
      # everyone.  Hashing the flag is a way of choosing a random but
      # consistent subset of flags to lock down which we can make larger
      # over time.
      name_bytes = name.encode('utf8') if not isinstance(name, bytes) else name
      flag_percentile = (
          struct.unpack('<I', hashlib.md5(name_bytes).digest()[:4])[0] % 100)
      allow_unparsed_flag_access = (
          _UNPARSED_ACCESS_DISABLED_PERCENT <= flag_percentile)
    else:
      allow_unparsed_flag_access = True
    return allow_unparsed_flag_access
53824
private boolean checkForAddOnAccess() {
        Class[] classContext = getClassContext();
        for (Class clazz : classContext) {
            if (clazz.getClassLoader() instanceof IzouPluginClassLoader) {
                return true;
            }
        }
        return false;
    }
219610
@SuppressWarnings("unchecked")
    public Map<Instance, Boolean> checkAccess(final Collection<Instance> _instances,
                                              final AccessType _accessType)
        throws EFapsException
    {
        Map<Instance, Boolean> ret = new HashMap<>();
        if (_instances != null && !_instances.isEmpty() && _instances.size() == 1) {
            final Instance instance = _instances.iterator().next();
            ret.put(instance, hasAccess(instance, _accessType));
        } else {
            final List<EventDefinition> events = super.getEvents(EventType.ACCESSCHECK);
            if (events != null) {
                final Parameter parameter = new Parameter();
                parameter.put(ParameterValues.OTHERS, _instances);
                parameter.put(ParameterValues.ACCESSTYPE, _accessType);
                parameter.put(ParameterValues.CLASS, this);
                for (final EventDefinition event : events) {
                    final Return retrn = event.execute(parameter);
                    ret = (Map<Instance, Boolean>) retrn.get(ReturnValues.VALUES);
                }
            } else {
                for (final Instance instance : _instances) {
                    ret.put(instance, true);
                }
            }
        }
        return ret;
    }
912909
public static int toIntAccess(String access) throws ApplicationException {
	access = StringUtil.toLowerCase(access.trim());
	if (access.equals("package")) return Component.ACCESS_PACKAGE;
	else if (access.equals("private")) return Component.ACCESS_PRIVATE;
	else if (access.equals("public")) return Component.ACCESS_PUBLIC;
	else if (access.equals("remote")) return Component.ACCESS_REMOTE;
	throw new ApplicationException("invalid access type [" + access + "], access types are remote, public, package, private");

    }
1143545
public static boolean hasIssues(FhirContext theCtx, IBaseOperationOutcome theOutcome) {
		if (theOutcome == null) {
			return false;
		}
		RuntimeResourceDefinition ooDef = theCtx.getResourceDefinition(theOutcome);
		BaseRuntimeChildDefinition issueChild = ooDef.getChildByName("issue");
		return issueChild.getAccessor().getValues(theOutcome).size() > 0;
	}
71543
public static boolean isGroupAccessId(String accessId) {
        return isAccessId(accessId) && accessId.startsWith(AccessIdUtil.TYPE_GROUP + AccessIdUtil.TYPE_SEPARATOR);
    }
62196
private boolean isSpecialFlagSet(final OptionSet parsedArguments, final String flagName){
        if (parsedArguments.has(flagName)){
            Object value = parsedArguments.valueOf(flagName);
            return  (value == null || !value.equals("false"));
        } else{
            return false;
        }
    }
195737
private void checkAccess()
        throws EFapsException
    {
        // check the access for the given instances
        final Map<Instance, Boolean> accessmap = new HashMap<Instance, Boolean>();
        for (final Entry<Type, List<Instance>> entry : this.typeMapping.entrySet()) {
            accessmap.putAll(entry.getKey().checkAccess(entry.getValue(), AccessTypeEnums.SHOW.getAccessType()));
        }
        this.elements.entrySet().removeIf(entry -> accessmap.size() > 0 && (!accessmap.containsKey(entry.getKey())
                        || !accessmap.get(entry.getKey())));
    }
192095
public R setAccess(BoxSharedLink.Access access) {
        JsonObject jsonObject = getSharedLinkJsonObject();
        jsonObject.add(BoxSharedLink.FIELD_ACCESS, SdkUtils.getAsStringSafely(access));
        BoxSharedLink sharedLink = new BoxSharedLink(jsonObject);
        mBodyMap.put(BoxItem.FIELD_SHARED_LINK, sharedLink);
        return (R) this;
    }