[BUG] Fix incorrect result for passed access control checks

This commit is contained in:
2023-10-28 20:06:17 +02:00
parent b4485775e3
commit 2870ca5991
2 changed files with 8 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
version_major=0
version_minor=0
version_patch=30
version_patch=31
shade_group=com.hypherionmc.sdlink.shaded.

View File

@@ -266,8 +266,8 @@ public class MinecraftAccount {
case "memberNotFound" -> {
return Result.error(SDLinkConfig.INSTANCE.accessControl.verificationMessages.nonMember);
}
case "verificationFailed" -> {
return Result.error("Failed to complete verification checks. Please notify the server owner");
case "rolesNotLoaded" -> {
return Result.error("Server has required roles configured, but no discord roles were loaded. Please notify the server owner");
}
case "rolesNotFound" -> {
return Result.error(SDLinkConfig.INSTANCE
@@ -301,7 +301,10 @@ public class MinecraftAccount {
}
if (!SDLinkConfig.INSTANCE.accessControl.requiredRoles.isEmpty() && !RoleManager.getVerificationRoles().isEmpty()) {
if (!SDLinkConfig.INSTANCE.accessControl.requiredRoles.isEmpty()) {
if (RoleManager.getVerificationRoles().isEmpty())
return Result.error("rolesNotLoaded");
Profiler profiler = Profiler.getProfiler("checkRequiredRoles");
profiler.start("Checking Required Roles");
AtomicBoolean anyFound = new AtomicBoolean(false);
@@ -323,7 +326,7 @@ public class MinecraftAccount {
return Result.error("memberNotFound");
}
return Result.error("verificationFailed");
return Result.success("pass");
}
public String getUsername() {