There seems to be the same problem again, with setting a moderator.
I've downloaded the latest version of union server, the latest reactor and the latest union admin tool.
And again, there's the same problem which was in earlier versions of union. I wanna set some account a moderator. When I select the account thru union admin tool, click "set moderator" it says "account is now a moderator" then I quickly go to "user accounts" tab, click that account and see the line: Moderator: Yes and it changes to - (dash) right away, this occurs all the time.
When I launch my client, it says account is not a moderator.
I removed the account and created it anew. It didn't help.
The mechanism is definitely "buggy" again. There was probably some error injection in union source like before.
All a could do to mend the problem in any way was to create a server-side method that does this job:
- Code: Select all
public void setModerator(Message message, Client client) {
if (!client.isLoggedIn()) return;
String userID = client.getAccount().getUserID();
if (isAdminAccount(userID)) {
String accountToSetModer = message.getArg("account");
if (accountToSetModer != null) {
try {
server.getAccount(accountToSetModer).setModerator(true);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
public static boolean isAdminAccount(String userID) {
for (AllowedAccount aa : ALLOWED_ACCS) {
if (aa.account.equals(userID)) {
return true;
}
}
return false;
}
And to send its state message to client so that it could know that account is privileged.
The server-side code seems to work correctly.
regards, Konstantin.