コード例 #1
0
        public async Task <JsonResult> ChangeTicketState(int?ticketId, int?state)
        {
            if (ticketId != null && state != null && ticketId > 0 && state >= 0 && state <= 3)
            {
                User curUser = await userManager.GetCurrentUser();

                Ticket ticket = await ticketManager.GetTicketNoInclude(ticketId);

                if (curUser != null && ticket != null)
                {
                    TeamPermissions teamPerms = await GetCurrentTeamPermissions(ticket.TeamId, curUser.Id);

                    if (curUser.AppRole.Permissions.IsAdmin || teamPerms.CanChangeTicketState)
                    {
                        await ticketManager.ChangeState(ticketId, state, curUser);

                        return(Json(true));
                    }
                }
            }
            return(Json(false));
        }