removeDuplicatePermissions Convert permissions to string as a hash to deduplicate.
(permissions [][]string)
| 509 | |
| 510 | // removeDuplicatePermissions Convert permissions to string as a hash to deduplicate. |
| 511 | func removeDuplicatePermissions(permissions [][]string) [][]string { |
| 512 | permissionsSet := make(map[string]bool) |
| 513 | res := make([][]string, 0) |
| 514 | for _, permission := range permissions { |
| 515 | permissionStr := util.ArrayToString(permission) |
| 516 | if permissionsSet[permissionStr] { |
| 517 | continue |
| 518 | } |
| 519 | permissionsSet[permissionStr] = true |
| 520 | res = append(res, permission) |
| 521 | } |
| 522 | return res |
| 523 | } |
| 524 | |
| 525 | // GetImplicitUsersForResource return implicit user based on resource. |
| 526 | // for example: |
no test coverage detected
searching dependent graphs…