(function () {
    "use strict";

    function UserGroupsController($scope, $timeout, $location, $filter, userService, userGroupsResource, 
        formHelper, localizationService, listViewHelper) {

        var vm = this;

        vm.userGroups = [];
        vm.selection = [];

        vm.clickUserGroupName = clickUserGroupName;
        vm.createUserGroup = createUserGroup;
        vm.clearSelection = clearSelection;
        vm.selectUserGroup = selectUserGroup;
        vm.deleteUserGroups = deleteUserGroups;

        var currentUser = null;

        function onInit() {

            vm.loading = true;

            userService.getCurrentUser().then(function(user) {
                currentUser = user;
                // Get usergroups
                userGroupsResource.getUserGroups({ onlyCurrentUserGroups: false }).then(function (userGroups) {

                    // only allow editing and selection if user is member of the group or admin
                    vm.userGroups = _.map(userGroups, function (ug) {
                        ug.hasAccess = user.userGroups.indexOf(ug.alias) !== -1 || user.userGroups.indexOf("admin") !== -1;
                        return ug;
                    });
                    vm.filteredUserGroups = vm.userGroups;

                    vm.loading = false;
                });
            });

        }

        function createUserGroup() {
            // clear all query params
            $location.search({});
            // go to create user group
            $location.path('users/users/group/-1').search("create", "true");;
        }
        
        function goToUserGroup(userGroup, $event) {
            
            // only allow editing if user is member of the group or admin
            if (currentUser.userGroups.indexOf(userGroup.alias) === -1 && currentUser.userGroups.indexOf("admin") === -1) {
                return;
            }
            $location.path(getEditPath(userGroup)).search("create", null);
        }
        
        function clickUserGroupName(item, $event) {
           if(!($event.metaKey || $event.ctrlKey)) {
              goToUserGroup(item, $event);
              $event.preventDefault();
           }
           $event.stopPropagation();
        };
        
        function getEditPath(userGroup) {
            
            // only allow editing if user is member of the group or admin
            if (currentUser.userGroups.indexOf(userGroup.alias) === -1 && currentUser.userGroups.indexOf("admin") === -1) {
                return "";
            }
            
            return 'users/users/group/' + userGroup.id;
        }

        function selectUserGroup(userGroup, $index, $event) {
            
            // Only allow selection if user is member of the group or admin
            if (currentUser.userGroups.indexOf(userGroup.alias) === -1 && currentUser.userGroups.indexOf("admin") === -1) {
                return;
            }
            // Disallow selection of the admin/translators group, the checkbox is not visible in the UI, but clicking(and thus selecting) is still possible.
            // Currently selection can only be used for deleting, and the Controller will also disallow deleting the admin group.
            if (userGroup.alias === "admin" || userGroup.alias === "translator")
                return;
            
            listViewHelper.selectHandler(userGroup, $index, vm.userGroups, vm.selection, $event);
            
            if(event) {
                event.stopPropagation();
            }
        }

        function deleteUserGroups() {

            if(vm.selection.length > 0) {

                localizationService.localize("defaultdialogs_confirmdelete")
                    .then(function(value) {

                        var confirmResponse = confirm(value);

                        if (confirmResponse === true) {
                            userGroupsResource.deleteUserGroups(_.pluck(vm.selection, "id")).then(function (data) {
                                clearSelection();
                                onInit();
                            }, angular.noop);
                        }

                    });

            }
        }

        function clearSelection() {
            angular.forEach(vm.userGroups, function (userGroup) {
                userGroup.selected = false;
            });
            vm.selection = [];
        }

        var unbindFilterWatcher = $scope.$watch("vm.filter", function (newVal, oldVal) {
            vm.filteredUserGroups = $filter('filter')(vm.userGroups, vm.filter);
        });

        $scope.$on("$destroy", function () {
            unbindFilterWatcher();
        });

        onInit();

    }

    angular.module("umbraco").controller("Umbraco.Editors.Users.GroupsController", UserGroupsController);

})();

@@ -188,16 +188,32 @@
 ewHelper
+, overlayService
 ) %7B%0A%0A   
@@ -3679,17 +3679,40 @@
 localize
-(
+Many(%5B%22general_delete%22, 
 %22default
@@ -3737,174 +3737,600 @@
 ete%22
-)%0A                    .then(function(value) %7B%0A%0A                        var confirmResponse = confirm(value);%0A%0A                        if (confirmResponse === true) %7B%0A
+, %22general_cancel%22, %22contentTypeEditor_yesDelete%22%5D)%0A                    .then(function (data) %7B%0A                        const overlay = %7B%0A                            title: data%5B0%5D,%0A                            content: data%5B1%5D + %22?%22,%0A                            closeButtonLabel: data%5B2%5D,%0A                            submitButtonLabel: data%5B3%5D,%0A                            submitButtonStyle: %22danger%22,%0A                            close: function () %7B%0A                                overlayService.close();%0A                            %7D,%0A                            submit: function () %7B%0A    
     
@@ -4473,16 +4473,20 @@
         
+    
 clearSel
@@ -4487,32 +4487,36 @@
 earSelection();%0A
+    
                 
@@ -4569,16 +4569,20 @@
         
+    
 %7D, angul
@@ -4607,34 +4607,174 @@
                 
-%7D%0A
+        overlayService.close();%0A                            %7D%0A                        %7D;%0A                        overlayService.open(overlay);
 %0A               

Use an Umbraco confirm dialog when deleting groups