public void InitView(TabListItem tabItem)
        {
            dtoProjectContext cContext = InitializeContext();

            View.CurrentListContext = cContext;
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);

                if (tabItem == TabListItem.Resource || (tabItem != TabListItem.Resource && Service.GetAvailableTabs((p != null ? p.Id : 0), cContext, PageContainerType.ProjectsList).Contains(tabItem)))
                {
                    View.InitializeTopControls(cContext, cContext.IdCommunity, View.PreloadFromCookies, tabItem, PageContainerType.ProjectsList, View.PreloadGroupBy, View.PreloadFilterBy, View.PreloadFilterStatus);
                    ModuleProjectManagement pPermission = ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID);
                    ModuleProjectManagement mPermission = (cContext.isForPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, cContext.IdCommunity, CurrentIdModule));
                    if (mPermission.Administration || mPermission.CreatePersonalProject || mPermission.CreatePublicProject)
                    {
                        View.AllowAddProject((mPermission.CreatePersonalProject) ? RootObject.AddProject(cContext.IdCommunity, cContext.isForPortal, true, PageListType.ListManager, cContext.IdCommunity) : "", (mPermission.CreatePublicProject || mPermission.Administration) ? RootObject.AddProject(cContext.IdCommunity, cContext.isForPortal, false, PageListType.ListManager, cContext.IdCommunity) : "", (cContext.isForPortal ? "" : RootObject.AddProject(0, true, true, PageListType.ListManager, cContext.IdCommunity)));
                    }
                    View.SendUserAction(cContext.IdCommunity, CurrentIdModule, 0, GetDefaultAction(tabItem));
                }
                else
                {
                    View.RedirectToUrl(RootObject.ProjectListResource(cContext.IdCommunity, cContext.isForPortal, cContext.isPersonal));
                }
            }
        }
Beispiel #2
0
        public void InitView(long idProject, String formatDateString, Dictionary <GanttCssClass, String> cssClass, String baseUrl)
        {
            dtoProject project = Service.GetdtoProject(idProject);

            if (project == null)
            {
                View.GenerateXML(new ProjectForGantt());
            }
            else
            {
                Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);
                ModuleProjectManagement mPermission  = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, project.IdCommunity, CurrentIdModule));
                PmActivityPermission    pPermissions = Service.GetProjectPermission(idProject, UserContext.CurrentUserID);
                ProjectResource         resource     = Service.GetResource(idProject, UserContext.CurrentUserID);

                if ((mPermission.Administration && !project.isPersonal) || (pPermissions.HasFlag(PmActivityPermission.ManageProject)))
                {
                    View.GenerateXML(Service.GetActivitiesForGantt(idProject, resource, ProjectVisibility.Full, formatDateString, cssClass, baseUrl));
                }
                else
                {
                    if (pPermissions.HasFlag(PmActivityPermission.ViewProjectMap) && (resource != null && (resource.Visibility == ProjectVisibility.Full || resource.Visibility == ProjectVisibility.InvolvedTasks)))
                    {
                        View.GenerateXML(Service.GetActivitiesForGantt(idProject, resource, resource.Visibility, formatDateString, cssClass, baseUrl));
                    }
                    else
                    {
                        View.GenerateXML(new ProjectForGantt());
                    }
                }
            }
        }
        public void InitView(long idProject)
        {
            dtoProject project = Service.GetdtoProject(idProject);

            if (project == null)
            {
                View.DisplayUnknownProject();
            }
            else
            {
                Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);
                ModuleProjectManagement mPermission  = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, project.IdCommunity, CurrentIdModule));
                PmActivityPermission    pPermissions = Service.GetProjectPermission(idProject, UserContext.CurrentUserID);

                if ((mPermission.Administration && !project.isPersonal) || (pPermissions.HasFlag(PmActivityPermission.ManageProject)))
                {
                    View.LoadGantt(RootObject.GetGanttXML(project.Id, false, project.IdCommunity, project.isPortal, project.isPersonal));
                }
                else
                {
                    ProjectResource resource = Service.GetResource(idProject, UserContext.CurrentUserID);
                    if (pPermissions.HasFlag(PmActivityPermission.ViewProjectMap) && (resource != null && (resource.Visibility == ProjectVisibility.Full || resource.Visibility == ProjectVisibility.InvolvedTasks)))
                    {
                        View.LoadGantt(RootObject.GetGanttXML(project.Id, false, project.IdCommunity, project.isPortal, project.isPersonal));
                    }
                    else
                    {
                        View.DisplayNoPermissionToSeeProjectGantt();
                    }
                }
            }
        }
