Beispiel #1
0
        public lm.Comol.Modules.TaskList.ModuleTasklist ServicePermission(int personId, int communityId)
        {
            ModuleTasklist module = new ModuleTasklist();
            Person         person = Manager.GetPerson(personId);

            if (communityId == 0)
            {
                module = ModuleTasklist.CreatePortalmodule(person.TypeID);
            }
            else
            {
                module = new ModuleTasklist(Manager.GetModulePermission(personId, communityId, ServiceModuleID()));
            }
            return(module);
        }
Beispiel #2
0
        public void InitView()
        {
            int CommunityId = UserContext.CurrentCommunityID;

            if (UserContext.isAnonymous)
            {
                View.NoPermissionToManagementFiles(CommunityId, ModuleID);
            }

            else
            {
                //CommunityEventItem oItem = Service.GetEventItem(this.View.PreloadedItemID);
                Task oTask = Service.GetTask(this.View.PreloadedItemID);
                if (oTask == null)
                {
                    this.View.NoPermissionToManagementFiles(CommunityId, this.ModuleID);
                }
                else
                {
                    View.ItemID = oTask.ID;
                    lm.Comol.Modules.TaskList.ModuleTasklist module = new  ModuleTasklist();
                    if ((oTask.Community != null))
                    {
                        CommunityId = oTask.Community.Id;
                        module      = (from p in View.CommunitiesPermission where p.ID == oTask.Community.Id select p.Permissions).FirstOrDefault();
                        if (module == null)
                        {
                            module = new  ModuleTasklist();
                        }
                    }
                    else
                    {
                        CommunityId = 0;
                        module      = ModuleTasklist.CreatePortalmodule(UserContext.UserTypeID);
                    }

                    CoreModuleRepository moduleRepository = View.RepositoryPermission(CommunityId);
                    CoreItemPermission   oPermission      = Service.GetTaskPermission(oTask, module, moduleRepository);
                    if (oPermission.AllowAddFiles || oPermission.AllowEdit)
                    {
                        if (oTask.Community == 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, oTask.ID);
                        View.SetBackToItemUrl(CommunityId, oTask.ID);
                        View.SetMultipleUploadUrl(oTask.ID);
                        LoadTaskFiles(oTask, oPermission);
                    }
                    else
                    {
                        this.View.ReturnToItemsList(CommunityId, oTask.ID);
                    }
                }
            }
            View.ItemCommunityId = CommunityId;
        }