MCPcopy Index your code
hub / github.com/coder/coder / collectAllScopeNames

Function collectAllScopeNames

scripts/apikeyscopesgen/main.go:94–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

92}
93
94func collectAllScopeNames() []string {
95 seen := make(map[string]struct{})
96 var names []string
97 add := func(name string) {
98 if name == "" {
99 return
100 }
101 if _, ok := seen[name]; ok {
102 return
103 }
104 seen[name] = struct{}{}
105 names = append(names, name)
106 }
107
108 for resource, def := range policy.RBACPermissions {
109 if resource == policy.WildcardSymbol {
110 continue
111 }
112 add(resource + ":" + policy.WildcardSymbol)
113 for action := range def.Actions {
114 add(resource + ":" + string(action))
115 }
116 }
117
118 for _, name := range rbac.CompositeScopeNames() {
119 add(name)
120 }
121
122 for _, name := range rbac.BuiltinScopeNames() {
123 s := string(name)
124 if !strings.Contains(s, ":") {
125 continue
126 }
127 add(s)
128 }
129
130 slices.Sort(names)
131 return names
132}
133
134func constNameForScope(name string) string {
135 resource, action := splitRA(name)

Callers 1

generateFunction · 0.85

Calls 3

CompositeScopeNamesFunction · 0.92
BuiltinScopeNamesFunction · 0.92
ContainsMethod · 0.45

Tested by

no test coverage detected