Beispiel #4
0
        private List <long> GetIdProjectsForTasksAsAdministrator(Person person, dtoItemsFilter filter, Int32 idCommunity)
        {
            List <long> results    = new List <long>();
            List <long> idProjects = (from r in Manager.GetIQ <ProjectResource>()
                                      where r.Type == ResourceType.Internal && r.Person != null && r.Person.Id == person.Id &&
                                      (r.ProjectRole == ActivityRole.ProjectOwner || r.ProjectRole == ActivityRole.Manager)
                                      select r.Project.Id).ToList();

            var query = (from p in Manager.GetIQ <Project>()
                         where ((filter.ProjectsStatus == ItemListStatus.Deleted && p.Deleted == BaseStatusDeleted.Manual) || (filter.ProjectsStatus != ItemListStatus.Deleted && p.Deleted == BaseStatusDeleted.None)) &&
                         p.isPersonal == false && !idProjects.Contains(p.Id)
                         select p);

            query = query.Where(p => p.Availability != ProjectAvailability.Draft);


            ModuleProjectManagement pPermissions = ModuleProjectManagement.CreatePortalmodule(person.TypeID);
            ModuleProjectManagement cPermissions = new ModuleProjectManagement()
            {
                Administration = true
            };

            switch (filter.FilterBy)
            {
            case ProjectFilterBy.All:

                if (pPermissions.Administration)
                {
                    results.AddRange(query.Where(p => p.isPortal).Select(p => p.Id).ToList());
                }
                List <Int32> idCommunities = ServiceCommunityManagement.GetIdCommunityByModulePermissions(person.Id, new Dictionary <int, long>()
                {
                    { GetIdModule(), cPermissions.GetPermissions() }
                });
                if (idCommunities.Any())
                {
                    results.AddRange(query.Where(p => !p.isPortal && p.Community != null && idCommunities.Contains(p.Community.Id)).Select(p => p.Id).ToList());
                }
                break;

            case ProjectFilterBy.CurrentCommunity:
                cPermissions = new ModuleProjectManagement(Manager.GetModulePermission(person.Id, idCommunity, idModule));
                if (cPermissions.Administration)
                {
                    results.AddRange(query.Where(p => !p.isPortal && p.Community != null && p.Community.Id == idCommunity).Select(p => p.Id).ToList());
                }
                break;

            case ProjectFilterBy.FromPortal:
                if (pPermissions.Administration)
                {
                    results.AddRange(query.Where(p => p.isPortal).Select(p => p.Id).ToList());
                }
                break;
            }
            return(results);
        }
