public void AuthorizeDeleteThread(DeleteThreadInfo info) { // Check user has minimum permissions required _functionAuthorizer.Authorize(new UserFunction { Function = ForumFunctions.ForumAdmin, UserId = info.UserId, TenantId = info.TenantId }); }
private FormResult PostDeleteThreadForm(Form form) { // Get logged on user details long tenantId = _authenticationService.TenantId; long userId = _authenticationService.GetCurrentUser().User.UserId; // Get page, element and thread identifiers string[] parts = form.Context.Split('|'); long pageId = Convert.ToInt64(parts[1]); long elementId = Convert.ToInt64(parts[2]); long threadId = Convert.ToInt64(parts[3]); // Get existing thread details Page page = _pageService.Read(tenantId, pageId); // Get information required to delete thread DeleteThreadInfo info = new DeleteThreadInfo { ElementId = elementId, TenantId = tenantId, ThreadId = threadId, UserId = userId }; // Delete thread _forumService.DeleteThread(info); // Return form result with no errors string status = _forumUrlService.GetForumUrl(pageId, page.Name); return(_formHelperService.GetFormResult(status)); }
public void DeleteThread(DeleteThreadInfo info, IUnitOfWork unitOfWork = null) { // Check user permissions _forumAuthorizer.AuthorizeDeleteThread(info); // Validate supplied thread details _forumValidator.ValidateDeleteThread(info); // Delete thread _forumRepository.DeleteThread(info.TenantId, info.ElementId, info.ThreadId, unitOfWork); }
public void ValidateDeleteThread(DeleteThreadInfo info) { // Nothing to do }