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)
| 52 | // current command for the resolved identity, checking shortcuts first and then |
| 53 | // service methods from local registry metadata. |
| 54 | func 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. |
no test coverage detected