Beispiel #5
0
        public void InitView()
        {
            long idProject             = View.PreloadIdProject;
            dtoProjectContext cContext = new dtoProjectContext()
            {
                IdCommunity = View.PreloadIdCommunity, isPersonal = View.PreloadIsPersonal, isForPortal = View.PreloadForPortal
            };
            dtoProject project = InitializeContext(idProject, ref cContext);

            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                if (project == null)
                {
                    View.DisplayUnknownProject();
                    View.SendUserAction(UserContext.CurrentCommunityID, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectUnknown);
                }
                else
                {
                    Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);
                    ModuleProjectManagement mPermission  = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, cContext.IdCommunity, CurrentIdModule));
                    PmActivityPermission    pPermissions = Service.GetProjectPermission(idProject, UserContext.CurrentUserID);
                    SetBackUrls(View.PreloadFromPage, View.PreloadIdContainerCommunity, project, cContext);
                    if ((mPermission.Administration && !project.isPersonal) || (pPermissions.HasFlag(PmActivityPermission.ViewProjectMap)))
                    {
                        PageListType fromPage = View.PreloadFromPage;
                        View.LoadProjectDateInfo(project, (fromPage != PageListType.ProjectDashboardResource && fromPage != PageListType.DashboardResource && fromPage != PageListType.ListResource) && ((mPermission.Administration && !project.isPersonal) || (pPermissions.HasFlag(PmActivityPermission.ManageProject))));

                        List <dtoMapActivity> activities = Service.GetActivities(mPermission, pPermissions, project);
                        if (activities == null)
                        {
                            View.DisplayNoActivities();
                            View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectMapErrorFromDb);
                        }
                        else
                        {
                            View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectMapView);
                            View.LoadActivities(activities);
                        }
                        if ((mPermission.Administration && !project.isPersonal) || (pPermissions.HasFlag(PmActivityPermission.ManageProject)))
                        {
                            View.SetEditProjectUrl(RootObject.EditProject(project.Id, project.IdCommunity, project.isPortal, project.isPersonal, View.PreloadFromPage, View.IdContainerCommunity));
                            View.SetEditMapUrl(RootObject.ProjectMap(project.Id, project.IdCommunity, project.isPortal, project.isPersonal, View.PreloadFromPage, View.IdContainerCommunity));
                        }
                        View.LoadAttachments(Service.GetProjectAttachments(idProject, 0, false, View.UnknownUser, true));
                    }
                    else
                    {
                        View.DisplayNoPermission(project.IdCommunity, currentIdModule);
                    }
                }
            }
        }
        public void InitView()
        {
            int  idCommunity = View.PreloadIdCommunity;
            long idProject   = View.PreloadIdProject;

            View.ProjectIdCommunity = idCommunity;
            View.IdProject          = idProject;
            View.isPersonal         = View.PreloadIsPersonal;
            View.forPortal          = View.PreloadForPortal;
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Project project = CurrentManager.Get <Project>(idProject);
                if (project == null)
                {
                    View.DisplayUnknownProject();
                    View.SendUserAction(UserContext.CurrentCommunityID, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectUnknown);
                }
                else
                {
                    View.isPersonal         = project.isPersonal;
                    View.forPortal          = project.isPortal;
                    View.ProjectIdCommunity = (!project.isPortal && project.Community != null) ? project.Community.Id : 0;
                    SetBackUrls(View.PreloadFromPage, View.PreloadIdContainerCommunity, project);
                    Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);
                    ModuleProjectManagement permission     = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, idCommunity, CurrentIdModule));
                    PmActivityPermission    taskpermission = Service.GetProjectPermission(idProject, UserContext.CurrentUserID);
                    //// calcolo permessi
                    if ((permission.Administration && !project.isPersonal) || (taskpermission & PmActivityPermission.ManageResources) == PmActivityPermission.ManageResources)
                    {
                        View.AllowAddExternalUser  = true; //se il progetto e la sua comunità tornano, allora vado avanti
                        View.AllowAddCommunityUser = (!project.isPortal && project.Community != null);

                        View.AllowSave = true;
                        View.LoadWizardSteps(idProject, idCommunity, project.isPersonal, project.isPortal, Service.GetAvailableSteps(WizardProjectStep.ProjectUsers, idProject));
                        LoadProjectResources(idProject, true, View.UnknownUser, true, project.isPersonal);
                    }
                    else
                    {
                        ProjectResource resource = Service.GetResource(idProject, UserContext.CurrentUserID);
                        if (resource != null && resource.Visibility == ProjectVisibility.Full)
                        {
                            LoadProjectResources(idProject, false, View.UnknownUser, false, project.isPersonal);
                        }
                        else
                        {
                            View.DisplayNoPermission(idCommunity, currentIdModule);
                        }
                    }
                }
            }
        }
        private dtoAttachmentPermission AttachmentGetPermissions(litePerson person, ProjectAttachment attachment, Project project, PmActivity activity)
        {
            dtoAttachmentPermission result = new dtoAttachmentPermission();

            if (attachment != null && project != null)
            {
                lm.Comol.Core.FileRepository.Domain.ModuleRepository repositoryPermissions = GetRepositoryPermissions((project.isPortal) ? 0 : (project.Community == null) ? -1 : project.Community.Id, person.Id);
                ModuleProjectManagement mPermission     = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((person == null) ? (Int32)UserTypeStandard.Guest : person.TypeID) : new ModuleProjectManagement(Manager.GetModulePermission(person.Id, (!project.isPortal && project.Community != null) ? project.Community.Id : 0, GetIdModule()));
                ProjectResource         resource        = project.Resources.Where(r => r.Deleted == BaseStatusDeleted.None && r.Type == ResourceType.Internal && r.Person == person).FirstOrDefault();
                PmActivityPermission    rolePermissions = GetRolePermissions(AttachmentGetContainerRole(project, activity, resource, mPermission));

                switch (attachment.Type)
                {
                case AttachmentType.file:
                    result.Download = (attachment.Item != null && attachment.Item.IsDownloadable || attachment.Item.Type == ItemType.Link) && (HasPermission(rolePermissions, PmActivityPermission.ViewAttachments) || HasPermission(rolePermissions, PmActivityPermission.DownloadAttacchments));
                    result.Play     = (attachment.Item != null && (attachment.Item.Type == ItemType.Multimedia || attachment.Item.Type == ItemType.ScormPackage || attachment.Item.Type == ItemType.VideoStreaming)) && (HasPermission(rolePermissions, PmActivityPermission.ViewAttachments) || HasPermission(rolePermissions, PmActivityPermission.DownloadAttacchments));

                    switch (attachment.Item.Type)
                    {
                    case ItemType.ScormPackage:
                    case ItemType.Multimedia:
                        result.ViewMyStatistics = HasPermission(rolePermissions, PmActivityPermission.ViewAttachments);
                        if (attachment.Item.IsInternal || (repositoryPermissions.Administration || (repositoryPermissions.EditOthersFiles || (repositoryPermissions.EditMyFiles && attachment.Item.IdOwner == person.Id))))
                        {
                            result.ViewOtherStatistics = HasPermission(rolePermissions, PmActivityPermission.ManageAttachments) || (HasPermission(rolePermissions, PmActivityPermission.ManageActivityAttachments) && attachment.IdCreatedBy == person.Id);
                            result.SetMetadata         = result.ViewOtherStatistics;
                        }
                        break;

                    case ItemType.Link:
                        result.Play = result.Download;
                        break;
                    }
                    result.Edit = false;
                    break;

                case AttachmentType.url:
                    result.Download = HasPermission(rolePermissions, PmActivityPermission.ViewAttachments) || HasPermission(rolePermissions, PmActivityPermission.DownloadAttacchments);
                    result.Play     = result.Download;
                    result.Edit     = HasPermission(rolePermissions, PmActivityPermission.ManageAttachments) || (HasPermission(rolePermissions, PmActivityPermission.ManageActivityAttachments) && attachment.IdCreatedBy == person.Id);
                    break;
                }

                result.Delete        = false;
                result.UnDelete      = (attachment.Deleted != BaseStatusDeleted.None) && (HasPermission(rolePermissions, PmActivityPermission.VirtualUnDeleteAttachments) || (HasPermission(rolePermissions, PmActivityPermission.ManageActivityAttachments) && attachment.IdCreatedBy == person.Id));
                result.Unlink        = (attachment.SharedItems.Any() && activity != null && attachment.SharedItems.Where(s => s.Deleted == BaseStatusDeleted.None && s.Activity != null && s.Activity.Id == activity.Id && s.Type == AttachmentLinkType.Shared).Any() && attachment.Deleted == BaseStatusDeleted.None) && (HasPermission(rolePermissions, PmActivityPermission.VirtualDeleteAttachments) || HasPermission(rolePermissions, PmActivityPermission.ManageAttachments) || (HasPermission(rolePermissions, PmActivityPermission.ManageActivityAttachments) && attachment.IdCreatedBy == person.Id));
                result.VirtualDelete = (attachment.Deleted == BaseStatusDeleted.None) && (HasPermission(rolePermissions, PmActivityPermission.VirtualDeleteAttachments) || HasPermission(rolePermissions, PmActivityPermission.ManageAttachments) || (HasPermission(rolePermissions, PmActivityPermission.ManageActivityAttachments) && attachment.IdCreatedBy == person.Id));
            }

            return(result);
        }
