Beispiel #1
0
        public virtual void SetTeamSecurity(Project project, Participant participant, ProjectTeamSecurity teamSecurity, bool visible)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }
            if (participant == null)
            {
                throw new ArgumentNullException("participant");
            }

            ProjectSecurity.DemandEditTeam(project);

            var security = projectDao.GetTeamSecurity(project.ID, participant.ID);

            if (visible)
            {
                if (security != ProjectTeamSecurity.None)
                {
                    security ^= teamSecurity;
                }
            }
            else
            {
                security |= teamSecurity;
            }
            projectDao.SetTeamSecurity(project.ID, participant.ID, security);
        }
Beispiel #2
0
        public virtual void UpdateTeam(Project project, IEnumerable <Guid> participants, bool notify)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }
            if (participants == null)
            {
                throw new ArgumentNullException("participants");
            }

            ProjectSecurity.DemandEditTeam(project);

            var newTeam = participants.Select(p => new Participant(p)).ToList();
            var oldTeam = GetTeam(project.ID);

            var removeFromTeam = oldTeam.Where(p => !newTeam.Contains(p)).Where(p => p.ID != project.Responsible).ToList();
            var inviteToTeam   = new List <Participant>();

            foreach (var participant in newTeam.Where(participant => !oldTeam.Contains(participant)))
            {
                participantDao.RemoveFromFollowingProjects(project.ID, participant.ID);
                inviteToTeam.Add(participant);
            }

            foreach (var participant in inviteToTeam)
            {
                AddToTeam(project, participant, notify);
            }

            foreach (var participant in removeFromTeam)
            {
                RemoveFromTeam(project, participant, notify);
            }
        }
Beispiel #3
0
        public void SetTeamSecurity(Project project, Guid participant, ProjectTeamSecurity teamSecurity)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            ProjectSecurity.DemandEditTeam(project);

            DaoFactory.ProjectDao.SetTeamSecurity(project.ID, participant, teamSecurity);
        }
Beispiel #4
0
        public void AddToTeam(Project project, Guid participant, bool sendNotification)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            ProjectSecurity.DemandEditTeam(project);
            DaoFactory.ProjectDao.AddToTeam(project.ID, participant);

            if (!DisableNotifications && sendNotification && !project.Responsible.Equals(participant) && participant != SecurityContext.CurrentAccount.ID)
            {
                NotifyClient.Instance.SendInvaiteToProjectTeam(participant, project);
            }
        }
Beispiel #5
0
        public virtual void ResetTeamSecurity(Project project)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            ProjectSecurity.DemandEditTeam(project);

            var participant = GetTeam(project.ID);

            foreach (var part in participant)
            {
                projectDao.SetTeamSecurity(project.ID, part.ID, ProjectTeamSecurity.None);
            }
        }
Beispiel #6
0
        public virtual void RemoveFromTeam(Project project, Participant participant, bool sendNotification)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }
            if (participant == null)
            {
                throw new ArgumentNullException("participant");
            }

            ProjectSecurity.DemandEditTeam(project);
            projectDao.RemoveFromTeam(project.ID, participant.ID);

            if (!factory.DisableNotifications && sendNotification)
            {
                NotifyClient.Instance.SendRemovingFromProjectTeam(participant.ID, project);
            }
        }
Beispiel #7
0
        public virtual void RemoveFromTeam(Project project, Participant participant, bool sendNotification)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }
            if (participant == null)
            {
                throw new ArgumentNullException("participant");
            }

            ProjectSecurity.DemandEditTeam(project);
            projectDao.RemoveFromTeam(project.ID, participant.ID);
            TimeLinePublisher.Team(project, participant.UserInfo, EngineResource.ActionText_DeletedFromTeam);

            if (!_factory.DisableNotifications && sendNotification)
            {
                NotifyClient.Instance.SendRemovingFromProjectTeam(participant.ID, project);
            }
        }
Beispiel #8
0
        public virtual void AddToTeam(Project project, Participant participant, bool sendNotification)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }
            if (participant == null)
            {
                throw new ArgumentNullException("participant");
            }

            ProjectSecurity.DemandEditTeam(project);
            projectDao.AddToTeam(project.ID, participant.ID);
            TimeLinePublisher.Team(project, participant.UserInfo, EngineResource.ActionText_AddToTeam);

            if (!_factory.DisableNotifications && sendNotification && !project.Responsible.Equals(participant.ID))
            {
                NotifyClient.Instance.SendInvaiteToProjectTeam(participant.ID, project);
            }
        }
Beispiel #9
0
        public void SetTeamSecurity(Project project, Guid participant, ProjectTeamSecurity teamSecurity, bool visible)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            ProjectSecurity.DemandEditTeam(project);

            var security = DaoFactory.ProjectDao.GetTeamSecurity(project.ID, participant);

            if (visible)
            {
                if (security != ProjectTeamSecurity.None)
                {
                    security ^= teamSecurity;
                }
            }
            else
            {
                security |= teamSecurity;
            }
            DaoFactory.ProjectDao.SetTeamSecurity(project.ID, participant, security);
        }