Exemple #1
0
        //[Route("geodatalov/{registername}/ny")]
        //[Route("geodatalov/{parentregister}/{registerowner}/{registername}/ny")]
        public ActionResult Create(string registername, string parentregister)
        {
            var viewModel = _geodatalovDatasetService.NewGeodatalovDatasetViewModel(parentregister, registername);

            if (_accessControlService.Access(viewModel.Register))
            {
                return(View(viewModel));
            }
            throw new HttpException(401, "Access Denied");
        }
Exemple #2
0
        //[Route("subregister/{registerparant}/{parentRegisterOwner}/{registername}/ny")]
        //[Route("subregister/{registername}/ny")]
        public ActionResult Create(string registerparant, string parentRegisterOwner, string registername)
        {
            var register = new Models.Register();

            register.parentRegister = _registerService.GetRegister(registerparant, registername);

            if (_accessControlService.Access(register.parentRegister))
            {
                register.AddMissingTranslations();
                ViewBagSubregister(register);

                return(View(register));
            }
            return(HttpNotFound());
        }
        //[Route("epsg/{registername}/ny")]
        //[Route("epsg/{parentRegister}/{registerowner}/{registername}/ny")]
        public ActionResult Create(string registername, string parentRegister)
        {
            EPSG ePSg = new EPSG();

            ePSg.AddMissingTranslations();
            ePSg.register = _registerService.GetRegister(parentRegister, registername);
            if (ePSg.register != null)
            {
                if (_accessControlService.Access(ePSg.register))
                {
                    ViewBag.dimensionId = new SelectList(db.Dimensions.ToList().Select(s => new { value = s.value, description = s.DescriptionTranslated() }).OrderBy(s => s.description), "value", "description", string.Empty);
                    return(View(ePSg));
                }
            }
            return(HttpNotFound("Ingen tilgang"));
        }
        //[Route("organisasjoner/{parentRegister}/{registerowner}/{registername}/ny")]
        //[Route("organisasjoner/{registername}/ny")]
        public ActionResult Create(string registername, string parentRegister)
        {
            Organization organisasjon = new Organization();

            organisasjon.AddMissingTranslations();
            organisasjon.register = _registerService.GetRegister(parentRegister, registername);
            if (organisasjon.register != null)
            {
                if (_accessControlService.Access(organisasjon.register))
                {
                    ViewBag.dimensionId = new SelectList(_dbContext.Dimensions.OrderBy(s => s.description), "value", "description", string.Empty);
                    return(View(organisasjon));
                }
            }
            return(HttpNotFound("Ingen tilgang"));
        }
        //[Route("tjenestevarsler/{parentregister}/{registerowner}/{registerName}/ny")]
        //[Route("tjenestevarsler/{registerName}/ny")]
        public ActionResult Create(string parentRegister, string registerName, string category = Constants.AlertCategoryService)
        {
            Alert alert = new Alert();

            alert.AddMissingTranslations();
            alert.register = _registerService.GetRegister(parentRegister, registerName);
            ViewBags(alert, category);

            if (alert.register != null)
            {
                if (_accessControlService.Access(alert.register))
                {
                    return(View(alert));
                }
            }
            return(HttpNotFound());
        }
        //[Route("inspire-data-service/{registername}/{itemowner}/{itemname}/rediger")]
        public ActionResult Edit(string registername, string itemname)
        {
            var inspireDataService = _inspireDatasetService.GetInspireDataServiceByName(registername, itemname);

            if (inspireDataService == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (_accessControlService.Access(inspireDataService))
            {
                inspireDataService = _inspireDatasetService.UpdateInspireDataServiceFromKartkatalogen(inspireDataService);
                var viewModel = new InspireDataServiceViewModel(inspireDataService);
                ViewBags(viewModel);
                return(View(viewModel));
            }
            throw new HttpException(401, "Access Denied");
        }
        //[Route("dataset/{parentRegister}/{registerowner}/{registername}/ny")]
        //[Route("dataset/{registername}/ny")]
        public ActionResult Create(string registername, string parentRegister)
        {
            Dataset dataset = new Dataset();

            dataset.register = _registerService.GetRegister(parentRegister, registername);
            if (dataset.register != null)
            {
                dataset.DatasetType = GetDatasetType(dataset.register.name);
                Viewbags(dataset);
                if (_accessControlService.Access(dataset.register))
                {
                    return(View(dataset));
                }

                throw new HttpException(401, "Access Denied");
            }
            return(HttpNotFound("Finner ikke registeret"));
        }
        public ActionResult DetailsRegisterItem(string parentRegister, string registername, string itemowner, string itemname, string format, string systemId, string InspireRegisteryType = null)
        {
            var redirectToApiUrl = RedirectToApiIfFormatIsNotNull(format);

            if (!string.IsNullOrWhiteSpace(redirectToApiUrl))
            {
                return(Redirect(redirectToApiUrl));
            }

            RegisterItemV2ViewModel viewModel;

            try
            {
                if (string.IsNullOrWhiteSpace(systemId))
                {
                    viewModel = GetRegisterItemByName(parentRegister, registername, itemowner, itemname, InspireRegisteryType);
                }
                else
                {
                    viewModel = GetRegisterItemById(parentRegister, registername, systemId, InspireRegisteryType);
                }
            }
            catch (Exception e)
            {
                return(HttpNotFound());
            }
            if (viewModel.RedirectToNewPath(HttpContext.Request.Path))
            {
                return(RedirectPermanent(viewModel.DetailPageUrl()));
            }
            viewModel.AccessRegisterItem = _accessControlService.Access(viewModel);
            if (string.IsNullOrWhiteSpace(viewModel.Name))
            {
                return(HttpNotFound());
            }
            return(View(viewModel));
        }
Exemple #9
0
        //[Route("kodeliste/{parentregister}/{registerowner}/{registername}/ny/import")]
        //[Route("kodeliste/{registername}/ny/import")]
        public ActionResult Import(string registername, string parentregister)
        {
            var register = _registerService.GetRegister(parentregister, registername);

            if (register != null)
            {
                if (_accessControlService.Access(register))
                {
                    ViewbagImport(register);
                    return(View());
                }
                throw new HttpException(401, "Access Denied");
            }
            return(HttpNotFound("Fant ikke register"));
        }
Exemple #10
0
        //[Route("dokument/{parentRegister}/{registerowner}/{registername}/ny")]
        //[Route("dokument/{registername}/ny")]
        public ActionResult Create(string registername, string parentRegister)
        {
            Document document = new Document();

            document.AddMissingTranslations();
            document.register = _registerService.GetRegister(parentRegister, registername);
            if (document.register != null)
            {
                if (_accessControlService.Access(document.register))
                {
                    return(View(document));
                }
                return(HttpNotFound("Ingen tilgang"));
            }
            return(HttpNotFound("Finner ikke registeret"));
        }
 public static bool Access(object model)
 {
     return(AccessControl.Access(model));
 }