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