Esempio n. 1
0
 /// <summary>
 /// Audits object version rollbacks.
 /// </summary>
 /// <param name="repositoryObject"><see cref="T:Tridion.ContentManager.ContentManagement.RepositoryLocalObject" /></param>
 /// <param name="args">The <see cref="RollbackEventArgs" /> instance containing the event data.</param>
 /// <param name="phase"><see cref="T:Tridion.ContentManager.Extensibility.EventPhases" /></param>
 private void AuditRollback(RepositoryLocalObject repositoryObject, RollbackEventArgs args, EventPhases phase)
 {
     if (phase == EventPhases.TransactionCommitted)
     {
         AuditContentEdit("Rollback", repositoryObject, String.Format("Delete Versions: {0}", args.DeleteVersions), new SqlXml(repositoryObject.ToXml().CreateNavigator().ReadSubtree()));
     }
 }
Esempio n. 2
0
        private void ContentService_RolledBack(IContentService sender, RollbackEventArgs <IContent> e)
        {
            var user             = GetUserSignature(CurrentUser);
            var contentSignature = GetContentSignature(e.Entity);

            HistoryHelper.AddHistoryItem($"{user} rolled back the following content: {contentSignature}");
        }
        private void ContentService_RollingBack(IContentService sender, RollbackEventArgs <IContent> eventArgs)
        {
            ActionModel rollBack = null;
            int         _currentUserId;

            using (var contextReference = _context.EnsureUmbracoContext()) {
                _currentUserId = contextReference.UmbracoContext.Security.CurrentUser.Id;
            }

            try {
                using (var scope = _scopeProvider.CreateScope(autoComplete: true)) {
                    var sql = scope.SqlContext.Sql().Select("*").From <ActionModel>()
                              .Where <ActionModel>(x => x.id == 8);
                    rollBack = scope.Database.Fetch <ActionModel>(sql).FirstOrDefault();
                }
            }
            catch (Exception ex) {
                _logger.Error <ActionModel>("Failed to get Content Protector setting for rollBack action: " + ex.Message);
            }

            if (rollBack != null)
            {
                if (rollBack.nodes.Contains(eventArgs.Entity.Id.ToString()) || rollBack.disableAction)
                {
                    if (!rollBack.userExceptions.Split(',').Contains(_currentUserId.ToString()))
                    {
                        eventArgs.CancelOperation(new EventMessage("Action rejected. Contact website admin", "You cannot rollBack " + eventArgs.Entity.Name, EventMessageType.Error));
                    }
                }
            }
        }
 public virtual void RollingBack(IContentService contentService, RollbackEventArgs <IContent> args)
 {
 }
Esempio n. 5
0
 void ContentService_RolledBack(IContentService sender, RollbackEventArgs<IContent> e)
 {
     RefreshArticle(e.Entity);
 }
Esempio n. 6
0
 /// <summary>
 /// Audits object version rollbacks.
 /// </summary>
 /// <param name="repositoryObject"><see cref="T:Tridion.ContentManager.ContentManagement.RepositoryLocalObject" /></param>
 /// <param name="args">The <see cref="RollbackEventArgs" /> instance containing the event data.</param>
 /// <param name="phase"><see cref="T:Tridion.ContentManager.Extensibility.EventPhases" /></param>
 private void AuditRollback(RepositoryLocalObject repositoryObject, RollbackEventArgs args, EventPhases phase)
 {
     if (phase == EventPhases.TransactionCommitted)
         AuditContentEdit("Rollback", repositoryObject, String.Format("Delete Versions: {0}", args.DeleteVersions), new SqlXml(repositoryObject.ToXml().CreateNavigator().ReadSubtree()));
 }