File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ type Role struct {
11
11
PermissionSets []iterator
12
12
// This is kinda werird, but the first scan should not move anything.
13
13
first bool
14
+
15
+ buffer []* Permission
14
16
}
15
17
16
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 ,
35
37
PermissionSets : setInterfaces ,
38
+ buffer : make ([]* Permission , retSize ),
36
39
}
37
40
}
38
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
+ }
59
66
all := make (Set , 0 , s .Size )
60
67
for _ , set := range s .PermissionSets {
61
68
all = append (all , set .Permissions ()... )
You can’t perform that action at this time.
0 commit comments