mirror of
https://github.com/HangarMC/Hangar.git
synced 2025-01-30 14:30:08 +08:00
fix creating organizations
This commit is contained in:
parent
e07ef9cf9b
commit
ae75a2a323
@ -37,6 +37,7 @@ services:
|
||||
API_KEY: "${API_KEY}"
|
||||
POSTGRES_USER: "${POSTGRES_USER}"
|
||||
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
|
||||
AUTH_API_HOST: "http://hangar_new_auth:8000"
|
||||
depends_on:
|
||||
- 'db'
|
||||
- 'auth'
|
||||
|
@ -35,7 +35,7 @@ hangar:
|
||||
|
||||
security:
|
||||
api:
|
||||
url: "https://hangar-new.benndorf.dev"
|
||||
url: "${AUTH_API_HOST}"
|
||||
avatar-url: "https://hangar-auth.benndorf.dev/avatar/%s?size=120x120"
|
||||
|
||||
projects:
|
||||
|
@ -25,9 +25,11 @@ import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.HttpClientErrorException.UnprocessableEntity;
|
||||
import org.springframework.web.client.HttpStatusCodeException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -35,6 +37,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class OrganizationFactory extends HangarComponent {
|
||||
|
||||
private final UserDAO userDAO;
|
||||
@ -118,6 +121,8 @@ public class OrganizationFactory extends HangarComponent {
|
||||
throw new HangarApiException(HttpStatus.INTERNAL_SERVER_ERROR, "organization.new.error.unknownError");
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new HangarApiException(HttpStatus.INTERNAL_SERVER_ERROR, "organization.new.error.jsonError");
|
||||
} catch (HttpStatusCodeException e) {
|
||||
throw new HangarApiException(HttpStatus.INTERNAL_SERVER_ERROR, "Error creating accompanying user: " + e.getStatusCode() + " " + e.getStatusText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,16 +55,6 @@ public class StringUtils {
|
||||
return Arrays.stream(str.split("\\.")).map(Integer::parseInt).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the avatar url for a name
|
||||
*
|
||||
* @param name name (user, project)
|
||||
* @return the avatar url
|
||||
*/
|
||||
public static String avatarUrl(String name) {
|
||||
return String.format(hangarConfig.security.api.getAvatarUrl(), name);
|
||||
}
|
||||
|
||||
private static final Pattern LAST_WHOLE_VERSION = Pattern.compile("((?<=,\\s)|^)[0-9.]{2,}(?=-[0-9.]+$)");
|
||||
private static final Pattern PREV_HAS_HYPHEN = Pattern.compile("(?<=\\d-)[0-9.]+$");
|
||||
private static final Pattern PREV_HAS_COMMA_OR_FIRST = Pattern.compile("((?<=,\\s)|^)[0-9.]+$");
|
||||
|
Loading…
Reference in New Issue
Block a user