// HasCapability returns true if the capability is supported by this binary.
6378
func (ap *ApplicationProvider) HasCapability(capability string) bool {
	switch capability {
	// Add new capability names here
	case ApplicationV1_1:
		return true
	case ApplicationV1_2:
		return true
	case ApplicationV1_3:
		return true
	case ApplicationPvtDataExperimental:
		return true
	case ApplicationResourcesTreeExperimental:
		return true
	default:
		return false
	}
}
951271
func hasCap(needle core.Capability, haystack []core.Capability) bool {
	for _, c := range haystack {
		if needle == c {
			return true
		}
	}
	return false
}
1102448
func isScannable(t reflect.Type) bool {
	if reflect.PtrTo(t).Implements(_unmarshallerInterface) {
		return true
	}
	if t.Kind() != reflect.Struct {
		return true
	}

	// it's not important that we use the right mapper for this particular object,
	// we're only concerned on how many exported fields this struct has
	m := DefaultMapper

	return len(m.TypeMap(t).Index) == 0
}
1279149
func (v *Value) HasContainer() bool {
	return v.Container != nil && *v.Container != "" && *v.Container != instance.NONE
}
1338632
func HasCapabilitiesRequest(container *v1.Container) bool {
	if container.SecurityContext == nil {
		return false
	}
	if container.SecurityContext.Capabilities == nil {
		return false
	}
	return len(container.SecurityContext.Capabilities.Add) > 0 || len(container.SecurityContext.Capabilities.Drop) > 0
}
466933
func (c *Core) Capabilities(ctx context.Context, token, path string) ([]string, error) {
	if path == "" {
		return nil, &logical.StatusBadRequest{Err: "missing path"}
	}

	if token == "" {
		return nil, &logical.StatusBadRequest{Err: "missing token"}
	}

	te, err := c.tokenStore.Lookup(ctx, token)
	if err != nil {
		return nil, err
	}
	if te == nil {
		return nil, &logical.StatusBadRequest{Err: "invalid token"}
	}

	tokenNS, err := NamespaceByID(ctx, te.NamespaceID, c)
	if err != nil {
		return nil, err
	}
	if tokenNS == nil {
		return nil, namespace.ErrNoNamespace
	}

	var policyCount int
	policyNames := make(map[string][]string)
	policyNames[tokenNS.ID] = te.Policies
	policyCount += len(te.Policies)

	entity, identityPolicies, err := c.fetchEntityAndDerivedPolicies(ctx, tokenNS, te.EntityID)
	if err != nil {
		return nil, err
	}
	if entity != nil && entity.Disabled {
		c.logger.Warn("permission denied as the entity on the token is disabled")
		return nil, logical.ErrPermissionDenied
	}
	if te.EntityID != "" && entity == nil {
		c.logger.Warn("permission denied as the entity on the token is invalid")
		return nil, logical.ErrPermissionDenied
	}

	for nsID, nsPolicies := range identityPolicies {
		policyNames[nsID] = append(policyNames[nsID], nsPolicies...)
		policyCount += len(nsPolicies)
	}

	if policyCount == 0 {
		return []string{DenyCapability}, nil
	}

	// Construct the corresponding ACL object. ACL construction should be
	// performed on the token's namespace.
	tokenCtx := namespace.ContextWithNamespace(ctx, tokenNS)
	acl, err := c.policyStore.ACL(tokenCtx, entity, policyNames)
	if err != nil {
		return nil, err
	}

	capabilities := acl.Capabilities(ctx, path)
	sort.Strings(capabilities)
	return capabilities, nil
}
47508
func (i *info) IsUnavailable() bool {
	i.m.RLock()
	res := i.available != nil
	i.m.RUnlock()
	return res
}
376486
func (s *storeImpl) HasVirtualIP(ctx datastore.Context, poolID, virtualIP string) (bool, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("PoolStore.HasVirtualIP"))
	if poolID = strings.TrimSpace(poolID); poolID == "" {
		return false, errors.New("empty pool id not allowed")
	} else if virtualIP = strings.TrimSpace(virtualIP); virtualIP == "" {
		return false, errors.New("empty virtual ip not allowed")
	}

	search := search.Search("controlplane").Type(kind).Filter(
		"and",
		search.Filter().Terms("ID", poolID),
		search.Filter().Terms("VirtualIPs.IP", virtualIP),
	)

	results, err := datastore.NewQuery(ctx).Execute(search)
	if err != nil {
		return false, err
	}
	return results.Len() > 0, nil
}
764709
func (v *vaultClient) hasCapability(path string, required []string) (bool, []string, error) {
	caps, err := v.client.Sys().CapabilitiesSelf(path)
	if err != nil {
		return false, nil, err
	}
	for _, c := range caps {
		for _, r := range required {
			if c == r {
				return true, caps, nil
			}
		}
	}
	return false, caps, nil
}
1133314
func (e *lxdStorageProvider) Supports(k storage.StorageKind) bool {
	return k == storage.StorageKindFilesystem
}
306371
func (apic *APICache) IsEnabled() bool {
	enabled, ok := apic.isEnabled.Load().(bool)
	return ok && enabled
}
146155
func (c *configuration) canApply(t transition) bool {

	var h head
	if t.Move == Left || t.Move == Right {
		if t.Move == Left {
			h = c.stackValue(0)
		} else {
			h = c.stackValue(1)
		}

		if h < 0 {
			return false
		}
		if h == 0 && t.DependencyType != lingo.Root {
			return false
		}
	}

	stackSize := c.stackSize()
	bufferSize := c.bufferSize()

	if t.Move == Left {
		return stackSize > 2
	}

	if t.Move == Right {
		return stackSize > 2 || (stackSize == 2 && bufferSize == 0)

		// if not single root build
		// return stackSize >= 2
	}

	return bufferSize > 0 // strange other thing...

}
63008
func HasChrootCapability() bool {
	// Checking the capabilities should be enough, but in case there're
	// problem retrieving them, fallback checking for the effective uid
	// (hoping it hasn't dropped its CAP_SYS_CHROOT).
	caps, err := capability.NewPid(0)
	if err == nil {
		return caps.Get(capability.EFFECTIVE, capability.CAP_SYS_CHROOT)
	} else {
		return os.Geteuid() == 0
	}
}
313677
func (a *MinMaxAllocator) Has(i int) bool {
	a.lock.Lock()
	defer a.lock.Unlock()

	return a.has(i)
}
198523
func (s *UpdateStackInput) SetCapabilities(v []*string) *UpdateStackInput {
	s.Capabilities = v
	return s
}
1219408
func (l *List) Supports(capability Capability) bool {
	_, ok := l.m[capability]
	return ok
}
592847
func (cfg *MockChannelCfg) HasCapability(group fab.ConfigGroupKey, capability string) bool {
	capabilities, ok := cfg.MockCapabilities[group]
	if !ok {
		return false
	}
	return capabilities[capability]
}