Beispiel #8
0
        public void InitView()
        {
            long idProject             = View.PreloadIdProject;
            dtoProjectContext cContext = new dtoProjectContext()
            {
                IdCommunity = View.PreloadIdCommunity, isPersonal = View.PreloadIsPersonal, isForPortal = View.PreloadForPortal
            };
            dtoProject project = InitializeContext(idProject, ref cContext);

            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                SetBackUrls(View.PreloadFromPage, View.PreloadIdContainerCommunity, project, cContext);
                if (project == null)
                {
                    View.DisplayUnknownProject();
                    View.SendUserAction(UserContext.CurrentCommunityID, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectUnknown);
                }
                else
                {
                    Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);
                    ModuleProjectManagement mPermission  = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, cContext.IdCommunity, CurrentIdModule));
                    PmActivityPermission    pPermissions = Service.GetProjectPermission(idProject, UserContext.CurrentUserID);

                    if ((mPermission.Administration && !project.isPersonal) || (pPermissions.HasFlag(PmActivityPermission.ManageProject)))
                    {
                        View.AllowSave = true;
                        View.LoadProjectDateInfo(project, true);
                        View.SendUserAction(UserContext.CurrentCommunityID, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ViewGantt);
                        View.SetEditProjectUrl(RootObject.EditProject(project.Id, project.IdCommunity, project.isPortal, project.isPersonal, View.PreloadFromPage, View.IdContainerCommunity));
                    }
                    else
                    {
                        ProjectResource resource = Service.GetResource(idProject, UserContext.CurrentUserID);
                        if (pPermissions.HasFlag(PmActivityPermission.ViewProjectMap) && (resource != null && (resource.Visibility == ProjectVisibility.Full || resource.Visibility == ProjectVisibility.InvolvedTasks)))
                        {
                            View.LoadProjectDateInfo(project, false);
                            View.SendUserAction(UserContext.CurrentCommunityID, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ViewGantt);
                        }
                        else
                        {
                            View.DisplayNoPermission(project.IdCommunity, currentIdModule);
                        }
                    }
                }
            }
        }
        public void InitView()
        {
            long idProject             = View.PreloadIdProject;
            dtoProjectContext cContext = new dtoProjectContext()
            {
                IdCommunity = View.PreloadIdCommunity, isPersonal = View.PreloadIsPersonal, isForPortal = View.PreloadForPortal
            };
            dtoProject project = InitializeContext(idProject, ref cContext);

            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);
                SetBackUrls(View.PreloadFromPage, View.PreloadIdContainerCommunity, project, cContext);
                List <lm.Comol.Core.Wizard.NavigableWizardItem <dtoProjectManagementStep> > steps = Service.GetAvailableSteps(WizardProjectStep.Calendars, idProject);
                View.LoadWizardSteps(idProject, cContext.IdCommunity, cContext.isPersonal, cContext.isForPortal, steps);
                if (project == null)
                {
                    View.DisplayUnknownProject();
                }
                else
                {
                    ModuleProjectManagement mPermission  = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, cContext.IdCommunity, CurrentIdModule));
                    PmActivityPermission    pPermissions = Service.GetProjectPermission(idProject, UserContext.CurrentUserID);

                    View.LoadProjectAvailableDays(project.DaysOfWeek);
                    if ((mPermission.Administration && !project.isPersonal) || (pPermissions & PmActivityPermission.ManageProject) == PmActivityPermission.ManageProject)
                    {
                        View.AllowSave = false;
                        View.AllowAdd  = false;
                        View.SendUserAction(cContext.IdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.CalendarsLoad);
                    }
                    else
                    {
                        ProjectResource resource = Service.GetResource(idProject, UserContext.CurrentUserID);
                        if (resource != null && resource.Visibility == ProjectVisibility.Full)
                        {
                            View.SendUserAction(cContext.IdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.CalendarsLoad);
                        }
                        else
                        {
                            View.DisplayNoPermission(cContext.IdCommunity, CurrentIdModule);
                        }
                    }
                }
            }
        }
        public void InitView(String unknownUser)
        {
            long idProject             = View.PreloadIdProject;
            dtoProjectContext cContext = new dtoProjectContext()
            {
                IdCommunity = View.PreloadIdCommunity, isPersonal = View.PreloadIsPersonal, isForPortal = View.PreloadForPortal
            };
            dtoProject project = InitializeContext(idProject, ref cContext);

            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                litePerson p = CurrentManager.GetLitePerson(UserContext.CurrentUserID);
                SetBackUrls(View.PreloadFromPage, View.PreloadIdContainerCommunity, project, cContext);
                List <lm.Comol.Core.Wizard.NavigableWizardItem <dtoProjectManagementStep> > steps = Service.GetAvailableSteps(WizardProjectStep.Documents, idProject);
                View.LoadWizardSteps(idProject, cContext.IdCommunity, cContext.isPersonal, cContext.isForPortal, steps);
                if (project == null)
                {
                    View.DisplayUnknownProject();
                }
                else
                {
                    ModuleProjectManagement mPermission  = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, cContext.IdCommunity, CurrentIdModule));
                    PmActivityPermission    pPermissions = Service.GetProjectPermission(idProject, UserContext.CurrentUserID);
                    View.RepositoryIdentifier = CreateRepositoryIdentifier(project);
                    if ((mPermission.Administration && !project.isPersonal) || (pPermissions & PmActivityPermission.ManageProject) == PmActivityPermission.ManageProject)
                    {
                        LoadAttachments(unknownUser, project.Id, project.isPersonal, project.IdCommunity, mPermission, pPermissions, true);
                    }
                    else
                    {
                        View.AllowSave = false;
                        ProjectResource resource = Service.GetResource(idProject, UserContext.CurrentUserID);
                        if (resource != null && resource.ProjectRole != ActivityRole.Visitor && resource.ProjectRole != ActivityRole.None)
                        {
                            LoadAttachments(unknownUser, project.Id, project.isPersonal, project.IdCommunity, mPermission, pPermissions, false);
                        }
                        else
                        {
                            View.DisplayNoPermission(cContext.IdCommunity, CurrentIdModule);
                        }
                    }
                }
            }
        }
        public void InitView(long idProject)
        {
            dtoProject project = Service.GetdtoProject(idProject);

            if (project == null)
            {
                View.DisplayUnknownProject();
            }
            else
            {
                Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);
                ModuleProjectManagement mPermission  = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, project.IdCommunity, CurrentIdModule));
                PmActivityPermission    pPermissions = Service.GetProjectPermission(idProject, UserContext.CurrentUserID);
                InitView(project, ((mPermission.Administration && !project.isPersonal) || (pPermissions.HasFlag(PmActivityPermission.ManageProject))) && !(UserContext.isAnonymous), true);
            }
        }
 public void LoadAttachments(String unknownUser, long idProject, Boolean isPortal, Boolean isPersonal, Int32 idCommunity)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);
         ModuleProjectManagement mPermission  = (isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, idCommunity, CurrentIdModule));
         PmActivityPermission    pPermissions = Service.GetProjectPermission(idProject, UserContext.CurrentUserID);
         Boolean allowSave = (mPermission.Administration && !isPersonal) || ((pPermissions & PmActivityPermission.ManageProject) == PmActivityPermission.ManageProject);
         View.AllowSave = allowSave;
         LoadAttachments(unknownUser, idProject, isPersonal, idCommunity, mPermission, pPermissions, allowSave);
     }
 }
        public void SaveUrl(dtoUrl item, String unknownUser)
        {
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Boolean isPersonal  = View.isPersonal;
                Int32   idCommunity = View.ProjectIdCommunity;
                Boolean isPortal    = View.forPortal;
                long    idProject   = View.IdProject;
                Person  p           = CurrentManager.GetPerson(UserContext.CurrentUserID);
                ModuleProjectManagement mPermission  = (isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, idCommunity, CurrentIdModule));
                PmActivityPermission    pPermissions = Service.GetProjectPermission(idProject, UserContext.CurrentUserID);
                Boolean allowSave = (mPermission.Administration && !isPersonal) || ((pPermissions & PmActivityPermission.ManageProject) == PmActivityPermission.ManageProject);

                if (allowSave && item != null)
                {
                    if (String.IsNullOrEmpty(item.Address))
                    {
                        View.SendUserAction(idCommunity, CurrentIdModule, idProject, item.Id, ModuleProjectManagement.ActionType.ProjectAttachmentsUnableToEditUrl);
                        View.DisplayUnableToSaveEmptyUrl(item);
                    }
                    else
                    {
                        ProjectAttachment attachment = Service.AttachmentSaveUrl(item);
                        if (attachment != null)
                        {
                            View.DisplaySavedUrl(item);
                            View.SendUserAction(idCommunity, CurrentIdModule, idProject, item.Id, ModuleProjectManagement.ActionType.ProjectAttachmentsUrlModified);
                        }
                        else
                        {
                            View.SendUserAction(idCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectAttachmentsUnableToEditUrl);
                            View.DisplayUnableToSaveUrl(item);
                        }
                    }
                }
                else
                {
                    View.SendUserAction(idCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectAttachmentsNoPermissionToEditUrl);
                    View.DisplayNoPermissionToEditUrl();
                }
                LoadAttachments(unknownUser, idProject, isPersonal, idCommunity, mPermission, pPermissions, allowSave, ModuleProjectManagement.ActionType.ProjectAttachmentsReload);
            }
        }
