@@ -182,7 +182,7 @@ public class ClientController extends Controller {
|
|||||||
if (optUser.isEmpty()) return invalidSessionUser(ex);
|
if (optUser.isEmpty()) return invalidSessionUser(ex);
|
||||||
if (!optUser.get().hasPermission(MANAGE_CLIENTS)) return sendEmptyResponse(HTTP_FORBIDDEN, ex);
|
if (!optUser.get().hasPermission(MANAGE_CLIENTS)) return sendEmptyResponse(HTTP_FORBIDDEN, ex);
|
||||||
var json = new JSONObject();
|
var json = new JSONObject();
|
||||||
clients.listClients().forEach(client -> json.put(client.id(), client.map()));
|
clients.listClients().stream().sorted(Comparator.comparing(Client::name)).forEach(client -> json.put(client.id(), client.map()));
|
||||||
return sendContent(ex, json);
|
return sendContent(ex, json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import jakarta.mail.*;
|
|||||||
import jakarta.mail.internet.*;
|
import jakarta.mail.internet.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -186,7 +187,7 @@ public class UserController extends Controller {
|
|||||||
private boolean list(HttpExchange ex, User user) throws IOException {
|
private boolean list(HttpExchange ex, User user) throws IOException {
|
||||||
if (!user.hasPermission(MANAGE_USERS)) return sendEmptyResponse(HTTP_FORBIDDEN, ex);
|
if (!user.hasPermission(MANAGE_USERS)) return sendEmptyResponse(HTTP_FORBIDDEN, ex);
|
||||||
var json = new JSONObject();
|
var json = new JSONObject();
|
||||||
users.list().forEach(u -> json.put(u.uuid(), u.map(false)));
|
users.list().stream().sorted(Comparator.comparing(User::username)).forEach(u -> json.put(u.uuid(), u.map(false)));
|
||||||
return sendContent(ex, json);
|
return sendContent(ex, json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user