Correct authorization issue with city controller
This commit is contained in:
@@ -7,16 +7,22 @@ using MileageTraker.Web.Utility;
|
|||||||
|
|
||||||
namespace MileageTraker.Web.Controllers
|
namespace MileageTraker.Web.Controllers
|
||||||
{
|
{
|
||||||
[Authorize(Roles = "Administrator, Developer")]
|
[Authorize]
|
||||||
public class CityController : ControllerBase
|
public class CityController : ControllerBase
|
||||||
{
|
{
|
||||||
[Authorize(Roles = "Administrator, Developer, Driver")]
|
|
||||||
public JsonResult Autocomplete(string term)
|
public JsonResult Autocomplete(string term)
|
||||||
{
|
{
|
||||||
var cities = DataService.GetCitiesAutocomplete(term);
|
var cities = DataService.GetCitiesAutocomplete(term);
|
||||||
return Json(cities, JsonRequestBehavior.AllowGet);
|
return Json(cities, JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JsonResult CityNameExists(string cityname)
|
||||||
|
{
|
||||||
|
var city = DataService.FindCityByName(cityname);
|
||||||
|
return Json(city != null, JsonRequestBehavior.AllowGet);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Authorize(Roles = "Administrator, Developer")]
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
var cities = DataService.GetCities().ToList();
|
var cities = DataService.GetCities().ToList();
|
||||||
@@ -25,12 +31,14 @@ namespace MileageTraker.Web.Controllers
|
|||||||
return View(groupTuple);
|
return View(groupTuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Authorize(Roles = "Administrator, Developer")]
|
||||||
public ActionResult Create(string county)
|
public ActionResult Create(string county)
|
||||||
{
|
{
|
||||||
var city = new City {County = county};
|
var city = new City {County = county};
|
||||||
return View(city);
|
return View(city);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Authorize(Roles = "Administrator, Developer")]
|
||||||
[ActionLog]
|
[ActionLog]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Create([Bind(Exclude = "CityId")] City city)
|
public ActionResult Create([Bind(Exclude = "CityId")] City city)
|
||||||
@@ -46,17 +54,11 @@ namespace MileageTraker.Web.Controllers
|
|||||||
return View(city);
|
return View(city);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Authorize(Roles = "Administrator, Developer")]
|
||||||
public JsonResult CityNameAvailable(string name)
|
public JsonResult CityNameAvailable(string name)
|
||||||
{
|
{
|
||||||
var city = DataService.FindCityByName(name);
|
var city = DataService.FindCityByName(name);
|
||||||
return Json(city == null, JsonRequestBehavior.AllowGet);
|
return Json(city == null, JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authorize(Roles = "Administrator, Developer, Driver")]
|
|
||||||
public JsonResult CityNameExists(string cityname)
|
|
||||||
{
|
|
||||||
var city = DataService.FindCityByName(cityname);
|
|
||||||
return Json(city != null, JsonRequestBehavior.AllowGet);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace MileageTraker.Web.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
[ActionLog]
|
||||||
public ActionResult Index(CreateLogViewModel model)
|
public ActionResult Index(CreateLogViewModel model)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
|
|||||||
Reference in New Issue
Block a user