(attrs []*ldap.EntryAttribute)
| 771 | } |
| 772 | |
| 773 | func sortAttributes(attrs []*ldap.EntryAttribute) []*ldap.EntryAttribute { |
| 774 | sortedAttrs := make([]*ldap.EntryAttribute, len(attrs)) |
| 775 | copy(sortedAttrs, attrs) |
| 776 | |
| 777 | switch AttrSort { |
| 778 | case "asc": |
| 779 | sort.Slice(sortedAttrs, func(i, j int) bool { |
| 780 | return sortedAttrs[i].Name <= sortedAttrs[j].Name |
| 781 | }) |
| 782 | case "desc": |
| 783 | sort.Slice(sortedAttrs, func(i, j int) bool { |
| 784 | return sortedAttrs[i].Name > sortedAttrs[j].Name |
| 785 | }) |
| 786 | } |
| 787 | |
| 788 | return sortedAttrs |
| 789 | } |
| 790 | |
| 791 | func getName(entry *ldap.Entry) string { |
| 792 | nameIds := []string{"cn", "ou", "dc", "name", "uid"} |
no outgoing calls
no test coverage detected