(username string)
| 83 | } |
| 84 | |
| 85 | func (repo CloudControllerUserRepository) FindAllByUsername(username string) (users []models.UserFields, apiErr error) { |
| 86 | uaaEndpoint, apiErr := repo.getAuthEndpoint() |
| 87 | if apiErr != nil { |
| 88 | return users, apiErr |
| 89 | } |
| 90 | |
| 91 | usernameFilter := neturl.QueryEscape(fmt.Sprintf(`userName Eq "%s"`, username)) |
| 92 | path := fmt.Sprintf("%s/Users?attributes=id,userName&filter=%s", uaaEndpoint, usernameFilter) |
| 93 | users, apiErr = repo.updateOrFindUsersWithUAAPath([]models.UserFields{}, path) |
| 94 | |
| 95 | if apiErr != nil { |
| 96 | errType, ok := apiErr.(errors.HTTPError) |
| 97 | if ok { |
| 98 | if errType.StatusCode() == 403 { |
| 99 | return users, errors.NewAccessDeniedError() |
| 100 | } |
| 101 | } |
| 102 | return users, apiErr |
| 103 | } else if len(users) == 0 { |
| 104 | return users, errors.NewModelNotFoundError("User", username) |
| 105 | } |
| 106 | |
| 107 | return users, apiErr |
| 108 | } |
| 109 | |
| 110 | func (repo CloudControllerUserRepository) ListUsersInOrgForRoleWithNoUAA(orgGUID string, roleName models.Role) (users []models.UserFields, apiErr error) { |
| 111 | return repo.listUsersWithPathWithNoUAA(fmt.Sprintf("/v2/organizations/%s/%s", orgGUID, orgRoleToPathMap[roleName])) |
no test coverage detected