Пример #1
0
        public async Task <IActionResult> ApproveUser(string userId, bool isClubAdmin = false, bool isCityAdmin = false)
        {
            if (userId != null)
            {
                await _confirmedUserService.CreateAsync(User, userId, isClubAdmin, isCityAdmin);

                return(RedirectToAction("Approvers", "Account", new { userId = userId }));
            }
            _loggerService.LogError("User id is null");
            return(RedirectToAction("HandleError", "Error", new { code = 500 }));
        }
Пример #2
0
        public async Task <IActionResult> ApproveUser(string userId, bool isClubAdmin = false, bool isCityAdmin = false)
        {
            if (userId != null)
            {
                await _confirmedUserService.CreateAsync(await _userManager.GetUserAsync(User), userId, isClubAdmin, isCityAdmin);

                return(Ok());
            }
            _loggerService.LogError("User id is null");

            return(NotFound());
        }
Пример #3
0
        public async Task <IActionResult> ApproveUser(string userId, bool isClubAdmin = false, bool isCityAdmin = false)
        {
            if (userId != null)
            {
                var userRoles = await _userManagerService.GetRolesAsync(await _userService.GetUserAsync(userId));

                if (!userRoles.Any(r => r == Roles.RegisteredUser || r == Roles.FormerPlastMember))
                {
                    await _confirmedUserService.CreateAsync(await _userManager.GetUserAsync(User), userId, isClubAdmin, isCityAdmin);

                    return(Ok());
                }
                _loggerService.LogError("Forbidden");
                return(StatusCode(StatusCodes.Status403Forbidden));
            }
            _loggerService.LogError("User id is null");
            return(NotFound());
        }