unified loading of user in UserModule
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -92,7 +92,7 @@ public class LegacyApi extends BaseHandler {
|
||||
|
||||
public boolean getModules(HttpExchange ex) throws IOException {
|
||||
var optToken = SessionToken.from(ex).map(Token::of);
|
||||
if (optToken.isEmpty()) return sendEmptyResponse(HTTP_UNAUTHORIZED,ex);
|
||||
if (optToken.isEmpty()) return unauthorized(ex);
|
||||
var list = new ArrayList<Map<String,String>>();
|
||||
for (var module : config.keys()){
|
||||
Optional<String> url = config.get(module+".baseUrl");
|
||||
@@ -202,7 +202,7 @@ public class LegacyApi extends BaseHandler {
|
||||
if (!(resp instanceof JSONObject json)) throw new UmbrellaException(500,"{0} did not return JSON!",messageUrl);
|
||||
|
||||
// TODO: should we return json?
|
||||
return sendEmptyResponse(HTTP_OK,ex);
|
||||
return ok(ex);
|
||||
}
|
||||
|
||||
private boolean logout(HttpExchange ex) throws IOException {
|
||||
@@ -224,7 +224,7 @@ public class LegacyApi extends BaseHandler {
|
||||
|
||||
private boolean postSearch(HttpExchange ex) throws IOException, UmbrellaException {
|
||||
var optToken = SessionToken.from(ex).map(Token::of);
|
||||
if (optToken.isEmpty()) return sendEmptyResponse(HTTP_UNAUTHORIZED,ex);
|
||||
if (optToken.isEmpty()) return unauthorized(ex);
|
||||
var token = optToken.get();
|
||||
var json = json(ex);
|
||||
if (!(json.has(KEY) && json.get(KEY) instanceof String key) || key.isBlank()) return sendContent(ex,HTTP_BAD_REQUEST,"No search key given");
|
||||
|
||||
Reference in New Issue
Block a user