fix(housekeeping): allow core rank peer actions

Keep the housekeeping rank ceiling for normal staff, but treat the highest configured rank as the core rank so rank 7 can act on other rank 7 users without opening peer actions for lower staff ranks.

Tests: mvn '-Dtest=HousekeepingTargetRankGuardContractTest,HousekeepingMutationGuardTest,HousekeepingSetUserRankEventTest,HousekeepingTargetRankGuardContractTest' test
This commit is contained in:
simoleo89
2026-06-14 20:20:00 +02:00
parent 9ac50600f6
commit 2b18ca2deb
2 changed files with 21 additions and 4 deletions
@@ -24,11 +24,15 @@ class HousekeepingTargetRankGuardContractTest {
);
@Test
void privilegedUserActionsRejectPeerAndHigherRankTargets() throws Exception {
void privilegedUserActionsRejectPeerRanksUnlessOperatorIsCoreRank() throws Exception {
String guard = Files.readString(Path.of("src/main/java/com/eu/habbo/messages/incoming/housekeeping/HousekeepingTargetRankGuard.java"));
assertTrue(guard.contains("targetInfo.getRank().getId() < operator.getHabboInfo().getRank().getId()"),
"Housekeeping user actions must only target lower-ranked users");
assertTrue(guard.contains("targetRankId < operatorRankId"),
"non-core housekeeping operators must only target lower-ranked users");
assertTrue(guard.contains("isCoreRank(operatorRankId) && targetRankId <= operatorRankId"),
"the highest/core rank should be allowed to target peer ranks");
assertTrue(guard.contains("private static boolean isCoreRank(int rankId)"),
"core-rank detection should be centralized in the target-rank guard");
}
@Test