Beispiel #1
0
        public List <string> UsersInRoleOnProject(int projectId, string roleName)
        {
            var people = new List <string>();

            foreach (var user in UsersOnProject(projectId).ToList())
            {
                if (roleHelper.IsUserInRole(user.Id, roleName))
                {
                    people.Add(user.Id);
                }
            }
            return(people);
        }
        public void AssignDevToTicket(string userId, int ticketId)
        {
            if (!IsDevAssignedToTicket(userId, ticketId))
            {
                Ticket ticket = db.Tickets.Find(ticketId);
                var    newDev = roleHelper.IsUserInRole(userId, "Developer");

                ticket.AssignedToUserId.ToList();
                db.SaveChanges();
            }
        }
Beispiel #3
0
        public ICollection <Ticket> PMTickets(string userId)
        {
            var pmTickets = new List <Ticket>();

            if (userRoles.IsUserInRole(user.Id, "Project Manager"))
            {
                pmTickets = db.Tickets.Where(t => t.Project.ProjectUsers.Any(u => u.Id == userId) && t.Archived == false).ToList();
            }


            return(pmTickets);
        }
Beispiel #4
0
        //public ICollection<ApplicationUser> UsersNotOnTicket()
        //{
        //    var userId = db.Users.ToString();
        //    return db.Tickets.Where(t => t.Users.All(u => u.Id != userId)).ToList();
        //    return db.Users.Where(u => u.Tickets.All(p => p.Id != ticketId)).ToList();

        //}

        public ICollection <string> GetTicketUserRoles(string roleName, int ticketId)
        {
            var users       = UsersOnTicket(ticketId);
            var usersInRole = new List <string>();
            var roleHelper  = new UserRolesHelper();

            foreach (var user in users)
            {
                if (roleHelper.IsUserInRole(user.Id, roleName))
                {
                    usersInRole.Add(user.FirstName + " " + user.LastName);
                }
            }
            return(usersInRole);
        }
Beispiel #5
0
        public ICollection <string> GetProjectUserRoles(string roleName, int projectId)
        {
            var users       = UsersOnProject(projectId);
            var usersInRole = new List <string>();
            var roleHelper  = new UserRolesHelper();

            foreach (var user in users)
            {
                if (roleHelper.IsUserInRole(user.Id, roleName))
                {
                    usersInRole.Add(user.Email);
                }
            }
            return(usersInRole);
        }
        public bool PMProject(int projId)
        {
            user = db.Users.Find(HttpContext.Current.User.Identity.GetUserId());
            var onProject = projHelper.IsUserOnProject(user.Id, projId);
            var isPM      = userRoles.IsUserInRole(user.Id, "Project Manager");

            if (onProject && isPM)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }