Files
larksuite-cli/internal/auth/scope.go
梁硕 83dfb068ad feat: open-source lark-cli — the official CLI for Lark/Feishu
Change-Id: I113d9cdb5403cec347efe4595415e34a18b7decf
2026-03-28 10:36:25 +08:00

23 lines
594 B
Go

// Copyright (c) 2026 Lark Technologies Pte. Ltd.
// SPDX-License-Identifier: MIT
package auth
import "strings"
// MissingScopes returns the elements of required that are absent from storedScope.
// storedScope is a space-separated list of granted scope strings (as stored in the token).
func MissingScopes(storedScope string, required []string) []string {
granted := make(map[string]bool)
for _, s := range strings.Fields(storedScope) {
granted[s] = true
}
var missing []string
for _, s := range required {
if !granted[s] {
missing = append(missing, s)
}
}
return missing
}