// hasCapability takes a path and returns whether the token has at least one of
// the required capabilities on the given path. It also returns the set of
// capabilities the token does have as well as any error that occurred.
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
}
490330
func (c *Config) HasTokenAuth() bool {
	return len(c.BearerToken) != 0 || len(c.BearerTokenFile) != 0
}
634009
func (s *IdentityServer) Capabilities(
	ctx context.Context,
	req *api.SdkIdentityCapabilitiesRequest,
) (*api.SdkIdentityCapabilitiesResponse, error) {

	capCluster := &api.SdkServiceCapability{
		Type: &api.SdkServiceCapability_Service{
			Service: &api.SdkServiceCapability_OpenStorageService{
				Type: api.SdkServiceCapability_OpenStorageService_CLUSTER,
			},
		},
	}
	capCloudBackup := &api.SdkServiceCapability{
		Type: &api.SdkServiceCapability_Service{
			Service: &api.SdkServiceCapability_OpenStorageService{
				Type: api.SdkServiceCapability_OpenStorageService_CLOUD_BACKUP,
			},
		},
	}
	capCredentials := &api.SdkServiceCapability{
		Type: &api.SdkServiceCapability_Service{
			Service: &api.SdkServiceCapability_OpenStorageService{
				Type: api.SdkServiceCapability_OpenStorageService_CREDENTIALS,
			},
		},
	}
	capNode := &api.SdkServiceCapability{
		Type: &api.SdkServiceCapability_Service{
			Service: &api.SdkServiceCapability_OpenStorageService{
				Type: api.SdkServiceCapability_OpenStorageService_NODE,
			},
		},
	}
	capObjectStorage := &api.SdkServiceCapability{
		Type: &api.SdkServiceCapability_Service{
			Service: &api.SdkServiceCapability_OpenStorageService{
				Type: api.SdkServiceCapability_OpenStorageService_OBJECT_STORAGE,
			},
		},
	}
	capSchedulePolicy := &api.SdkServiceCapability{
		Type: &api.SdkServiceCapability_Service{
			Service: &api.SdkServiceCapability_OpenStorageService{
				Type: api.SdkServiceCapability_OpenStorageService_SCHEDULE_POLICY,
			},
		},
	}
	capVolume := &api.SdkServiceCapability{
		Type: &api.SdkServiceCapability_Service{
			Service: &api.SdkServiceCapability_OpenStorageService{
				Type: api.SdkServiceCapability_OpenStorageService_VOLUME,
			},
		},
	}
	capAlerts := &api.SdkServiceCapability{
		Type: &api.SdkServiceCapability_Service{
			Service: &api.SdkServiceCapability_OpenStorageService{
				Type: api.SdkServiceCapability_OpenStorageService_ALERTS,
			},
		},
	}
	capMountAttach := &api.SdkServiceCapability{
		Type: &api.SdkServiceCapability_Service{
			Service: &api.SdkServiceCapability_OpenStorageService{
				Type: api.SdkServiceCapability_OpenStorageService_MOUNT_ATTACH,
			},
		},
	}
	capRole := &api.SdkServiceCapability{
		Type: &api.SdkServiceCapability_Service{
			Service: &api.SdkServiceCapability_OpenStorageService{
				Type: api.SdkServiceCapability_OpenStorageService_ROLE,
			},
		},
	}
	capClusterPair := &api.SdkServiceCapability{
		Type: &api.SdkServiceCapability_Service{
			Service: &api.SdkServiceCapability_OpenStorageService{
				Type: api.SdkServiceCapability_OpenStorageService_CLUSTER_PAIR,
			},
		},
	}
	capMigrate := &api.SdkServiceCapability{
		Type: &api.SdkServiceCapability_Service{
			Service: &api.SdkServiceCapability_OpenStorageService{
				Type: api.SdkServiceCapability_OpenStorageService_MIGRATE,
			},
		},
	}
	capStoragePolicy := &api.SdkServiceCapability{
		Type: &api.SdkServiceCapability_Service{
			Service: &api.SdkServiceCapability_OpenStorageService{
				Type: api.SdkServiceCapability_OpenStorageService_STORAGE_POLICY,
			},
		},
	}
	return &api.SdkIdentityCapabilitiesResponse{
		Capabilities: []*api.SdkServiceCapability{
			capCluster,
			capCloudBackup,
			capCredentials,
			capNode,
			capObjectStorage,
			capSchedulePolicy,
			capVolume,
			capAlerts,
			capMountAttach,
			capRole,
			capClusterPair,
			capMigrate,
			capStoragePolicy,
		},
	}, nil
}
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
	}
}
367008
func WithCapabilities(caps ...Capability) Opts {
	return func(c *config) error {
		c.Capabilities = append(c.Capabilities, caps...)
		return nil
	}
}
1030358
func (c *Client) CapAvailable(capName string) bool {
	return c.caps[capName].Available
}
978446
func (s *PluginConstraints) Allows(v Version) bool {
	return s.Versions.Allows(v)
}
1217691
func (r *Rule) HasResource(resource string) bool {
	for _, r := range r.Resources {
		if r == resource {
			return true
		}
	}
	return false
}
44661
func (ac *ApplicationConfig) Capabilities() ApplicationCapabilities {
	return capabilities.NewApplicationProvider(ac.protos.Capabilities.Capabilities)
}
313677
func (a *MinMaxAllocator) Has(i int) bool {
	a.lock.Lock()
	defer a.lock.Unlock()

	return a.has(i)
}
94014
func (c ReachabilityClient) CheckReachability(ctx context.Context) (res Reachability, err error) {
	err = c.Cli.Call(ctx, "keybase.1.reachability.checkReachability", []interface{}{CheckReachabilityArg{}}, &res)
	return
}
1094520
func (c *Config) Has(name string, idx int, options ...Option) (bool, error) {
	opts := makeOptions(options)
	p := parsePathIdx(name, opts.pathSep, idx)
	return p.Has(c, opts)
}
4975
func hasPath(data map[string]interface{}, key string) bool {
	_, ok := data[key]
	return ok
}
1120364
func (r *NodeAuthorizer) hasPathFrom(nodeName string, startingType vertexType, startingNamespace, startingName string) (bool, error) {
	r.graph.lock.RLock()
	defer r.graph.lock.RUnlock()

	nodeVertex, exists := r.graph.getVertex_rlocked(nodeVertexType, "", nodeName)
	if !exists {
		return false, fmt.Errorf("unknown node %q cannot get %s %s/%s", nodeName, vertexTypes[startingType], startingNamespace, startingName)
	}

	startingVertex, exists := r.graph.getVertex_rlocked(startingType, startingNamespace, startingName)
	if !exists {
		return false, fmt.Errorf("node %q cannot get unknown %s %s/%s", nodeName, vertexTypes[startingType], startingNamespace, startingName)
	}

	// Fast check to see if we know of a destination edge
	if r.graph.destinationEdgeIndex[startingVertex.ID()].has(nodeVertex.ID()) {
		return true, nil
	}

	found := false
	traversal := &traverse.VisitingDepthFirst{
		EdgeFilter: func(edge graph.Edge) bool {
			if destinationEdge, ok := edge.(*destinationEdge); ok {
				if destinationEdge.DestinationID() != nodeVertex.ID() {
					// Don't follow edges leading to other nodes
					return false
				}
				// We found an edge leading to the node we want
				found = true
			}
			// Visit this edge
			return true
		},
	}
	traversal.Walk(r.graph.graph, startingVertex, func(n graph.Node) bool {
		if n.ID() == nodeVertex.ID() {
			// We found the node we want
			found = true
		}
		// Stop visiting if we've found the node we want
		return found
	})
	if !found {
		return false, fmt.Errorf("node %q cannot get %s %s/%s, no relationship to this object was found in the node authorizer graph", nodeName, vertexTypes[startingType], startingNamespace, startingName)
	}
	return true, nil
}
1350206
func (p *Path) HasFilter(via interface{}, rev bool, filt ...shape.ValueFilter) *Path {
	np := p.clone()
	np.stack = append(np.stack, hasFilterMorphism(via, rev, filt))
	return np
}
457152
func (c *Client) Support(cap string) (bool, error) {
	c.locker.Lock()
	ok := c.caps != nil
	c.locker.Unlock()

	// If capabilities are not cached, request them
	if !ok {
		if _, err := c.Capability(); err != nil {
			return false, err
		}
	}

	c.locker.Lock()
	supported := c.caps[cap]
	c.locker.Unlock()
	return supported, nil
}
854087
func (c *Connect) GetCapabilities() (string, error) {
	var err C.virError
	str := C.virConnectGetCapabilitiesWrapper(c.ptr, &err)
	if str == nil {
		return "", makeError(&err)
	}
	capabilities := C.GoString(str)
	C.free(unsafe.Pointer(str))
	return capabilities, nil
}