Beispiel #14
0
        private Boolean IsProjectAdministrator(long idProject, Person person)
        {
            Boolean result = false;

            try
            {
                liteProjectSettings project = Manager.Get <liteProjectSettings>(idProject);
                if (project != null && !project.isPersonal)
                {
                    ModuleProjectManagement mPermission = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((person == null) ? (Int32)UserTypeStandard.Guest : person.TypeID) : new ModuleProjectManagement(Manager.GetModulePermission(person.Id, project.IdCommunity, GetIdModule()));
                    result = mPermission.Administration;
                }
            }
            catch (Exception ex) {
            }
            return(result);
        }
        public void EditUrl(long idAttachmentLink, long idAttachment, String unknownUser)
        {
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Boolean reloadItems = true;
                Boolean isPersonal  = View.isPersonal;
                Int32   idCommunity = View.ProjectIdCommunity;
                Boolean isPortal    = View.forPortal;
                long    idProject   = View.IdProject;
                Person  p           = CurrentManager.GetPerson(UserContext.CurrentUserID);
                ModuleProjectManagement mPermission  = (isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, idCommunity, CurrentIdModule));
                PmActivityPermission    pPermissions = Service.GetProjectPermission(idProject, UserContext.CurrentUserID);
                Boolean allowSave = (mPermission.Administration && !isPersonal) || ((pPermissions & PmActivityPermission.ManageProject) == PmActivityPermission.ManageProject);

                if (allowSave)
                {
                    dtoAttachment attachment = Service.AttachmentGetByIdLink(idAttachmentLink, unknownUser);
                    if (attachment != null && attachment.Type == AttachmentType.url)
                    {
                        View.DisplayUrlForEditing(new dtoUrl()
                        {
                            Id = attachment.IdAttachment, Address = attachment.Url, Name = attachment.DisplayName
                        });
                        reloadItems = false;
                    }
                    else
                    {
                        View.SendUserAction(idCommunity, CurrentIdModule, idProject, idAttachment, ModuleProjectManagement.ActionType.ProjectAttachmentsUrlUnknown);
                        View.DisplayUrlRemoved();
                    }
                }
                else
                {
                    View.SendUserAction(idCommunity, CurrentIdModule, idProject, idAttachment, ModuleProjectManagement.ActionType.ProjectAttachmentsNoPermissionToEditUrl);
                    View.DisplayNoPermissionToEditUrl();
                }
                if (reloadItems)
                {
                    LoadAttachments(unknownUser, idProject, isPersonal, idCommunity, mPermission, pPermissions, allowSave, ModuleProjectManagement.ActionType.ProjectAttachmentsReload);
                }
            }
        }
 public void LoadProjectResources(long idProject, String unknownUser)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);
         ModuleProjectManagement mPermission = (View.forPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, View.ProjectIdCommunity, CurrentIdModule));
         Boolean allowEditResources          = (!View.isPersonal && mPermission.Administration);
         if (!allowEditResources)
         {
             PmActivityPermission pPermissions = Service.GetProjectPermission(idProject, UserContext.CurrentUserID);
             allowEditResources = pPermissions.HasFlag(PmActivityPermission.ManageResources) || pPermissions.HasFlag(PmActivityPermission.ManageProject);
         }
         LoadProjectResources(idProject, allowEditResources, unknownUser, true);
     }
 }
