(userGroup string)
| 43 | } |
| 44 | |
| 45 | func GetUserUsableGroups(userGroup string) map[string]string { |
| 46 | groupsCopy := GetUserUsableGroupsCopy() |
| 47 | if userGroup == "" { |
| 48 | if _, ok := groupsCopy["default"]; !ok { |
| 49 | groupsCopy["default"] = "default" |
| 50 | } |
| 51 | } |
| 52 | // 如果userGroup不在UserUsableGroups中,返回UserUsableGroups + userGroup |
| 53 | if _, ok := groupsCopy[userGroup]; !ok { |
| 54 | groupsCopy[userGroup] = "用户分组" |
| 55 | } |
| 56 | // 如果userGroup在UserUsableGroups中,返回UserUsableGroups |
| 57 | return groupsCopy |
| 58 | } |
| 59 | |
| 60 | func GroupInUserUsableGroups(groupName string) bool { |
| 61 | userUsableGroupsMutex.RLock() |
no test coverage detected