From 1f76bef2320efb8d342e3cfb6d70325a914ae3b8 Mon Sep 17 00:00:00 2001 From: Ainur Date: Wed, 20 Sep 2023 18:05:20 +0200 Subject: [PATCH] CB-3945 subject object event fixes --- .../src/io/cloudbeaver/model/session/WebUserContext.java | 1 + .../service/security/CBEmbeddedSecurityController.java | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/session/WebUserContext.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/session/WebUserContext.java index 36b70e0b8a8..a9cab6694d4 100644 --- a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/session/WebUserContext.java +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/session/WebUserContext.java @@ -147,6 +147,7 @@ public synchronized void refreshSMSession() throws DBException { smCredentials.getSmSessionId(), smCredentials.getPermissions() ); + setUser(user == null ? null : new WebUser(securityController.getCurrentUser())); } /** diff --git a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/CBEmbeddedSecurityController.java b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/CBEmbeddedSecurityController.java index 875de6b57db..5b36cf3b522 100644 --- a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/CBEmbeddedSecurityController.java +++ b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/CBEmbeddedSecurityController.java @@ -2213,11 +2213,7 @@ public void setObjectPermissions( @NotNull Set permissions, @NotNull String grantor ) throws DBException { - if (CommonUtils.isEmpty(objectIds)) { - subjectIds.forEach(id -> addSubjectPermissionsUpdateEvent(id, null)); - return; - } else if (CommonUtils.isEmpty(subjectIds)) { - addObjectPermissionsUpdateEvent(objectIds, objectType); + if (CommonUtils.isEmpty(objectIds) || CommonUtils.isEmpty(subjectIds)) { return; } Set filteredSubjects = getFilteredSubjects(subjectIds); @@ -2307,6 +2303,7 @@ public void deleteAllObjectPermissions(@NotNull String objectId, @NotNull SMObje } catch (SQLException e) { throw new DBCException("Error deleting object permissions", e); } + addObjectPermissionsUpdateEvent(Set.of(objectId), objectType); } @Override @@ -2321,6 +2318,7 @@ public void deleteAllSubjectObjectPermissions(@NotNull String subjectId, @NotNul } catch (SQLException e) { throw new DBCException("Error deleting subject permissions", e); } + addSubjectPermissionsUpdateEvent(subjectId, null); } @NotNull