コード例 #1
0
 public void AuthorizeDeleteThread(DeleteThreadInfo info)
 {
     // Check user has minimum permissions required
     _functionAuthorizer.Authorize(new UserFunction {
         Function = ForumFunctions.ForumAdmin, UserId = info.UserId, TenantId = info.TenantId
     });
 }
コード例 #2
0
        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));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public void ValidateDeleteThread(DeleteThreadInfo info)
 {
     // Nothing to do
 }