@DeleteMapping
    @Secured(resource = AuthConstants.CONSOLE_RESOURCE_NAME_PREFIX + "users", action = ActionTypes.WRITE)
    public Object deleteUser(@RequestParam String username) {
        List<RoleInfo> roleInfoList = roleService.getRoles(username);
        if (roleInfoList != null) {
            for (RoleInfo roleInfo : roleInfoList) {
                if (AuthConstants.GLOBAL_ADMIN_ROLE.equals(roleInfo.getRole())) {
                    throw new IllegalArgumentException("cannot delete admin: " + username);
                }
            }
        }
        userDetailsService.deleteUser(username);
        return RestResultUtils.success("delete user ok!");
    }
@Test
    void testDeleteUser2() {
        List<RoleInfo> roleInfoList = new ArrayList<>(1);
        RoleInfo testRole = new RoleInfo();
        testRole.setUsername("nacos");
        testRole.setRole("testRole");
        roleInfoList.add(testRole);
        
        when(roleService.getRoles(anyString())).thenReturn(roleInfoList);
        
        RestResult<String> result = (RestResult<String>) userController.deleteUser("nacos");
        assertEquals(200, result.getCode());
    }