Beispiel #17
0
        private dtoActivity GetActivity(liteProjectSettings project, litePmActivity activity, List <dtoLiteMapActivity> activities, Boolean firstLoad = false)
        {
            Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);
            ModuleProjectManagement mPermission  = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, project.IdCommunity, CurrentIdModule));
            PmActivityPermission    pPermissions = Service.GetProjectPermission(activity.IdProject, UserContext.CurrentUserID);

            dtoActivity dto         = new dtoActivity(activity);
            Boolean     allowEdit   = (mPermission.Administration && !project.isPersonal) || pPermissions.HasFlag(PmActivityPermission.ManageProject);
            Boolean     allowDelete = (mPermission.Administration && !project.isPersonal) || pPermissions.HasFlag(PmActivityPermission.ManageProject);

            dto.Permission = new dtoActivityPermission(pPermissions, allowEdit, allowDelete, project.AllowSummary, project.DateCalculationByCpm);
            dto.Permission.ViewPredecessors = dto.Permission.ViewPredecessors && !dto.IsSummary;
            dto.Permission.SetPredecessors  = (allowEdit || pPermissions.HasFlag(PmActivityPermission.ManageLinks)) && project.DateCalculationByCpm && !dto.IsSummary;
            dto.Permission.SetDuration      = dto.Permission.SetDuration && !dto.IsSummary;
            dto.Permission.SetResources     = dto.Permission.SetResources && !dto.IsSummary;
            View.AllowDelete = allowDelete;
            View.AllowEdit   = allowEdit;
            LoadLinks(dto, activities, firstLoad);

            return(dto);
        }
 public void VirtualDeleteAttachments(List <long> idAttachmentLinks, String unknownUser)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         Boolean isPersonal  = View.isPersonal;
         Int32   idCommunity = View.ProjectIdCommunity;
         Boolean isPortal    = View.forPortal;
         long    idProject   = View.IdProject;
         Person  p           = CurrentManager.GetPerson(UserContext.CurrentUserID);
         ModuleProjectManagement mPermission  = (isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, idCommunity, CurrentIdModule));
         PmActivityPermission    pPermissions = Service.GetProjectPermission(idProject, UserContext.CurrentUserID);
         Boolean allowSave = (mPermission.Administration && !isPersonal) || ((pPermissions & PmActivityPermission.ManageProject) == PmActivityPermission.ManageProject);
         if (idAttachmentLinks.Any())
         {
             if (allowSave)
             {
                 if (Service.AttachmentLinksSetVirtualDelete(idAttachmentLinks, true))
                 {
                     View.DisplayDeletedItems(idAttachmentLinks.Count);
                     View.SendUserAction(idCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectAttachmentsVirtualDeletedItems);
                 }
                 else
                 {
                     View.SendUserAction(idCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectAttachmentsUnableToVirtualDeleteItems);
                     View.DisplayUnableToDeleteItems(idAttachmentLinks.Count);
                 }
             }
             else
             {
                 View.SendUserAction(idCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectAttachmentsNoPermissionToDeleteItems);
                 View.DisplayNoPermissionToDeleteItems(idAttachmentLinks.Count);
             }
         }
         LoadAttachments(unknownUser, idProject, isPersonal, idCommunity, mPermission, pPermissions, allowSave, ModuleProjectManagement.ActionType.ProjectAttachmentsReload);
     }
 }
        //public List<lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions> AttachmentsGetAvailableUploadActions()
        //{
        //    List<lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions> actions = new List<lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions>();

        //    return actions;
        //}

        //public List<lm.Comol.Core.DomainModel.Repository.RepositoryAttachmentUploadActions> GetAttachmentsAvailableActions()
        //{

        //    ModuleRepository moduleRepository = View.RepositoryPermission(CommunityId);
        //    CoreItemPermission oPermission = Service.GetItemPermission(oItem, module, moduleRepository);
        //    if (oPermission.AllowAddFiles || oPermission.AllowEdit)
        //    {
        //        if (oItem.CommunityOwner == null)
        //        {
        //            View.AllowCommunityUpload = false;
        //            View.AllowCommunityLink = false;
        //        }
        //        View.AllowCommunityUpload = oPermission.AllowEdit && (moduleRepository.Administration || moduleRepository.UploadFile);
        //        View.AllowCommunityLink = oPermission.AllowEdit && (moduleRepository.Administration || moduleRepository.UploadFile || moduleRepository.ListFiles || moduleRepository.DownLoad);
        //        if (oPermission.AllowEdit && (moduleRepository.Administration || moduleRepository.UploadFile))
        //        {
        //            View.InitializeCommunityUploader(0, CommunityId, moduleRepository);
        //        }
        //        if (oPermission.AllowEdit)
        //        {
        //            View.InitializeModuleUploader(CommunityId);
        //        }
        //        View.AllowUpload = oPermission.AllowAddFiles;
        //        //  this.View.BackToDiary = CommunityID;
        //        View.SetBackToItemsUrl(CommunityId, oItem.Id);
        //        View.SetBackToItemUrl(CommunityId, oItem.Id);
        //        View.SetMultipleUploadUrl(oItem.Id);
        //        LoadItemFiles(oItem, oPermission);
        //    }
        //    else
        //    {
        //        this.View.ReturnToItemsList(CommunityId, oItem.Id);
        //    }


        //}

        #region "Add"
        #endregion

        #region "Manage"
        //public List<dtoAttachmentItem> GetProjectAttachments(long idProject)
        //    {
        //        List<dtoAttachmentItem> attachments = null;
        //        Boolean isInTransaction = Manager.IsInTransaction();
        //        try
        //        {
        //            if (!isInTransaction)
        //                Manager.BeginTransaction();
        //            Project project = Manager.Get<Project>(idProject);
        //            if (project !=null){
        //
        //            }
        //            if (!isInTransaction)
        //                Manager.Commit();
        //        }
        //        catch (Exception ex)
        //        {
        //            if (!isInTransaction)
        //                Manager.RollBack();
        //            attachments = null;
        //        }
        //        return attachments;


        //        PmActivityPermission pPermissions = GetProjectPermission(idProject, UserContext.CurrentUserID)
        //    }
        //public List<dtoAttachmentItem> GetProjectAttachments(long idProject, ModuleProjectManagement mPermission)
        //{

        //}

        public List <dtoAttachmentItem> GetProjectAttachments(long idProject, long idActivity, Boolean getDeleted, String unknownUser, Boolean onlyAvailable = false)
        {
            List <dtoAttachmentItem> attachments = null;
            Boolean isInTransaction = Manager.IsInTransaction();

            try
            {
                if (!isInTransaction)
                {
                    Manager.BeginTransaction();
                }
                litePerson person   = Manager.Get <litePerson>(UC.CurrentUserID);
                PmActivity activity = (idActivity > 0) ? Manager.Get <PmActivity>(idActivity) : null;
                Project    project  = (activity != null && activity.Project != null) ? activity.Project : Manager.Get <Project>(idProject);
                if (project != null && person != null && person.TypeID != (int)UserTypeStandard.Guest && (idActivity <= 0 || (idActivity > 0 && activity != null)))
                {
                    ModuleProjectManagement mPermission    = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((person == null) ? (Int32)UserTypeStandard.Guest : person.TypeID) : new ModuleProjectManagement(Manager.GetModulePermission(person.Id, (!project.isPortal && project.Community != null) ? project.Community.Id : 0, GetIdModule()));
                    ProjectResource         resource       = project.Resources.Where(r => r.Deleted == BaseStatusDeleted.None && r.Type == ResourceType.Internal && r.Person == person).FirstOrDefault();
                    PmActivityPermission    rolePermission = GetRolePermissions(AttachmentGetContainerRole(project, activity, resource, mPermission));


                    attachments = AttachmentsGet(person, project, activity, getDeleted, rolePermission, mPermission, unknownUser);
                }
                if (!isInTransaction)
                {
                    Manager.Commit();
                }
            }
            catch (Exception ex)
            {
                if (!isInTransaction)
                {
                    Manager.RollBack();
                }
                attachments = null;
            }
            return((onlyAvailable && attachments != null) ? attachments.Where(a => a.Permissions.Download || a.Permissions.Play).ToList() : attachments);
        }
        public void InitView()
        {
            long idProject             = View.PreloadIdProject;
            dtoProjectContext cContext = new dtoProjectContext()
            {
                IdCommunity = View.PreloadIdCommunity, isPersonal = View.PreloadIsPersonal, isForPortal = View.PreloadForPortal
            };
            dtoProject project = InitializeContext(idProject, ref cContext);

            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                if (project == null)
                {
                    View.DisplayUnknownProject();
                    View.SendUserAction(UserContext.CurrentCommunityID, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectUnknown);
                }
                else
                {
                    Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);
                    ModuleProjectManagement mPermission  = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, cContext.IdCommunity, CurrentIdModule));
                    PmActivityPermission    pPermissions = Service.GetProjectPermission(idProject, UserContext.CurrentUserID);
                    SetBackUrls(View.PreloadFromPage, View.PreloadIdContainerCommunity, project, cContext);
                    if ((mPermission.Administration && !project.isPersonal) || (pPermissions.HasFlag(PmActivityPermission.ManageProject)))
                    {
                        View.LoadAttachments(Service.GetProjectAttachments(idProject, 0, false, View.UnknownUser, true));
                        View.AllowAddExternalUser  = pPermissions.HasFlag(PmActivityPermission.ManageProject) || pPermissions.HasFlag(PmActivityPermission.ManageResources);
                        View.AllowAddCommunityUser = (!project.isPortal && project.IdCommunity > 0) && (pPermissions.HasFlag(PmActivityPermission.ManageProject) || pPermissions.HasFlag(PmActivityPermission.ManageResources));
                        View.AllowSave             = true;
                        View.AllowAddActivity      = true;
                        View.AllowManageResources  = (mPermission.Administration && !project.isPersonal) || (pPermissions.HasFlag(PmActivityPermission.ManageResources) || (pPermissions.HasFlag(PmActivityPermission.ManageProject)));
                        View.LoadProjectDateInfo(project, true);

                        List <dtoMapActivity> activities = Service.GetActivities(mPermission, pPermissions, project);
                        if (activities == null)
                        {
                            View.DisplayErrorGetActivitiesFromDB();
                            View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectMapErrorFromDb);
                        }
                        else
                        {
                            View.InitializeControlForResourcesSelection(Service.GetProjectResources(idProject, View.UnknownUser));
                            View.SendUserAction(View.ProjectIdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectMapForEditing);
                            View.LoadActivities(activities);
                        }
                        View.SetEditProjectUrl(RootObject.EditProject(project.Id, project.IdCommunity, project.isPortal, project.isPersonal, View.PreloadFromPage, View.IdContainerCommunity));
                    }
                    else
                    {
                        ProjectResource resource = Service.GetResource(idProject, UserContext.CurrentUserID);
                        if (pPermissions.HasFlag(PmActivityPermission.ViewProjectMap) && (resource != null && resource.Visibility == ProjectVisibility.Full))
                        {
                            View.RedirectToUrl(RootObject.ViewProjectMap(idProject, project.IdCommunity, project.isPortal, project.isPersonal, View.PreloadFromPage, View.PreloadIdContainerCommunity));
                        }
                        else
                        {
                            View.DisplayNoPermission(project.IdCommunity, currentIdModule);
                        }
                    }
                }
            }
        }
        public void InitView()
        {
            long idProject             = View.PreloadIdProject;
            dtoProjectContext cContext = new dtoProjectContext()
            {
                IdCommunity = View.PreloadIdCommunity, isPersonal = View.PreloadIsPersonal, isForPortal = View.PreloadForPortal
            };
            dtoProject project = InitializeContext(idProject, ref cContext);

            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);
                SetBackUrls(View.PreloadFromPage, View.PreloadIdContainerCommunity, project, cContext);

                List <lm.Comol.Core.Wizard.NavigableWizardItem <dtoProjectManagementStep> > steps = Service.GetAvailableSteps(WizardProjectStep.Settings, idProject);
                View.LoadWizardSteps(idProject, cContext.IdCommunity, cContext.isPersonal, cContext.isForPortal, steps);
                if (project == null)
                {
                    View.DisplayUnknownProject();
                    View.SendUserAction(UserContext.CurrentCommunityID, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectUnknown);
                }
                else
                {
                    ModuleProjectManagement mPermission  = (project.isPortal) ? ModuleProjectManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID) : new ModuleProjectManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, cContext.IdCommunity, CurrentIdModule));
                    PmActivityPermission    pPermissions = Service.GetProjectPermission(idProject, UserContext.CurrentUserID);

                    List <ProjectAvailability> availabilities = new List <ProjectAvailability>();
                    ProjectAvailability        cAvailability  = project.Availability;
                    Boolean hasActivities = Service.HasTasks(project.Id);
                    if (project.Availability == ProjectAvailability.Draft)
                    {
                        availabilities.Add(ProjectAvailability.Draft);
                    }
                    if (hasActivities)
                    {
                        availabilities.Add(ProjectAvailability.Active);
                        availabilities.Add(ProjectAvailability.Closed);
                        availabilities.Add(ProjectAvailability.Suspended);
                    }

                    Boolean allowChangeOwner              = false;
                    Boolean allowChangeOwnerFromResource  = false;
                    Boolean allowChangeOwnerFromCommunity = false;
                    if ((mPermission.Administration && !project.isPersonal) || (pPermissions & PmActivityPermission.ManageProject) == PmActivityPermission.ManageProject)
                    {
                        View.AllowSave = true;
                        View.SendUserAction(cContext.IdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectStartEditing);
                        if (View.PreloadAddedProject)
                        {
                            View.DisplayAddedInfo(View.PreloadRequiredActions, View.PreloadAddedActions);
                        }

                        allowChangeOwner              = (mPermission.Administration && !project.isPersonal) || ((pPermissions & PmActivityPermission.ChangeOwner) == PmActivityPermission.ChangeOwner);
                        allowChangeOwnerFromResource  = (project.Resources.Count > 1);
                        allowChangeOwnerFromCommunity = (project.IdCommunity > 0);
                        View.InitializeProject(project, hasActivities, project.Resources.Where(r => r.ProjectRole == ActivityRole.ProjectOwner).FirstOrDefault(), availabilities, cAvailability, allowChangeOwner, allowChangeOwnerFromResource, allowChangeOwnerFromCommunity);
                    }
                    else
                    {
                        ProjectResource resource = Service.GetResource(idProject, UserContext.CurrentUserID);
                        if (resource != null && resource.Visibility == ProjectVisibility.Full)
                        {
                            View.InitializeProject(project, hasActivities, project.Resources.Where(r => r.ProjectRole == ActivityRole.ProjectOwner).FirstOrDefault(), availabilities, cAvailability, allowChangeOwner, allowChangeOwnerFromResource, allowChangeOwnerFromCommunity);
                            View.SendUserAction(cContext.IdCommunity, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectViewSettings);
                        }
                        else
                        {
                            View.DisplayNoPermission(cContext.IdCommunity, CurrentIdModule);
                        }
                    }
                }
            }
        }