We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9981291 commit 3ab32daCopy full SHA for 3ab32da
coderd/authz/authztest/set.go
@@ -11,6 +11,8 @@ type Role struct {
11
PermissionSets []iterator
12
// This is kinda werird, but the first scan should not move anything.
13
first bool
14
+
15
+ buffer []*Permission
16
}
17
18
func (r *Role) Each(ea func(set Set)) {
@@ -33,6 +35,7 @@ func NewRole(sets ...iterable) *Role {
33
35
ReturnSize: retSize,
34
36
Size: size,
37
PermissionSets: setInterfaces,
38
+ buffer: make([]*Permission, retSize),
39
40
41
@@ -56,6 +59,10 @@ func (s *Role) Next() bool {
56
59
57
60
58
61
func (s *Role) Permissions() Set {
62
+ var i int
63
+ for _, set := range s.PermissionSets {
64
+ i += copy(s.buffer[i:], set.Permissions())
65
+ }
66
all := make(Set, 0, s.Size)
67
for _, set := range s.PermissionSets {
68
all = append(all, set.Permissions()...)
0 commit comments