Example #1
0
        public async Task <IActionResult> GetUserInProject(int projectId)
        {
            EnumProjectAccessRight projectAccessRight = await _getAccessUser.GetUserAccessRightProject(Convert.ToInt32(HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier)), projectId);

            if (!HttpContext.User.IsInRole("admin") && projectAccessRight == EnumProjectAccessRight.None)
            {
                return(StatusCode(403, "Access Denied !"));
            }

            IEnumerable <UserInProjectData> result = await _projectGateway.GetUserInProject(projectId);

            if (result == null)
            {
                return(BadRequest("Project has no user"));
            }

            return(Ok(result));
        }