mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
Merge pull request #2796 from spjspj/master
spjspj - Add Set Active to server console
This commit is contained in:
commit
6ffa1dc146
1 changed files with 4 additions and 0 deletions
|
@ -1011,12 +1011,16 @@ public class MageServerImpl implements MageServer {
|
||||||
@Override
|
@Override
|
||||||
public void setActivation(final String sessionId, final String userName, boolean active) throws MageException {
|
public void setActivation(final String sessionId, final String userName, boolean active) throws MageException {
|
||||||
execute("setActivation", sessionId, () -> {
|
execute("setActivation", sessionId, () -> {
|
||||||
|
AuthorizedUser authorizedUser = AuthorizedUserRepository.instance.getByName(userName);
|
||||||
User user = UserManager.getInstance().getUserByName(userName);
|
User user = UserManager.getInstance().getUserByName(userName);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
user.setActive(active);
|
user.setActive(active);
|
||||||
if (!user.isActive() && user.isConnected()) {
|
if (!user.isActive() && user.isConnected()) {
|
||||||
SessionManager.getInstance().disconnectUser(sessionId, user.getSessionId());
|
SessionManager.getInstance().disconnectUser(sessionId, user.getSessionId());
|
||||||
}
|
}
|
||||||
|
} else if (authorizedUser != null) {
|
||||||
|
User theUser = new User(userName, "localhost", authorizedUser);
|
||||||
|
theUser.setActive(active);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue