Skip to content

Commit 7a63ebc

Browse files
Merge pull request #5743 from Countly/group-edit
[SER-1784] [core] Update global admin check when updating group
2 parents ece5c47 + e1434a6 commit 7a63ebc

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Version 24.05.XX
22
Fixes:
33
- [script] Fixing bug with "delete_old_members" script that led to malformed requests
4+
- [core] Fixed bug where changing passwords results in the loss of the "Global Admin" role
45

56
## Version 24.05.17
67
Fixes:

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -949,8 +949,20 @@
949949
watch: {
950950
'groups': function() {
951951
if (this.groups.length > 0) {
952-
// Remove global admin role if user is assigned to any group
953-
this.$refs.userDrawer.editedObject.global_admin = false;
952+
// Remove global admin role if the assigned groups does not have global admin access
953+
var groupHasGlobalAdmin = false;
954+
955+
this.groups.forEach(function(grpId) {
956+
var group = groupsModel.data().find(function(grp) {
957+
return grpId === grp._id;
958+
});
959+
960+
if (group && group.global_admin === true) {
961+
groupHasGlobalAdmin = true;
962+
}
963+
});
964+
965+
this.$refs.userDrawer.editedObject.global_admin = groupHasGlobalAdmin;
954966
}
955967

956968
if (this.groups.length === 0) {
@@ -1152,4 +1164,4 @@
11521164
countlyVue.container.registerData("user-management/edit-user-drawer", {
11531165
component: Drawer
11541166
});
1155-
})();
1167+
})();

0 commit comments

Comments
 (0)