| Index: tokenserver/appengine/utils/identityset/identityset.go
|
| diff --git a/tokenserver/appengine/utils/identityset/identityset.go b/tokenserver/appengine/utils/identityset/identityset.go
|
| index d37476987e3f4ef8cd2a3a4669dc8363e5c51f26..f126e296c8b584969a1db87fbe311a392bdf19e6 100644
|
| --- a/tokenserver/appengine/utils/identityset/identityset.go
|
| +++ b/tokenserver/appengine/utils/identityset/identityset.go
|
| @@ -7,6 +7,7 @@ package identityset
|
|
|
| import (
|
| "fmt"
|
| + "sort"
|
| "strings"
|
|
|
| "golang.org/x/net/context"
|
| @@ -151,6 +152,27 @@ func (s *Set) IsSuperset(subset *Set) bool {
|
| return subset.IsSubset(s)
|
| }
|
|
|
| +// ToStrings returns a sorted list of strings representing this set.
|
| +//
|
| +// See 'FromStrings' for the format of this list.
|
| +func (s *Set) ToStrings() []string {
|
| + if s.IsEmpty() {
|
| + return []string{}
|
| + }
|
| + if s.All {
|
| + return []string{"*"}
|
| + }
|
| + out := make([]string, 0, len(s.IDs)+len(s.Groups))
|
| + for ident := range s.IDs {
|
| + out = append(out, string(ident))
|
| + }
|
| + for group := range s.Groups {
|
| + out = append(out, "group:"+group)
|
| + }
|
| + sort.Strings(out)
|
| + return out
|
| +}
|
| +
|
| // FromStrings constructs a Set by parsing a slice of strings.
|
| //
|
| // Each string is either:
|
|
|