Code updates to fit "expected" documentation
This commit is contained in:
parent
f4dcf7c3be
commit
bcd95d9e9b
@ -251,100 +251,100 @@ public final class APIv3 extends AbstractVerticle {
|
||||
|
||||
// TODO: The commented out routes
|
||||
|
||||
http.get("/accessTokens/:id").blockingHandler(new GETAccessTokensId());
|
||||
http.get("/accessTokens/:accessToken").blockingHandler(new GETAccessTokensId());
|
||||
http.get("/accessTokens").blockingHandler(new GETAccessTokens());
|
||||
http.post("/accessTokens").blockingHandler(new POSTAccessTokens(), false);
|
||||
//http.put("/accessTokens/:id").blockingHandler(new PUTAccessTokensId(), false);
|
||||
http.delete("/accessTokens/:id").blockingHandler(new DELETEAccessTokensId(), false);
|
||||
//http.put("/accessTokens/:accessToken").blockingHandler(new PUTAccessTokensId(), false);
|
||||
http.delete("/accessTokens/:accessToken").blockingHandler(new DELETEAccessTokensId(), false);
|
||||
|
||||
http.get("/auditLog").handler(new GETAuditLog());
|
||||
http.post("/auditLog").handler(new POSTAuditLog());
|
||||
http.delete("/auditLog/:id").blockingHandler(new DELETEAuditLogId());
|
||||
http.delete("/auditLog/:auditLogEntryId").blockingHandler(new DELETEAuditLogId());
|
||||
|
||||
http.get("/bannedAsns/:id").handler(new GETBannedAsnsId());
|
||||
http.get("/bannedAsns/:bannedAsn").handler(new GETBannedAsnsId());
|
||||
http.get("/bannedAsns").handler(new GETBannedAsns());
|
||||
http.post("/bannedAsns").blockingHandler(new POSTBannedAsns(), false);
|
||||
//http.put("/bannedAsns/:id").blockingHandler(new PUTBannedAsnsId(), false);
|
||||
http.delete("/bannedAsns/:id").blockingHandler(new DELETEBannedAsnsId(), false);
|
||||
//http.put("/bannedAsns/:bannedAsn").blockingHandler(new PUTBannedAsnsId(), false);
|
||||
http.delete("/bannedAsns/:bannedAsn").blockingHandler(new DELETEBannedAsnsId(), false);
|
||||
|
||||
http.get("/bannedCellCarriers/:id").handler(new GETBannedCellCarriersId());
|
||||
http.get("/bannedCellCarriers/:bannedCellCarrier").handler(new GETBannedCellCarriersId());
|
||||
http.get("/bannedCellCarriers").handler(new GETBannedCellCarriers());
|
||||
http.post("/bannedCellCarriers").blockingHandler(new POSTBannedCellCarriers(), false);
|
||||
//http.put("/bannedCellCarriers/:id").blockingHandler(new PUTBannedCellCarriersId(), false);
|
||||
http.delete("/bannedCellCarriers/:id").blockingHandler(new DELETEBannedCellCarriersId(), false);
|
||||
//http.put("/bannedCellCarriers/:bannedCellCarrier").blockingHandler(new PUTBannedCellCarriersId(), false);
|
||||
http.delete("/bannedCellCarriers/:bannedCellCarrier").blockingHandler(new DELETEBannedCellCarriersId(), false);
|
||||
|
||||
http.get("/chatFilter").handler(new GETChatFilter());
|
||||
|
||||
http.get("/emailTokens/:id/owner").blockingHandler(new GETEmailTokensIdOwner(), false);
|
||||
http.post("/emailTokens/:id/confirm").blockingHandler(new POSTEmailTokensIdConfirm(), false);
|
||||
http.get("/emailTokens/:emailToken/owner").blockingHandler(new GETEmailTokensIdOwner(), false);
|
||||
http.post("/emailTokens/:emailToken/confirm").blockingHandler(new POSTEmailTokensIdConfirm(), false);
|
||||
|
||||
http.get("/grants/:id").handler(new GETGrantsId());
|
||||
http.get("/grants/:grantId").handler(new GETGrantsId());
|
||||
http.get("/grants").handler(new GETGrants());
|
||||
http.post("/grants").blockingHandler(new POSTGrants(), false);
|
||||
//http.put("/grants/:id").blockingHandler(new PUTGrantsId(), false);
|
||||
http.delete("/grants/:id").blockingHandler(new DELETEGrantsId(), false);
|
||||
//http.put("/grants/:grantId").blockingHandler(new PUTGrantsId(), false);
|
||||
http.delete("/grants/:grantId").blockingHandler(new DELETEGrantsId(), false);
|
||||
|
||||
http.get("/ipBans/:id").handler(new GETIpBansId());
|
||||
http.get("/ipBans/:ipBanId").handler(new GETIpBansId());
|
||||
http.get("/ipBans").handler(new GETIpBans());
|
||||
http.post("/ipBans").blockingHandler(new POSTIpBans(), false);
|
||||
//http.put("/ipBans/:id").blockingHandler(new PUTIpBansId(), false);
|
||||
http.delete("/ipBans/:id").blockingHandler(new DELETEIpBansId(), false);
|
||||
//http.put("/ipBans/:ipBanId").blockingHandler(new PUTIpBansId(), false);
|
||||
http.delete("/ipBans/:ipBanId").blockingHandler(new DELETEIpBansId(), false);
|
||||
|
||||
http.get("/ipIntel/:id").handler(new GETIpInteld());
|
||||
http.get("/ipIntel/:userIp").handler(new GETIpInteld());
|
||||
|
||||
http.get("/ipLog/:id").handler(new GETIpLogId());
|
||||
http.get("/ipLog/:userId").handler(new GETIpLogId());
|
||||
|
||||
http.get("/notificationTemplates/:id").handler(new GETNotificationTemplatesId());
|
||||
http.get("/notificationTemplates/:notificationTemplateId").handler(new GETNotificationTemplatesId());
|
||||
http.get("/notificationTemplates").handler(new GETNotificationTemplates());
|
||||
http.post("/notificationTemplates").blockingHandler(new POSTNotificationTemplates(), false);
|
||||
//http.put("/notificationTemplates/:id").blockingHandler(new PUTNotificationTemplatesId(), false);
|
||||
http.delete("/notificationTemplates/:id").blockingHandler(new DELETENotificationTemplatesId(), false);
|
||||
//http.put("/notificationTemplates/:notificationTemplateId").blockingHandler(new PUTNotificationTemplatesId(), false);
|
||||
http.delete("/notificationTemplates/:notificationTemplateId").blockingHandler(new DELETENotificationTemplatesId(), false);
|
||||
|
||||
http.get("/phoneIntel/:id").handler(new GETPhoneInteld());
|
||||
http.get("/phoneIntel/:phone").handler(new GETPhoneInteld());
|
||||
|
||||
http.get("/punishments/:id").handler(new GETPunishmentsId());
|
||||
http.get("/punishments/:punishmentId").handler(new GETPunishmentsId());
|
||||
http.get("/punishments").handler(new GETPunishments());
|
||||
http.post("/punishments").blockingHandler(new POSTPunishments(), false);
|
||||
//http.put("/punishments/:id").blockingHandler(new PUTPunishmentsId(), false);
|
||||
http.delete("/punishments/:id").blockingHandler(new DELETEPunishmentsId(), false);
|
||||
//http.put("/punishments/:punishmentId").blockingHandler(new PUTPunishmentsId(), false);
|
||||
http.delete("/punishments/:punishmentId").blockingHandler(new DELETEPunishmentsId(), false);
|
||||
http.delete("/users/:id/activePunishment").blockingHandler(new DELETEUsersIdActivePunishment(), false);
|
||||
|
||||
http.get("/ranks/:id").handler(new GETRanksId());
|
||||
http.get("/ranks/:rankId").handler(new GETRanksId());
|
||||
http.get("/ranks").handler(new GETRanks());
|
||||
http.post("/ranks").blockingHandler(new POSTRanks(), false);
|
||||
//http.put("/ranks/:id").blockingHandler(new PUTRanksId(), false);
|
||||
http.delete("/ranks/:id").blockingHandler(new DELETERanksId(), false);
|
||||
//http.put("/ranks/:rankId").blockingHandler(new PUTRanksId(), false);
|
||||
http.delete("/ranks/:rankId").blockingHandler(new DELETERanksId(), false);
|
||||
|
||||
http.get("/serverGroups/:id").handler(new GETServerGroupsId());
|
||||
http.get("/serverGroups/:serverGroupId").handler(new GETServerGroupsId());
|
||||
http.get("/serverGroups").handler(new GETServerGroups());
|
||||
http.post("/serverGroups").blockingHandler(new POSTServerGroups(), false);
|
||||
//http.put("/serverGroups/:id").blockingHandler(new PUTServerGroupsId(), false);
|
||||
http.delete("/serverGroups/:id").blockingHandler(new DELETEServerGroupsId(), false);
|
||||
//http.put("/serverGroups/:serverGroupId").blockingHandler(new PUTServerGroupsId(), false);
|
||||
http.delete("/serverGroups/:serverGroupId").blockingHandler(new DELETEServerGroupsId(), false);
|
||||
|
||||
http.get("/servers/:id").handler(new GETServersId());
|
||||
http.get("/servers/:serverId").handler(new GETServersId());
|
||||
http.get("/servers").handler(new GETServers());
|
||||
http.post("/servers/heartbeat").handler(new POSTServersHeartbeat());
|
||||
http.post("/servers").blockingHandler(new POSTServers(), false);
|
||||
//http.put("/servers/:id").blockingHandler(new PUTServersId(), false);
|
||||
http.delete("/servers/:id").blockingHandler(new DELETEServersId(), false);
|
||||
//http.put("/servers/:serverId").blockingHandler(new PUTServersId(), false);
|
||||
http.delete("/servers/:serverId").blockingHandler(new DELETEServersId(), false);
|
||||
|
||||
http.get("/staff").blockingHandler(new GETStaff(), false);
|
||||
http.get("/users/:id").handler(new GETUsersId());
|
||||
http.get("/users/:id/compoundedPermissions").handler(new GETUsersIdCompoundedPermissions());
|
||||
http.get("/users/:id/details").blockingHandler(new GETUsersIdDetails(), false);
|
||||
http.get("/users/:id/requiresTotp").handler(new GETUsersIdRequiresTotp());
|
||||
http.get("/users/:id/verifyPassword").blockingHandler(new GETUsersIdVerifyPassword(), false);
|
||||
http.post("/users/:id/changePassword").blockingHandler(new POSTUsersIdChangePassword(), false);
|
||||
http.post("/users/:id/leave").handler(new POSTUsersIdLeave());
|
||||
http.post("/users/:id/login").blockingHandler(new POSTUsersIdLogin());
|
||||
http.post("/users/:id/notify").blockingHandler(new POSTUsersIdNotify(), false);
|
||||
http.post("/users/:id/passwordReset").blockingHandler(new POSTUsersIdPasswordReset(), false);
|
||||
http.post("/users/:id/registerEmail").blockingHandler(new POSTUsersIdRegisterEmail(), false);
|
||||
http.post("/users/:id/registerPhone").blockingHandler(new POSTUsersIdRegisterPhone(), false);
|
||||
http.post("/users/:id/setupTotp").blockingHandler(new POSTUsersIdSetupTotp(), false);
|
||||
http.post("/users/:id/verifyTotp").handler(new POSTUsersIdVerifyTotp());
|
||||
http.get("/users/:userId").handler(new GETUsersId());
|
||||
http.get("/users/:userId/compoundedPermissions").handler(new GETUsersIdCompoundedPermissions());
|
||||
http.get("/users/:userId/details").blockingHandler(new GETUsersIdDetails(), false);
|
||||
http.get("/users/:userId/requiresTotp").handler(new GETUsersIdRequiresTotp());
|
||||
http.get("/users/:userId/verifyPassword").blockingHandler(new GETUsersIdVerifyPassword(), false);
|
||||
http.post("/users/:userId/changePassword").blockingHandler(new POSTUsersIdChangePassword(), false);
|
||||
http.post("/users/:userId/leave").handler(new POSTUsersIdLeave());
|
||||
http.post("/users/:userId/login").blockingHandler(new POSTUsersIdLogin());
|
||||
http.post("/users/:userId/notify").blockingHandler(new POSTUsersIdNotify(), false);
|
||||
http.post("/users/:userId/passwordReset").blockingHandler(new POSTUsersIdPasswordReset(), false);
|
||||
http.post("/users/:userId/registerEmail").blockingHandler(new POSTUsersIdRegisterEmail(), false);
|
||||
http.post("/users/:userId/registerPhone").blockingHandler(new POSTUsersIdRegisterPhone(), false);
|
||||
http.post("/users/:userId/setupTotp").blockingHandler(new POSTUsersIdSetupTotp(), false);
|
||||
http.post("/users/:userId/verifyTotp").handler(new POSTUsersIdVerifyTotp());
|
||||
|
||||
http.get("/dumps/:type").handler(new GETDumpsType());
|
||||
http.get("/dumps/:dumpType").handler(new GETDumpsType());
|
||||
http.get("/whoami").handler(new GETWhoAmI());
|
||||
|
||||
int port = Integer.parseInt(config.getProperty("http.port"));
|
||||
|
@ -69,7 +69,7 @@ public final class User {
|
||||
try {
|
||||
UUID uuid = UUID.fromString(id);
|
||||
findById(uuid, callback);
|
||||
} catch (IllegalArgumentException ignored) { // from UUID parsing
|
||||
} catch (NullPointerException | IllegalArgumentException ignored) { // from UUID parsing
|
||||
callback.onResult(null, null); // We don't pass in the exception, we just pretend we couldn't find them.
|
||||
}
|
||||
}
|
||||
|
@ -76,9 +76,9 @@ public final class GETDumpsType implements Handler<RoutingContext> {
|
||||
}
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
String type = ctx.request().getParam("type");
|
||||
String dumpType = ctx.request().getParam("dumpType");
|
||||
|
||||
switch (type.toLowerCase()) {
|
||||
switch (dumpType.toLowerCase()) {
|
||||
case "ban":
|
||||
APIv3.respondJson(ctx, banCache);
|
||||
return;
|
||||
@ -97,7 +97,7 @@ public final class GETDumpsType implements Handler<RoutingContext> {
|
||||
APIv3.respondJson(ctx, grantCache);
|
||||
return;
|
||||
default:
|
||||
ErrorUtils.respondInvalidInput(ctx, type + " is not a valid type. Not in [ban, blacklist, accessDeniable, grant]");
|
||||
ErrorUtils.respondInvalidInput(ctx, dumpType + " is not a valid type. Not in [ban, blacklist, accessDeniable, grant]");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,11 +18,11 @@ public final class DELETEAccessTokensId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<AccessToken> accessTokenCallback = new BlockingCallback<>();
|
||||
AccessToken.findById(ctx.request().getParam("id"), accessTokenCallback);
|
||||
AccessToken.findById(ctx.request().getParam("accessToken"), accessTokenCallback);
|
||||
AccessToken accessToken = accessTokenCallback.get();
|
||||
|
||||
if (accessToken == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "Access token", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "Access token", ctx.request().getParam("accessToken"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -32,8 +32,8 @@ public final class DELETEAccessTokensId implements Handler<RoutingContext> {
|
||||
|
||||
JsonObject requestBody = ctx.getBodyAsJson();
|
||||
|
||||
if (requestBody.containsKey("addedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("addedBy")), requestBody.getString("addedByIp"), ctx, AuditLogActionType.ACCESS_TOKEN_DELETE, ImmutableMap.of("accessTokenId", accessToken.getId()), (ignored, error) -> {
|
||||
if (requestBody.containsKey("removedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("removedBy")), requestBody.getString("removedByIp"), ctx, AuditLogActionType.ACCESS_TOKEN_DELETE, ImmutableMap.of("accessTokenId", accessToken.getId()), (ignored, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
|
@ -4,34 +4,12 @@ import io.vertx.core.Handler;
|
||||
import io.vertx.ext.web.RoutingContext;
|
||||
import net.frozenorb.apiv3.APIv3;
|
||||
import net.frozenorb.apiv3.model.AccessToken;
|
||||
import net.frozenorb.apiv3.model.User;
|
||||
import net.frozenorb.apiv3.unsorted.BlockingCallback;
|
||||
import net.frozenorb.apiv3.unsorted.TotpAuthorizationResult;
|
||||
import net.frozenorb.apiv3.util.ErrorUtils;
|
||||
|
||||
public final class GETAccessTokensId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<User> userCallback = new BlockingCallback<>();
|
||||
User.findById(ctx.request().getParam("user"), userCallback);
|
||||
User user = userCallback.get();
|
||||
|
||||
if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("user"));
|
||||
return;
|
||||
}
|
||||
|
||||
int code = Integer.parseInt(ctx.request().getParam("totpCode"));
|
||||
BlockingCallback<TotpAuthorizationResult> totpAuthorizationCallback = new BlockingCallback<>();
|
||||
user.checkTotpAuthorization(code, null, totpAuthorizationCallback);
|
||||
TotpAuthorizationResult totpAuthorizationResult = totpAuthorizationCallback.get();
|
||||
|
||||
if (!totpAuthorizationResult.isAuthorized()) {
|
||||
ErrorUtils.respondInvalidInput(ctx, "Totp authorization failed: " + totpAuthorizationResult.name());
|
||||
return;
|
||||
}
|
||||
|
||||
AccessToken.findById(ctx.request().getParam("id"), (accessToken, error) -> {
|
||||
AccessToken.findById(ctx.request().getParam("accessToken"), (accessToken, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
|
@ -15,7 +15,6 @@ import net.frozenorb.apiv3.unsorted.TotpAuthorizationResult;
|
||||
import net.frozenorb.apiv3.util.ErrorUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class POSTAccessTokens implements Handler<RoutingContext> {
|
||||
|
||||
@ -26,17 +25,17 @@ public final class POSTAccessTokens implements Handler<RoutingContext> {
|
||||
List<String> lockedIps = (List<String>) requestBody.getJsonArray("lockedIps").getList();
|
||||
|
||||
BlockingCallback<User> userCallback = new BlockingCallback<>();
|
||||
User.findById(requestBody.getString("user"), userCallback);
|
||||
User user = userCallback.get();
|
||||
User.findById(requestBody.getString("addedBy"), userCallback);
|
||||
User addedBy = userCallback.get();
|
||||
|
||||
if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", requestBody.getString("user"));
|
||||
if (addedBy == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", requestBody.getString("addedBy"));
|
||||
return;
|
||||
}
|
||||
|
||||
int code = requestBody.getInteger("totpCode");
|
||||
BlockingCallback<TotpAuthorizationResult> totpAuthorizationCallback = new BlockingCallback<>();
|
||||
user.checkTotpAuthorization(code, null, totpAuthorizationCallback);
|
||||
addedBy.checkTotpAuthorization(code, null, totpAuthorizationCallback);
|
||||
TotpAuthorizationResult totpAuthorizationResult = totpAuthorizationCallback.get();
|
||||
|
||||
if (!totpAuthorizationResult.isAuthorized()) {
|
||||
@ -49,17 +48,13 @@ public final class POSTAccessTokens implements Handler<RoutingContext> {
|
||||
accessToken.insert(callback);
|
||||
callback.get();
|
||||
|
||||
if (requestBody.containsKey("addedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("addedBy")), requestBody.getString("addedByIp"), ctx, AuditLogActionType.ACCESS_TOKEN_CREATE, ImmutableMap.of("accessTokenActorName", actorName), (ignored, error) -> {
|
||||
AuditLog.log(addedBy.getId(), requestBody.getString("addedByIp"), ctx, AuditLogActionType.ACCESS_TOKEN_CREATE, ImmutableMap.of("accessTokenActorName", actorName), (ignored, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
APIv3.respondJson(ctx, accessToken);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
APIv3.respondJson(ctx, accessToken);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -17,11 +17,11 @@ public final class DELETEAuditLogId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<AuditLogEntry> auditLogEntryCallback = new BlockingCallback<>();
|
||||
AuditLogEntry.findById(ctx.request().getParam("id"), auditLogEntryCallback);
|
||||
AuditLogEntry.findById(ctx.request().getParam("auditLogEntryId"), auditLogEntryCallback);
|
||||
AuditLogEntry auditLogEntry = auditLogEntryCallback.get();
|
||||
|
||||
if (auditLogEntry == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "Audit log entry", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "Audit log entry", ctx.request().getParam("auditLogEntryId"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -36,8 +36,8 @@ public final class DELETEAuditLogId implements Handler<RoutingContext> {
|
||||
|
||||
JsonObject requestBody = ctx.getBodyAsJson();
|
||||
|
||||
if (requestBody.containsKey("user")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("user")), requestBody.getString("userIp"), ctx, AuditLogActionType.AUDIT_LOG_REVERT, ImmutableMap.of("auditLogEntryId", auditLogEntry.getId()), (ignored, error) -> {
|
||||
if (requestBody.containsKey("revertedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("revertedBy")), requestBody.getString("revertedByIp"), ctx, AuditLogActionType.AUDIT_LOG_REVERT, ImmutableMap.of("auditLogEntryId", auditLogEntry.getId()), (ignored, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
|
@ -17,10 +17,10 @@ import java.util.UUID;
|
||||
public final class DELETEBannedAsnsId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BannedAsn bannedAsn = BannedAsn.findById(Integer.parseInt(ctx.request().getParam("id")));
|
||||
BannedAsn bannedAsn = BannedAsn.findById(Integer.parseInt(ctx.request().getParam("bannedAsn")));
|
||||
|
||||
if (bannedAsn == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "Banned asn", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "Banned asn", ctx.request().getParam("bannedAsn"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -30,8 +30,8 @@ public final class DELETEBannedAsnsId implements Handler<RoutingContext> {
|
||||
|
||||
JsonObject requestBody = ctx.getBodyAsJson();
|
||||
|
||||
if (requestBody.containsKey("addedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("addedBy")), requestBody.getString("addedByIp"), ctx, AuditLogActionType.BANNED_ASN_DELETE, ImmutableMap.of("bannedAsnId", bannedAsn.getId()), (ignored, error) -> {
|
||||
if (requestBody.containsKey("removedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("removedBy")), requestBody.getString("removedByIp"), ctx, AuditLogActionType.BANNED_ASN_DELETE, ImmutableMap.of("bannedAsnId", bannedAsn.getId()), (ignored, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
|
@ -8,7 +8,7 @@ import net.frozenorb.apiv3.model.BannedAsn;
|
||||
public final class GETBannedAsnsId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
APIv3.respondJson(ctx, BannedAsn.findById(Integer.parseInt(ctx.request().getParam("id"))));
|
||||
APIv3.respondJson(ctx, BannedAsn.findById(Integer.parseInt(ctx.request().getParam("bannedAsn"))));
|
||||
}
|
||||
|
||||
}
|
@ -17,10 +17,10 @@ import java.util.UUID;
|
||||
public final class DELETEBannedCellCarriersId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BannedCellCarrier bannedCellCarrier = BannedCellCarrier.findById(Integer.parseInt(ctx.request().getParam("id")));
|
||||
BannedCellCarrier bannedCellCarrier = BannedCellCarrier.findById(Integer.parseInt(ctx.request().getParam("bannedCellCarrier")));
|
||||
|
||||
if (bannedCellCarrier == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "Banned cell carrier", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "Banned cell carrier", ctx.request().getParam("bannedCellCarrier"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -30,8 +30,8 @@ public final class DELETEBannedCellCarriersId implements Handler<RoutingContext>
|
||||
|
||||
JsonObject requestBody = ctx.getBodyAsJson();
|
||||
|
||||
if (requestBody.containsKey("addedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("addedBy")), requestBody.getString("addedByIp"), ctx, AuditLogActionType.BANNED_CALL_CARRIER_DELETE, ImmutableMap.of("bannedCellCarrierId", bannedCellCarrier.getId()), (ignored, error) -> {
|
||||
if (requestBody.containsKey("removedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("removedBy")), requestBody.getString("removedByIp"), ctx, AuditLogActionType.BANNED_CALL_CARRIER_DELETE, ImmutableMap.of("bannedCellCarrierId", bannedCellCarrier.getId()), (ignored, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
|
@ -8,7 +8,7 @@ import net.frozenorb.apiv3.model.BannedCellCarrier;
|
||||
public final class GETBannedCellCarriersId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
APIv3.respondJson(ctx, BannedCellCarrier.findById(Integer.parseInt(ctx.request().getParam("id"))));
|
||||
APIv3.respondJson(ctx, BannedCellCarrier.findById(Integer.parseInt(ctx.request().getParam("bannedCellCarrier"))));
|
||||
}
|
||||
|
||||
}
|
@ -9,7 +9,7 @@ import net.frozenorb.apiv3.util.ErrorUtils;
|
||||
public final class GETEmailTokensIdOwner implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
User.findByEmailToken(ctx.request().getParam("id"), (user, error) -> {
|
||||
User.findByEmailToken(ctx.request().getParam("emailToken"), (user, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
|
@ -18,11 +18,11 @@ public final class POSTEmailTokensIdConfirm implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<User> userCallback = new BlockingCallback<>();
|
||||
User.findByEmailToken(ctx.request().getParam("id"), userCallback);
|
||||
User.findByEmailToken(ctx.request().getParam("emailToken"), userCallback);
|
||||
User user = userCallback.get();
|
||||
|
||||
if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "Email token", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "Email token", ctx.request().getParam("emailToken"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,11 @@ public final class DELETEGrantsId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<Grant> grantCallback = new BlockingCallback<>();
|
||||
Grant.findById(ctx.request().getParam("id"), grantCallback);
|
||||
Grant.findById(ctx.request().getParam("grantId"), grantCallback);
|
||||
Grant grant = grantCallback.get();
|
||||
|
||||
if (grant == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "Grant", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "Grant", ctx.request().getParam("grantId"));
|
||||
return;
|
||||
} else if (!grant.isActive()) {
|
||||
ErrorUtils.respondInvalidInput(ctx, "Cannot remove an inactive grant.");
|
||||
|
@ -9,7 +9,7 @@ import net.frozenorb.apiv3.util.ErrorUtils;
|
||||
public final class GETGrantsId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
Grant.findById(ctx.request().getParam("id"), (grant, error) -> {
|
||||
Grant.findById(ctx.request().getParam("grantId"), (grant, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
|
@ -76,7 +76,7 @@ public final class POSTGrants implements Handler<RoutingContext> {
|
||||
|
||||
// We purposely don't fail on a null check, grants don't have to have a source.
|
||||
BlockingCallback<User> addedByCallback = new BlockingCallback<>();
|
||||
User.findById(requestBody.getString("addedBt"), addedByCallback);
|
||||
User.findById(requestBody.getString("addedBy"), addedByCallback);
|
||||
User addedBy = addedByCallback.get();
|
||||
|
||||
if (addedBy != null && rank.isHigherStaffRank()) {
|
||||
|
@ -18,7 +18,7 @@ public final class DELETEIpBansId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<IpBan> ipBanCallback = new BlockingCallback<>();
|
||||
IpBan.findById(ctx.request().getParam("id"), ipBanCallback);
|
||||
IpBan.findById(ctx.request().getParam("ipBanId"), ipBanCallback);
|
||||
IpBan ipBan = ipBanCallback.get();
|
||||
|
||||
if (ipBan == null) {
|
||||
|
@ -9,7 +9,7 @@ import net.frozenorb.apiv3.util.ErrorUtils;
|
||||
public final class GETIpBansId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
IpBan.findById(ctx.request().getParam("id"), (ipBan, error) -> {
|
||||
IpBan.findById(ctx.request().getParam("ipBanId"), (ipBan, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
|
@ -19,7 +19,7 @@ public final class POSTIpBans implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
JsonObject requestBody = ctx.getBodyAsJson();
|
||||
String userIp = requestBody.getString("id");
|
||||
String userIp = requestBody.getString("userIp");
|
||||
|
||||
if (!IpUtils.isValidIp(userIp)) {
|
||||
ErrorUtils.respondInvalidInput(ctx, "Ip address \"" + userIp + "\" is not valid.");
|
||||
|
@ -10,7 +10,7 @@ import net.frozenorb.apiv3.util.IpUtils;
|
||||
public final class GETIpInteld implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
String userIp = ctx.request().getParam("id");
|
||||
String userIp = ctx.request().getParam("userIp");
|
||||
|
||||
if (!IpUtils.isValidIp(userIp)) {
|
||||
ErrorUtils.respondInvalidInput(ctx, "Ip address \"" + userIp + "\" is not valid.");
|
||||
|
@ -10,11 +10,11 @@ import net.frozenorb.apiv3.util.ErrorUtils;
|
||||
public final class GETIpLogId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
User.findById(ctx.request().getParam("id"), (user, error) -> {
|
||||
User.findById(ctx.request().getParam("userId"), (user, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("userId"));
|
||||
} else {
|
||||
IpLogEntry.findByUser(user, (ipLog, error2) -> {
|
||||
if (error2 != null) {
|
||||
|
@ -18,11 +18,11 @@ public final class DELETENotificationTemplatesId implements Handler<RoutingConte
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<NotificationTemplate> notificationTemplateCallback = new BlockingCallback<>();
|
||||
NotificationTemplate.findById(ctx.request().getParam("id"), notificationTemplateCallback);
|
||||
NotificationTemplate.findById(ctx.request().getParam("notificationTemplateId"), notificationTemplateCallback);
|
||||
NotificationTemplate notificationTemplate = notificationTemplateCallback.get();
|
||||
|
||||
if (notificationTemplate == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "Notification template", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "Notification template", ctx.request().getParam("notificationTemplateId"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -32,8 +32,8 @@ public final class DELETENotificationTemplatesId implements Handler<RoutingConte
|
||||
|
||||
JsonObject requestBody = ctx.getBodyAsJson();
|
||||
|
||||
if (requestBody.containsKey("addedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("addedBy")), requestBody.getString("addedByIp"), ctx, AuditLogActionType.NOTIFICATION_TEMPLATE_DELETE, ImmutableMap.of("notificationTemplateId", notificationTemplate.getId()), (ignored, error) -> {
|
||||
if (requestBody.containsKey("removedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("removedBy")), requestBody.getString("removedByIp"), ctx, AuditLogActionType.NOTIFICATION_TEMPLATE_DELETE, ImmutableMap.of("notificationTemplateId", notificationTemplate.getId()), (ignored, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
|
@ -9,7 +9,7 @@ import net.frozenorb.apiv3.util.ErrorUtils;
|
||||
public final class GETNotificationTemplatesId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
NotificationTemplate.findById(ctx.request().getParam("id"), (notificationTemplate, error) -> {
|
||||
NotificationTemplate.findById(ctx.request().getParam("notificationTemplateId"), (notificationTemplate, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
|
@ -10,7 +10,7 @@ import net.frozenorb.apiv3.util.PhoneUtils;
|
||||
public final class GETPhoneInteld implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
String phoneNumber = ctx.request().getParam("id");
|
||||
String phoneNumber = ctx.request().getParam("phone");
|
||||
|
||||
if (!PhoneUtils.isValidPhone(phoneNumber)) {
|
||||
ErrorUtils.respondInvalidInput(ctx, "Phone number \"" + phoneNumber + "\" is not valid.");
|
||||
|
@ -18,11 +18,11 @@ public final class DELETEPunishmentsId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<Punishment> punishmentCallback = new BlockingCallback<>();
|
||||
Punishment.findById(ctx.request().getParam("id"), punishmentCallback);
|
||||
Punishment.findById(ctx.request().getParam("punishmentId"), punishmentCallback);
|
||||
Punishment punishment = punishmentCallback.get();
|
||||
|
||||
if (punishment == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "Punishment", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "Punishment", ctx.request().getParam("punishmentId"));
|
||||
return;
|
||||
} else if (!punishment.isActive()) {
|
||||
ErrorUtils.respondInvalidInput(ctx, "Cannot remove an inactive punishment.");
|
||||
|
@ -9,7 +9,7 @@ import net.frozenorb.apiv3.util.ErrorUtils;
|
||||
public final class GETPunishmentsId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
Punishment.findById(ctx.request().getParam("id"), (punishment, error) -> {
|
||||
Punishment.findById(ctx.request().getParam("punishmentId"), (punishment, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
|
@ -17,10 +17,10 @@ import java.util.UUID;
|
||||
public final class DELETERanksId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
Rank rank = Rank.findById(ctx.request().getParam("id"));
|
||||
Rank rank = Rank.findById(ctx.request().getParam("rankId"));
|
||||
|
||||
if (rank == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "Rank", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "Rank", ctx.request().getParam("rankId"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -30,8 +30,8 @@ public final class DELETERanksId implements Handler<RoutingContext> {
|
||||
|
||||
JsonObject requestBody = ctx.getBodyAsJson();
|
||||
|
||||
if (requestBody.containsKey("addedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("addedBy")), requestBody.getString("addedByIp"), ctx, AuditLogActionType.RANK_DELETE, ImmutableMap.of("rankId", rank.getId()), (ignored, error) -> {
|
||||
if (requestBody.containsKey("removedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("removedBy")), requestBody.getString("removedByIp"), ctx, AuditLogActionType.RANK_DELETE, ImmutableMap.of("rankId", rank.getId()), (ignored, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
|
@ -8,7 +8,7 @@ import net.frozenorb.apiv3.model.Rank;
|
||||
public final class GETRanksId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
APIv3.respondJson(ctx, Rank.findById(ctx.request().getParam("id")));
|
||||
APIv3.respondJson(ctx, Rank.findById(ctx.request().getParam("rankId")));
|
||||
}
|
||||
|
||||
}
|
@ -17,10 +17,10 @@ import java.util.UUID;
|
||||
public final class DELETEServerGroupsId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
ServerGroup serverGroup = ServerGroup.findById(ctx.request().getParam("id"));
|
||||
ServerGroup serverGroup = ServerGroup.findById(ctx.request().getParam("serverGroupId"));
|
||||
|
||||
if (serverGroup == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "Server group", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "Server group", ctx.request().getParam("serverGroupId"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -30,8 +30,8 @@ public final class DELETEServerGroupsId implements Handler<RoutingContext> {
|
||||
|
||||
JsonObject requestBody = ctx.getBodyAsJson();
|
||||
|
||||
if (requestBody.containsKey("addedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("addedBy")), requestBody.getString("addedByIp"), ctx, AuditLogActionType.SERVER_GROUP_DELETE, ImmutableMap.of("serverGroupId", serverGroup.getId()), (ignored, error) -> {
|
||||
if (requestBody.containsKey("removedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("emovedBy")), requestBody.getString("emovedByIp"), ctx, AuditLogActionType.SERVER_GROUP_DELETE, ImmutableMap.of("serverGroupId", serverGroup.getId()), (ignored, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
|
@ -8,7 +8,7 @@ import net.frozenorb.apiv3.model.ServerGroup;
|
||||
public final class GETServerGroupsId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
APIv3.respondJson(ctx, ServerGroup.findById(ctx.request().getParam("id")));
|
||||
APIv3.respondJson(ctx, ServerGroup.findById(ctx.request().getParam("serverGroupId")));
|
||||
}
|
||||
|
||||
}
|
@ -19,10 +19,10 @@ import java.util.UUID;
|
||||
public final class DELETEServersId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
Server server = Server.findById(ctx.request().getParam("id"));
|
||||
Server server = Server.findById(ctx.request().getParam("serverId"));
|
||||
|
||||
if (server == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "Server", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "Server", ctx.request().getParam("serverId"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -44,8 +44,8 @@ public final class DELETEServersId implements Handler<RoutingContext> {
|
||||
|
||||
JsonObject requestBody = ctx.getBodyAsJson();
|
||||
|
||||
if (requestBody.containsKey("addedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("addedBy")), requestBody.getString("addedByIp"), ctx, AuditLogActionType.SERVER_DELETE, ImmutableMap.of("serverId", server.getId()), (ignored, error) -> {
|
||||
if (requestBody.containsKey("removedBy")) {
|
||||
AuditLog.log(UUID.fromString(requestBody.getString("removedBy")), requestBody.getString("removedByIp"), ctx, AuditLogActionType.SERVER_DELETE, ImmutableMap.of("serverId", server.getId()), (ignored, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
|
@ -8,7 +8,7 @@ import net.frozenorb.apiv3.model.Server;
|
||||
public final class GETServersId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
APIv3.respondJson(ctx, Server.findById(ctx.request().getParam("id")));
|
||||
APIv3.respondJson(ctx, Server.findById(ctx.request().getParam("serverId")));
|
||||
}
|
||||
|
||||
}
|
@ -9,7 +9,7 @@ import net.frozenorb.apiv3.util.ErrorUtils;
|
||||
public final class GETUsersId implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
User.findById(ctx.request().getParam("id"), (user, error) -> {
|
||||
User.findById(ctx.request().getParam("userId"), (user, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else {
|
||||
|
@ -10,11 +10,11 @@ import net.frozenorb.apiv3.util.PermissionUtils;
|
||||
public final class GETUsersIdCompoundedPermissions implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
User.findById(ctx.request().getParam("id"), (user, error) -> {
|
||||
User.findById(ctx.request().getParam("userId"), (user, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
} else if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("userId"));
|
||||
} else {
|
||||
user.getCompoundedPermissions((permissions, error2) -> {
|
||||
if (error2 != null) {
|
||||
|
@ -18,11 +18,11 @@ public final class GETUsersIdDetails implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<User> userCallback = new BlockingCallback<>();
|
||||
User.findById(ctx.request().getParam("id"), userCallback);
|
||||
User.findById(ctx.request().getParam("userId"), userCallback);
|
||||
User user = userCallback.get();
|
||||
|
||||
if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("userId"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -12,14 +12,14 @@ import net.frozenorb.apiv3.util.IpUtils;
|
||||
public final class GETUsersIdRequiresTotp implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
User.findById(ctx.request().getParam("id"), (user, error) -> {
|
||||
User.findById(ctx.request().getParam("userId"), (user, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("userId"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -16,23 +16,23 @@ public final class GETUsersIdVerifyPassword implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<User> callback = new BlockingCallback<>();
|
||||
User.findById(ctx.request().getParam("id"), callback);
|
||||
User.findById(ctx.request().getParam("userId"), callback);
|
||||
User user = callback.get();
|
||||
|
||||
if (user == null) {
|
||||
callback = new BlockingCallback<>();
|
||||
User.findByLastUsername(ctx.request().getParam("id"), callback);
|
||||
User.findByLastUsername(ctx.request().getParam("userId"), callback);
|
||||
user = callback.get();
|
||||
}
|
||||
|
||||
if (user == null) {
|
||||
callback = new BlockingCallback<>();
|
||||
User.findByEmail(ctx.request().getParam("id"), callback);
|
||||
User.findByEmail(ctx.request().getParam("userId"), callback);
|
||||
user = callback.get();
|
||||
}
|
||||
|
||||
if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("userId"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -20,11 +20,11 @@ public final class POSTUsersIdChangePassword implements Handler<RoutingContext>
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<User> userCallback = new BlockingCallback<>();
|
||||
User.findById(ctx.request().getParam("id"), userCallback);
|
||||
User.findById(ctx.request().getParam("userId"), userCallback);
|
||||
User user = userCallback.get();
|
||||
|
||||
if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("userId"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -22,14 +22,14 @@ public class POSTUsersIdLeave implements Handler<RoutingContext> {
|
||||
|
||||
Server actorServer = Server.findById(actor.getName());
|
||||
|
||||
User.findById(ctx.request().getParam("id"), ((user, error) -> {
|
||||
User.findById(ctx.request().getParam("userId"), ((user, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("userId"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ import java.util.UUID;
|
||||
public final class POSTUsersIdLogin implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
UUID uuid = UUID.fromString(ctx.request().getParam("id"));
|
||||
UUID uuid = UUID.fromString(ctx.request().getParam("userId"));
|
||||
|
||||
if (!UuidUtils.isAcceptableUuid(uuid)) {
|
||||
ErrorUtils.respondInvalidInput(ctx, "UUID \"" + uuid + "\" is not valid - must be version 4 UUID.");
|
||||
|
@ -17,11 +17,11 @@ public final class POSTUsersIdNotify implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<User> userCallback = new BlockingCallback<>();
|
||||
User.findById(ctx.request().getParam("id"), userCallback);
|
||||
User.findById(ctx.request().getParam("userId"), userCallback);
|
||||
User user = userCallback.get();
|
||||
|
||||
if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("userId"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -21,11 +21,11 @@ public final class POSTUsersIdPasswordReset implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<User> userCallback = new BlockingCallback<>();
|
||||
User.findById(ctx.request().getParam("id"), userCallback);
|
||||
User.findById(ctx.request().getParam("userId"), userCallback);
|
||||
User user = userCallback.get();
|
||||
|
||||
if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("userId"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -22,11 +22,11 @@ public final class POSTUsersIdRegisterEmail implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<User> userCallback = new BlockingCallback<>();
|
||||
User.findById(ctx.request().getParam("id"), userCallback);
|
||||
User.findById(ctx.request().getParam("userId"), userCallback);
|
||||
User user = userCallback.get();
|
||||
|
||||
if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("userId"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -24,11 +24,11 @@ public final class POSTUsersIdRegisterPhone implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<User> userCallback = new BlockingCallback<>();
|
||||
User.findById(ctx.request().getParam("id"), userCallback);
|
||||
User.findById(ctx.request().getParam("userId"), userCallback);
|
||||
User user = userCallback.get();
|
||||
|
||||
if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("userId"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,11 @@ public final class POSTUsersIdSetupTotp implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
BlockingCallback<User> userCallback = new BlockingCallback<>();
|
||||
User.findById(ctx.request().getParam("id"), userCallback);
|
||||
User.findById(ctx.request().getParam("userId"), userCallback);
|
||||
User user = userCallback.get();
|
||||
|
||||
if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("userId"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -14,14 +14,14 @@ import net.frozenorb.apiv3.util.IpUtils;
|
||||
public final class POSTUsersIdVerifyTotp implements Handler<RoutingContext> {
|
||||
|
||||
public void handle(RoutingContext ctx) {
|
||||
User.findById(ctx.request().getParam("id"), (user, error) -> {
|
||||
User.findById(ctx.request().getParam("userId"), (user, error) -> {
|
||||
if (error != null) {
|
||||
ErrorUtils.respondInternalError(ctx, error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (user == null) {
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("id"));
|
||||
ErrorUtils.respondNotFound(ctx, "User", ctx.request().getParam("userId"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user