dbeaver/pro#6303 do not remove default user team (#3609)

* dbeaver/pro#6303 do not remove default user team

* dbeaver/pro#6303 throw error

---------

Co-authored-by: kseniaguzeeva <112612526+kseniaguzeeva@users.noreply.github.com>
This commit is contained in:
Alexander Skoblikov
2025-07-29 13:17:09 +02:00
committed by GitHub
co-authored by kseniaguzeeva
parent 58c4744aa7
commit 57e77b7cd1
@@ -411,7 +411,14 @@ public class CBEmbeddedSecurityController<T extends ServletAuthApplication>
@NotNull Connection dbCon,
@NotNull String userId,
@NotNull String[] teamIds
) throws SQLException {
) throws SQLException, DBCException {
String defaultTeam = getDefaultUserTeam();
if (ArrayUtils.contains(teamIds, defaultTeam)) {
throw new SMException("Cannot delete default user team: " + defaultTeam);
}
if (ArrayUtils.isEmpty(teamIds)) {
return;
}
String deleteUserTeamsSql = "DELETE FROM {table_prefix}CB_USER_TEAM WHERE USER_ID=? " +
"AND TEAM_ID IN (" + SQLUtils.generateParamList(teamIds.length) + ")";