Don't send access unless needed
This commit is contained in:
parent
8d66bd1568
commit
95d8a45d86
@ -255,7 +255,6 @@ public final class User {
|
||||
List<Rank> ranks = getRanksScoped(serverGroup, grants);
|
||||
|
||||
result.put("user", this);
|
||||
result.put("access", accessInfo);
|
||||
result.put("bestRank", ranks.get(0).getId());
|
||||
result.put("ranks", ranks.stream().map(Rank::getId).collect(Collectors.toList()));
|
||||
result.put("totpSetup", getTotpSecret() != null);
|
||||
@ -264,6 +263,10 @@ public final class User {
|
||||
result.put("mute", activeMute);
|
||||
}
|
||||
|
||||
if (accessInfo != null) {
|
||||
result.put("access", accessInfo);
|
||||
}
|
||||
|
||||
callback.onResult(result, null);
|
||||
});
|
||||
}
|
||||
@ -286,11 +289,6 @@ public final class User {
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> accessAllowed = ImmutableMap.of(
|
||||
"allowed", true,
|
||||
"message", ""
|
||||
);
|
||||
|
||||
if (activeBan != null) {
|
||||
callback.onResult(ImmutableMap.of(
|
||||
"allowed", false,
|
||||
@ -330,15 +328,17 @@ public final class User {
|
||||
hasPermissionAnywhere(Permissions.BYPASS_VPN_CHECK, (bypass, error) -> {
|
||||
if (error != null) {
|
||||
callback.onResult(null, error);
|
||||
} else if (bypass) {
|
||||
callback.onResult(null, null);
|
||||
} else {
|
||||
callback.onResult(bypass ? accessAllowed : finalProposedAccess, null);
|
||||
callback.onResult(finalProposedAccess, null);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
callback.onResult(accessAllowed, null);
|
||||
callback.onResult(null, null);
|
||||
}
|
||||
} else {
|
||||
callback.onResult(accessAllowed, null);
|
||||
callback.onResult(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user