From b4f2de79b80bacb90705f1b21a64c02b23a1d6bb Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 24 Aug 2022 13:52:39 +0200 Subject: [PATCH] Bugfix: Variant permission languages needs a clear cache to work fully for current user (#12875) * emit event when user group is saved * clear current user cache when languages and user groups are saved (cherry picked from commit 128dd42b4711fad2cc1b0a5324934daa0af7a560) --- .../src/common/services/user.service.js | 12 +++++++++++- .../src/views/users/group.controller.js | 7 ++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/services/user.service.js b/src/Umbraco.Web.UI.Client/src/common/services/user.service.js index 00871caab1..ee9aa0864f 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/user.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/user.service.js @@ -8,6 +8,14 @@ angular.module('umbraco.services') // this is used so that we know when to go and get the user's remaining seconds directly. var lastServerTimeoutSet = null; + eventsService.on("editors.languages.languageSaved", () => { + service.refreshCurrentUser(); + }); + + eventsService.on("editors.userGroups.userGroupSaved", () => { + service.refreshCurrentUser(); + }); + function openLoginDialog(isTimedOut) { //broadcast a global event that the user is no longer logged in const args = { isTimedOut: isTimedOut }; @@ -158,7 +166,7 @@ angular.module('umbraco.services') } }); - return { + const service = { /** Internal method to display the login dialog */ _showLoginDialog: function () { @@ -292,4 +300,6 @@ angular.module('umbraco.services') } }; + return service; + }); diff --git a/src/Umbraco.Web.UI.Client/src/views/users/group.controller.js b/src/Umbraco.Web.UI.Client/src/views/users/group.controller.js index 6e8238b431..712aa6fef3 100644 --- a/src/Umbraco.Web.UI.Client/src/views/users/group.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/users/group.controller.js @@ -1,7 +1,7 @@ (function () { "use strict"; - function UserGroupEditController($scope, $location, $routeParams, userGroupsResource, localizationService, contentEditingHelper, editorService, overlayService) { + function UserGroupEditController($scope, $location, $routeParams, userGroupsResource, localizationService, contentEditingHelper, editorService, overlayService, eventsService) { var infiniteMode = $scope.model && $scope.model.infiniteMode; var id = infiniteMode ? $scope.model.id : $routeParams.id; @@ -107,6 +107,11 @@ setSectionIcon(vm.userGroup.sections); makeBreadcrumbs(); vm.page.saveButtonState = "success"; + + eventsService.emit("editors.userGroups.userGroupSaved", { + userGroup: vm.userGroup, + isNew: create + }); } }, function (err) { vm.page.saveButtonState = "error";