package storepkg import "slices" // AllowedTools intersects a profile's tools with accepted package authority. // Nil means unrestricted; a non-nil empty slice means no tools. func AllowedTools(profile []string, packaged bool, accepted []string) []string { if !packaged { if len(profile) == 0 { return nil } return slices.Clone(profile) } allowed := []string{} for _, name := range accepted { if len(profile) == 0 || slices.Contains(profile, name) { allowed = append(allowed, name) } } return allowed }