Skip to content

Commit 3acfaf8

Browse files
authored
Merge pull request #6856 from Countly/groups-update-24
Fix user permission update after updating user group permission
2 parents 0beef10 + a1b9ac2 commit 3acfaf8

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
## Version 24.05.xx
1+
## Version 24.05.X
22
Enterprise Fixes:
3+
- [groups] Fix user permission update after updating user group permission
34
- [revenue] Card in revenue page are now correctly indentified
45

6+
57
## Version 24.05.43
68
Features:
79
- [core] Implement go to link in notification

frontend/express/public/core/user-management/javascripts/countly.views.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,7 @@
847847
}
848848
},
849849
onOpen: function() {
850+
this.patchUserPermission();
850851
this.changePasswordFlag = false;
851852
// types
852853
var types = ['c', 'r', 'u', 'd'];
@@ -860,7 +861,7 @@
860861
// if it's in edit mode
861862
if (this.settings.editMode) {
862863
// is user member of a group?
863-
if (this.user.group_id && countlyGlobal.plugins.indexOf('groups') > -1) {
864+
if (this.user.group_id && this.user.group_id.length && countlyGlobal.plugins.indexOf('groups') > -1) {
864865
// set groups state
865866
if (Array.isArray(this.user.group_id)) {
866867
this.groups = this.user.group_id;
@@ -963,7 +964,31 @@
963964
},
964965
onRoleChange: function(role) {
965966
this.roles[role.name] = role;
966-
}
967+
},
968+
patchUserPermission: function() {
969+
if (this.user && this.user.permission && this.user.permission._ && this.user.permission._.u) {
970+
var appIdReducer = function(acc, curr) {
971+
if (curr.length > 0) {
972+
acc.push(curr);
973+
}
974+
return acc;
975+
};
976+
977+
var _u = this.user.permission._.u.reduce(function(acc, curr) {
978+
if (curr.length > 0) {
979+
var appIds = curr.reduce(appIdReducer, []);
980+
981+
if (appIds.length > 0) {
982+
acc.push(appIds);
983+
}
984+
}
985+
return acc;
986+
}, []);
987+
988+
this.user.permission._.u = _u;
989+
this.$refs.userDrawer.editedObject.permission._.u = _u;
990+
}
991+
},
967992
},
968993
watch: {
969994
'groups': function() {

0 commit comments

Comments
 (0)