File tree Expand file tree Collapse file tree 5 files changed +11
-5
lines changed Expand file tree Collapse file tree 5 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 1
1
package authztest
2
2
3
+ // PermissionSet defines a set of permissions with the same impact.
3
4
type PermissionSet string
4
5
5
6
const (
Original file line number Diff line number Diff line change @@ -28,4 +28,10 @@ func Test_PermissionSetWPlusSearchSpace(t *testing.T) {
28
28
for k , v := range all {
29
29
fmt .Printf ("%s=%d\n " , string (k ), len (v .All ()))
30
30
}
31
+
32
+ var i int
33
+ wplus .Each (func (set Set ) {
34
+ fmt .Printf ("%d: %s\n " , i , set .String ())
35
+ i ++
36
+ })
31
37
}
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ func (si *unionIterator) Next() bool {
51
51
si .offset = 0
52
52
}
53
53
54
- return si .setIdx >= len (si .sets )
54
+ return si .setIdx < len (si .sets )
55
55
}
56
56
57
57
func (si * unionIterator ) Permissions () Set {
Original file line number Diff line number Diff line change @@ -44,10 +44,6 @@ func (r *Role) Permissions() Set {
44
44
for _ , ps := range r .PermissionSets {
45
45
i += copy (r .buffer [i :], ps .Permissions ())
46
46
}
47
- //all := make(Set, 0, r.ReturnSize)
48
- //for _, set := range r.PermissionSets {
49
- // all = append(all, set.Permissions()...)
50
- //}
51
47
return r .buffer
52
48
}
53
49
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ func (s Set) String() string {
18
18
var str strings.Builder
19
19
sep := ""
20
20
for _ , v := range s {
21
+ if v == nil {
22
+ continue
23
+ }
21
24
str .WriteString (sep )
22
25
str .WriteString (v .String ())
23
26
sep = ", "
You can’t perform that action at this time.
0 commit comments