mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-10-13 16:18:51 +08:00
Merge pull request #1230 from dbeaver/hotfix/CB-2785
CB-2785 delete user fix
This commit is contained in:
+9
@@ -158,6 +158,7 @@ public class CBEmbeddedSecurityController implements SMAdminController, SMAuthen
|
||||
|
||||
@Override
|
||||
public void deleteUser(String userId) throws DBCException {
|
||||
invalidateAllUserTokens(userId);
|
||||
try (Connection dbCon = database.openConnection()) {
|
||||
try (JDBCTransaction txn = new JDBCTransaction(dbCon)) {
|
||||
deleteAuthSubject(dbCon, userId);
|
||||
@@ -1221,6 +1222,14 @@ public class CBEmbeddedSecurityController implements SMAdminController, SMAuthen
|
||||
}
|
||||
}
|
||||
|
||||
private void invalidateAllUserTokens(String userId) throws DBCException {
|
||||
try (Connection dbCon = database.openConnection()) {
|
||||
JDBCUtils.executeStatement(dbCon, "DELETE FROM CB_AUTH_TOKEN WHERE USER_ID=?", userId);
|
||||
} catch (SQLException e) {
|
||||
throw new DBCException("Session invalidation failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
private SMCredentials getCurrentUserCreds() throws SMException {
|
||||
var currentUserCreds = credentialsProvider.getActiveUserCredentials();
|
||||
if (currentUserCreds == null) {
|
||||
|
||||
Reference in New Issue
Block a user