public void ReassignTeam()
        {
            Project.Private = true;
            Project         = ProjectEngine.SaveOrUpdate(Project, false);
            ProjectEngine.SetTeamSecurity(Project, From,
                                          ProjectTeamSecurity.Contacts |
                                          ProjectTeamSecurity.Files |
                                          ProjectTeamSecurity.Messages |
                                          ProjectTeamSecurity.Milestone |
                                          ProjectTeamSecurity.Tasks);

            ProjectsReassign.Reassign(From, To);

            var team = ProjectEngine.GetTeam(Project.ID).Select(r => r.ID).ToList();

            Assert.That(team, Has.No.Member(From));
            Assert.That(team, Has.Member(To));

            var security = ProjectEngine.GetTeamSecurity(Project, To);

            Assert.That(security & ProjectTeamSecurity.Tasks, Is.EqualTo(ProjectTeamSecurity.Tasks));
            Assert.That(security & ProjectTeamSecurity.Contacts, Is.EqualTo(ProjectTeamSecurity.Contacts));
            Assert.That(security & ProjectTeamSecurity.Files, Is.EqualTo(ProjectTeamSecurity.Files));
            Assert.That(security & ProjectTeamSecurity.Messages, Is.EqualTo(ProjectTeamSecurity.Messages));
            Assert.That(security & ProjectTeamSecurity.Milestone, Is.EqualTo(ProjectTeamSecurity.Milestone));
        }
        private void ReplaceTeam(Guid fromUserId, Guid toUserId)
        {
            foreach (var project in FromUserProjects)
            {
                var teamSecurity = ProjectEngine.GetTeamSecurity(project, fromUserId);

                if (!ToUserProjects.Exists(r => r.ID == project.ID))
                {
                    ProjectEngine.AddToTeam(project, toUserId, false);
                    ProjectEngine.SetTeamSecurity(project, toUserId, teamSecurity);
                }

                ProjectEngine.RemoveFromTeam(project, fromUserId, false);
            }
        }
Beispiel #3
0
 protected void RestrictAccess(Guid userID, ProjectTeamSecurity projectTeamSecurity, bool visible)
 {
     SecurityContext.AuthenticateMe(Owner);
     ProjectEngine.SetTeamSecurity(Project, ParticipantEngine.GetByID(userID), projectTeamSecurity, visible);
 }