MCPcopy
hub / github.com/larksuite/cli / resolveDeclaredScopesForCurrentCommand

Function resolveDeclaredScopesForCurrentCommand

cmd/error_auth_hint.go:54–71  ·  view source on GitHub ↗

resolveDeclaredScopesForCurrentCommand returns the scopes declared by the current command for the resolved identity, checking shortcuts first and then service methods from local registry metadata.

(f *cmdutil.Factory)

Source from the content-addressed store, hash-verified

52// current command for the resolved identity, checking shortcuts first and then
53// service methods from local registry metadata.
54func resolveDeclaredScopesForCurrentCommand(f *cmdutil.Factory) []string {
55 if f == nil || f.CurrentCommand == nil {
56 return nil
57 }
58
59 identity := string(f.ResolvedIdentity)
60 if identity == "" {
61 identity = string(core.AsUser)
62 }
63 if identity != string(core.AsUser) && identity != string(core.AsBot) {
64 return nil
65 }
66
67 if scopes := resolveDeclaredShortcutScopes(f.CurrentCommand, identity); len(scopes) > 0 {
68 return scopes
69 }
70 return resolveDeclaredServiceMethodScopes(f.CurrentCommand, identity)
71}
72
73// resolveDeclaredShortcutScopes returns the scopes declared by a mounted
74// shortcut command for the given identity.

Callers 1

Tested by

no test coverage detected