Add support for IsPublic to all Setting types, enable Url Mapping for internal links
This commit is contained in:
@ -48,7 +48,7 @@ namespace Oqtane.Controllers
|
||||
public UrlMapping Get(int id)
|
||||
{
|
||||
var urlMapping = _urlMappings.GetUrlMapping(id);
|
||||
if (urlMapping != null && (urlMapping.SiteId == _alias.SiteId))
|
||||
if (urlMapping != null && urlMapping.SiteId == _alias.SiteId)
|
||||
{
|
||||
return urlMapping;
|
||||
}
|
||||
@ -60,6 +60,23 @@ namespace Oqtane.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
// GET api/<controller>/url/x?url=y
|
||||
[HttpGet("url/{siteid}")]
|
||||
public UrlMapping Get(int siteid, string url)
|
||||
{
|
||||
var urlMapping = _urlMappings.GetUrlMapping(siteid, WebUtility.UrlDecode(url));
|
||||
if (urlMapping != null && urlMapping.SiteId == _alias.SiteId)
|
||||
{
|
||||
return urlMapping;
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized UrlMapping Get Attempt {SiteId} {Url}", siteid, url);
|
||||
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// POST api/<controller>
|
||||
[HttpPost]
|
||||
[Authorize(Roles = RoleNames.Admin)]
|
||||
|
Reference in New Issue
Block a user