Intersect returns the rights that are contained in both r and b.
(b *Rights)
| 175 | |
| 176 | // Intersect returns the rights that are contained in both r and b. |
| 177 | func (r *Rights) Intersect(b *Rights) *Rights { |
| 178 | if r == nil { |
| 179 | return &Rights{} |
| 180 | } |
| 181 | res := make([]Right, 0) |
| 182 | rs, bs := makeRightsSet(r), makeRightsSet(b) |
| 183 | for right := range rs { |
| 184 | if _, ok := bs[right]; ok { |
| 185 | res = append(res, right) |
| 186 | } |
| 187 | } |
| 188 | return &Rights{Rights: res} |
| 189 | } |
| 190 | |
| 191 | // Implied returns the rights together with their implied rights. |
| 192 | func (r *Rights) Implied() *Rights { |