Authorization Logging #24

Record 'Access Denied' and any changes to Authorization Roles.
This commit is contained in:
Gary Sharp
2013-10-15 16:13:41 +11:00
parent 7b62eabeee
commit 017b1435d8
14 changed files with 515 additions and 223 deletions
@@ -6,6 +6,7 @@ using System.Web;
using System.Web.Mvc;
using Disco.Services.Plugins;
using Disco.Services.Authorization;
using Disco.Services.Users;
namespace Disco.Web.Controllers
{
@@ -28,6 +29,9 @@ namespace Disco.Web.Controllers
}
catch (AccessDeniedException accessDeniedException)
{
if (UserService.CurrentUserId != null)
AuthorizationLog.LogAccessDenied(UserService.CurrentUserId, string.Format("{0} [{1}]", accessDeniedException.Resource, Request.RawUrl), accessDeniedException.Message);
return new HttpUnauthorizedResult(accessDeniedException.Message);
}
}