Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ protected IActionResult AccessDeniedPartial()
return RedirectToAction("AccessDeniedPartial", "Common");
}

protected IActionResult ProjectAccessDenied(string message)
protected IActionResult ProjectAccessDenied(string projectName)
{
return RedirectToAction("ProjectAccessDenied", "Common", new { message });
return RedirectToAction("ProjectAccessDenied", "Common", new { project = projectName });
}

protected IActionResult AccessDeniedDataRead()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Taskist.Core.Common;
using Taskist.Core.Extensions;
using System.Text.Encodings.Web;
using Taskist.Service.Localization;
using Taskist.Service.Logging;
using Taskist.Service.Masters;
using Taskist.Service.Security;
Expand All @@ -15,18 +17,21 @@ public class CommonController : BaseController
protected readonly ISystemService _systemService;
protected readonly IGenericAttributeService _genericAttributeService;
protected readonly ILogService _logService;
protected readonly ILocalizationService _localizationService;

#endregion

#region Ctor

public CommonController(ISystemService systemService,
IGenericAttributeService genericAttributeService,
ILogService logService)
ILogService logService,
ILocalizationService localizationService)
{
_systemService = systemService;
_genericAttributeService = genericAttributeService;
_logService = logService;
_localizationService = localizationService;
}

#endregion
Expand All @@ -53,8 +58,10 @@ public ActionResult NoDataPartial()
return PartialView();
}

public ActionResult ProjectAccessDenied(string message)
public async Task<IActionResult> ProjectAccessDenied(string project)
{
var template = await _localizationService.GetResourceAsync("Error.ProjectAccessDenied");
var message = string.Format(template, HtmlEncoder.Default.Encode(project ?? string.Empty));
return View(model: message);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public async Task<IActionResult> Edit(int id, int project = 0)

var accessibleProjects = await _userService.GetAllAccessibleProjects(UserId);
if (!accessibleProjects.Any(x => x.Id == entity.ProjectId))
return ProjectAccessDenied(string.Format(await _localizationService.GetResourceAsync("Error.ProjectAccessDenied"), entity.Project.Name));
return ProjectAccessDenied(entity.Project.Name);

var model = _workItemsMapper.ToModel(entity);
model.Owner = entity.CreatedBy.Name;
Expand Down
Loading