Пример #1
0
        /// <summary>
        /// Create the default home page zone and zone user role during setup.
        /// </summary>
        /// <returns></returns>
        private void InsertHomePageZone(int HomePageId)
        {
            CmsPageSecurityZone z = new CmsPageSecurityZone();

            z.ZoneName = "Default zone";

            z.StartingPage = pagerepository.Get(HomePageId);
            if (new CmsPageSecurityZoneDb().insert(z) == false)
            {
                throw new Exception("Cannot insert Home Page Zone");
            }

            // anonymous users can read, but not write pages in this zone
            CmsPageSecurityZoneUserRole anonZoneRole = new CmsPageSecurityZoneUserRole(z.Id, WebPortalUserRole.DUMMY_PUBLIC_ROLE_ID, true, false);

            if (new CmsPageSecurityZoneUserRoleDb().insert(anonZoneRole) == false)
            {
                throw new Exception("Cannot insert anonymous ZoneUserRole");
            }

            // authors can write and read all pages in this zone
            WebPortalUserRole authorRole = WebPortalUserRole.Fetch(CmsConfig.getConfigValue("AuthorAccessUserRole", "Author"));

            if (authorRole.RoleID >= 0)
            {
                CmsPageSecurityZoneUserRole authorZoneRole = new CmsPageSecurityZoneUserRole(z.Id, authorRole.RoleID, true, true);
                if (new CmsPageSecurityZoneUserRoleDb().insert(authorZoneRole) == false)
                {
                    throw new Exception("Cannot insert author ZoneUserRole");
                }
            }
        }
Пример #2
0
        public ActionResult AddOrUpdate(int id = 0)
        {
            //Mapper.Initialize(cfg => cfg.CreateMap<Pages, Pyramid.Entity.Page>());
            //var ef = _pageRepo.FindBy(p => p.Id == id).SingleOrDefault();


            var model = _pageRepo.Get(id);

            if (model == null)
            {
                model = new Entity.Page();
            }
            return(View(model));
        }
        public ActionResult DeletePage(int id)
        {
            var page = pageRepository.Get(id);

            pageRepository.Remove(page);
            return(new EmptyResult());
        }
Пример #4
0
        public void CanFetchByPage()
        {
            CmsPage page = pagerepository.Get(34);
            PageSecurityZoneRepository repository = new PageSecurityZoneRepository();
            CmsPageSecurityZone        zone       = repository.fetchByPage(page, true);

            Assert.That(zone.Id, Is.EqualTo(1));
        }
Пример #5
0
        public void GetPage_Test()
        {
            PageRepository repository = new PageRepository(BaseTest.ServerMapPathFacked);

            Page page = repository.Get(Guid.Parse("c5dc1586-7d9b-4935-a79c-b89c2586c678"));

            Assert.IsNotNull(page);
        }
Пример #6
0
        /// <summary>
        /// Create the Zone entity object for adding record
        /// </summary>
        /// <param name="controlId"></param>
        /// <returns></returns>
        protected CmsPageSecurityZone createAddRecord(string controlId)
        {
            CmsPageSecurityZone data = new CmsPageSecurityZone();
            int pageid = PageUtils.getFromForm(controlId + "addStartingPageId", -999);

            Check.Assert(pageid != -9999);
            PageRepository pagerepository = new PageRepository();

            data.StartingPage = pagerepository.Get(pageid);
            data.ZoneName     = PageUtils.getFromForm(controlId + "addName", "");
            return(data);
        }
Пример #7
0
        /// <summary>
        /// Create the Zone entity object for updating record
        /// </summary>
        /// <param name="controlId"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        protected CmsPageSecurityZone createUpdateRecord(string controlId, int id)
        {
            CmsPageSecurityZone data = new CmsPageSecurityZone(id);
            int formid = PageUtils.getFromForm(controlId + "startingPageId", -999);

            Check.Assert(formid != -999);
            PageRepository repository = new PageRepository();

            data.StartingPage = repository.Get(id);

            data.ZoneName = PageUtils.getFromForm(controlId + "name", "");
            return(data);
        }
Пример #8
0
        public ActionResult UpdateForSEO(int id)
        {
            var model = (PageModel)repository.Get(id);

            return(View(model));
        }
Пример #9
0
 public void CanFetchByPage()
 {
     CmsPage page = pagerepository.Get(1);
     PageSecurityZoneRepository repository = new PageSecurityZoneRepository();
     CmsPageSecurityZone        zone       = repository.fetchByPage(page, false);
 }