func (s *Server) filterACL(token string, subj interface{}) error {
	// Get the ACL from the token
	acl, err := s.resolveToken(token)
	if err != nil {
		return err
	}

	// Fast path if ACLs are not enabled
	if acl == nil {
		return nil
	}

	// Create the filter
	filt := newACLFilter(acl, s.logger, s.config.ACLEnforceVersion8)

	switch v := subj.(type) {
	case *structs.CheckServiceNodes:
		filt.filterCheckServiceNodes(v)

	case *structs.IndexedCheckServiceNodes:
		filt.filterCheckServiceNodes(&v.Nodes)

	case *structs.IndexedCoordinates:
		filt.filterCoordinates(&v.Coordinates)

	case *structs.IndexedHealthChecks:
		filt.filterHealthChecks(&v.HealthChecks)

	case *structs.IndexedNodeDump:
		filt.filterNodeDump(&v.Dump)

	case *structs.IndexedNodes:
		filt.filterNodes(&v.Nodes)

	case *structs.IndexedNodeServices:
		filt.filterNodeServices(&v.NodeServices)

	case *structs.IndexedServiceNodes:
		filt.filterServiceNodes(&v.ServiceNodes)

	case *structs.IndexedServices:
		filt.filterServices(v.Services)

	case *structs.IndexedSessions:
		filt.filterSessions(&v.Sessions)

	case *structs.IndexedPreparedQueries:
		filt.filterPreparedQueries(&v.Queries)

	case **structs.PreparedQuery:
		filt.redactPreparedQueryTokens(v)

	default:
		panic(fmt.Errorf("Unhandled type passed to ACL filter: %#v", subj))
	}

	return nil
}
// filterACL is used to filter results from our service catalog based on the
// rules configured for the provided token. The subject is scrubbed and
// modified in-place, leaving only resources the token can access.
filterACL is used to filter results from our service catalog based on the
rules configured for the provided token. The subject is scrubbed and
modified in-place, leaving only resources the token can access.
// filterACL is used to filter results from our service catalog based on the // rules configured for the provided token . The subject is scrubbed and // modified in - place leaving only resources the token can access .
func (s *Server) filterACL(token string, subj interface{}) error {
	acl, err := s.resolveToken(token)
	if err != nil {
		return err
	}
	if acl == nil {
		return nil
	}
	filt := newACLFilter(acl, s.logger, s.config.ACLEnforceVersion8)
	switch v := subj.(type) {
	case *structs.CheckServiceNodes:
		filt.filterCheckServiceNodes(v)
	case *structs.IndexedCheckServiceNodes:
		filt.filterCheckServiceNodes(&v.Nodes)
	case *structs.IndexedCoordinates:
		filt.filterCoordinates(&v.Coordinates)
	case *structs.IndexedHealthChecks:
		filt.filterHealthChecks(&v.HealthChecks)
	case *structs.IndexedNodeDump:
		filt.filterNodeDump(&v.Dump)
	case *structs.IndexedNodes:
		filt.filterNodes(&v.Nodes)
	case *structs.IndexedNodeServices:
		filt.filterNodeServices(&v.NodeServices)
	case *structs.IndexedServiceNodes:
		filt.filterServiceNodes(&v.ServiceNodes)
	case *structs.IndexedServices:
		filt.filterServices(v.Services)
	case *structs.IndexedSessions:
		filt.filterSessions(&v.Sessions)
	case *structs.IndexedPreparedQueries:
		filt.filterPreparedQueries(&v.Queries)
	case **structs.PreparedQuery:
		filt.redactPreparedQueryTokens(v)
	default:
		panic(fmt.Errorf("Unhandled type passed to ACL filter: %#v", subj))
	}
	return nil
}
func ( s * Server ) filterACL ( token string , subj interface { } ) error { acl , err := s . resolveToken ( token ) if err != nil { return err } if acl == nil { return nil } filt := newACLFilter ( acl , s . logger , s . config . ACLEnforceVersion8 ) switch v := subj . ( type ) { case * structs . CheckServiceNodes : filt . filterCheckServiceNodes ( v ) case * structs . IndexedCheckServiceNodes : filt . filterCheckServiceNodes ( & v . Nodes ) case * structs . IndexedCoordinates : filt . filterCoordinates ( & v . Coordinates ) case * structs . IndexedHealthChecks : filt . filterHealthChecks ( & v . HealthChecks ) case * structs . IndexedNodeDump : filt . filterNodeDump ( & v . Dump ) case * structs . IndexedNodes : filt . filterNodes ( & v . Nodes ) case * structs . IndexedNodeServices : filt . filterNodeServices ( & v . NodeServices ) case * structs . IndexedServiceNodes : filt . filterServiceNodes ( & v . ServiceNodes ) case * structs . IndexedServices : filt . filterServices ( v . Services ) case * structs . IndexedSessions : filt . filterSessions ( & v . Sessions ) case * structs . IndexedPreparedQueries : filt . filterPreparedQueries ( & v . Queries ) case * * structs . PreparedQuery : filt . redactPreparedQueryTokens ( v ) default : panic ( fmt . Errorf ( " " , subj ) ) } return nil }
filterACL is used to filter results from our service catalog based on the
rules configured for the provided token.
filterACL is used to filter results from our service catalog based on the rules configured for the provided token .
// Get the ACL from the token // Fast path if ACLs are not enabled // Create the filter