public async Task <IActionResult> EditModList(int serverId)
        {
            if (!await RightsHandler.HasRightsToThisPavlovServer(HttpContext.User,
                                                                 await _userservice.getUserFromCp(HttpContext.User), serverId, _service, _pavlovServerService))
            {
                return(Forbid());
            }
            var server = await _pavlovServerService.FindOne(serverId);

            var tmpUserIds = await _userservice.FindAll();

            var userIds = new List <LiteDbUser>();
            var isAdmin = false;
            var isMod   = false;

            foreach (var user in tmpUserIds)
            {
                if (user != null)
                {
                    isAdmin = await UserManager.IsInRoleAsync(user, "Admin");

                    isMod = await UserManager.IsInRoleAsync(user, "Mod");

                    var steamIdentity = await _steamIdentityService.FindOne(user.Id);

                    if (!isAdmin && !isMod && steamIdentity != null)
                    {
                        userIds.Add(user);
                    }
                }
            }

            var selectedUserIds = await _serverSelectedModsService.FindAllFrom(server);

            //service
            var model = new PavlovServerModlistViewModel
            {
                userIds        = selectedUserIds.Select(x => x.LiteDbUser.Id.ToString()).ToList(),
                pavlovServerId = server.Id
            };

            ViewBag.Users = userIds.ToList();
            return(View("ModList", model));
        }
        public async Task <IActionResult> SaveModList(PavlovServerModlistViewModel pavlovServerModlistViewModel)
        {
            if (!await RightsHandler.HasRightsToThisPavlovServer(HttpContext.User,
                                                                 await _userservice.getUserFromCp(HttpContext.User), pavlovServerModlistViewModel.pavlovServerId,
                                                                 _service, _pavlovServerService))
            {
                return(Forbid());
            }
            var server = await _pavlovServerService.FindOne(pavlovServerModlistViewModel.pavlovServerId);

            try
            {
                await _serverSelectedModsService.SaveModListToFileAndDb(pavlovServerModlistViewModel.userIds, server);
            }
            catch (CommandException e)
            {
                return(BadRequest(e.Message));
            }

            //service
            return(RedirectToAction("Index", "SshServer"));
        }