Esempio n. 1
0
 public void GroupOperation(COWSettings settings, IDumpsterItemOperations dumpster, COWTriggerAction operation, FolderChangeOperationFlags flags, StoreSession sourceSession, StoreSession destinationSession, StoreObjectId destinationFolderId, StoreObjectId[] itemIds, GroupOperationResult result, bool onBeforeNotification, CallbackContext callbackContext)
 {
     EnumValidator.ThrowIfInvalid <COWTriggerAction>(operation, "operation");
     EnumValidator.ThrowIfInvalid <FolderChangeOperationFlags>(flags, "flags");
 }
Esempio n. 2
0
        public void GroupOperation(COWSettings settings, IDumpsterItemOperations dumpster, COWTriggerAction operation, FolderChangeOperationFlags flags, StoreSession sourceSession, StoreSession destinationSession, StoreObjectId destinationFolderId, StoreObjectId[] itemIds, GroupOperationResult result, bool onBeforeNotification, CallbackContext callbackContext)
        {
            EnumValidator.ThrowIfInvalid <COWTriggerAction>(operation, "operation");
            EnumValidator.ThrowIfInvalid <FolderChangeOperationFlags>(flags, "flags");
            int num = 0;

            if (itemIds != null)
            {
                foreach (StoreObjectId storeObjectId in itemIds)
                {
                    if (!(storeObjectId is OccurrenceStoreObjectId))
                    {
                        num++;
                    }
                }
            }
            if (itemIds == null || num == itemIds.Length)
            {
                dumpster.MoveItemsToDumpster(callbackContext.SessionWithBestAccess, dumpster.RecoverableItemsDeletionsFolderId, itemIds);
                return;
            }
            if (num > 0)
            {
                StoreObjectId[] array = new StoreObjectId[num];
                num = 0;
                foreach (StoreObjectId storeObjectId2 in itemIds)
                {
                    if (!(storeObjectId2 is OccurrenceStoreObjectId))
                    {
                        array[num] = storeObjectId2;
                        num++;
                    }
                }
                dumpster.MoveItemsToDumpster(callbackContext.SessionWithBestAccess, dumpster.RecoverableItemsDeletionsFolderId, array);
            }
        }
Esempio n. 3
0
 public void GroupOperation(COWSettings settings, IDumpsterItemOperations dumpster, COWTriggerAction operation, FolderChangeOperationFlags flags, StoreSession sourceSession, StoreSession destinationSession, StoreObjectId destinationFolderId, StoreObjectId[] itemIds, GroupOperationResult result, bool onBeforeNotification, CallbackContext callbackContext)
 {
     EnumValidator.ThrowIfInvalid <COWTriggerAction>(operation, "operation");
     EnumValidator.ThrowIfInvalid <FolderChangeOperationFlags>(flags, "flags");
     if (settings.CurrentFolderId.Equals(dumpster.RecoverableItemsPurgesFolderId))
     {
         ExTraceGlobals.SessionTracer.TraceDebug((long)dumpster.StoreSession.GetHashCode(), "Attempt to hard delete items in the dumpster purges folder");
         throw new RecoverableItemsAccessDeniedException("Purges");
     }
     if (settings.CurrentFolderId.Equals(dumpster.RecoverableItemsDiscoveryHoldsFolderId))
     {
         ExTraceGlobals.SessionTracer.TraceDebug((long)dumpster.StoreSession.GetHashCode(), "Attempt to hard delete items in the dumpster discoveryholds folder");
         throw new RecoverableItemsAccessDeniedException("DiscoveryHolds");
     }
     if (COWTriggerAction.HardDelete == operation)
     {
         try
         {
             StoreObjectId storeObjectId;
             if (settings.IsOnlyInPlaceHoldEnabled())
             {
                 settings.Session.CowSession.CheckAndCreateDiscoveryHoldsFolder(callbackContext.SessionWithBestAccess);
                 storeObjectId = dumpster.RecoverableItemsDiscoveryHoldsFolderId;
             }
             else
             {
                 storeObjectId = dumpster.RecoverableItemsPurgesFolderId;
             }
             if (!settings.CurrentFolderId.Equals(storeObjectId))
             {
                 dumpster.MoveItemsToDumpster(callbackContext.SessionWithBestAccess, storeObjectId, itemIds);
             }
             return;
         }
         catch (DumpsterOperationException)
         {
             if (dumpster.Results.AnyPartialResultFailure())
             {
                 throw;
             }
             List <GroupOperationResult> partialResults = dumpster.Results.GetPartialResults();
             ExTraceGlobals.SessionTracer.TraceWarning <GroupOperationResult>((long)dumpster.StoreSession.GetHashCode(), "DumpsterOperationException during HardDelete and Partial success: leave the current results {0}", partialResults[partialResults.Count - 1]);
             return;
         }
     }
     dumpster.CopyItemsToDumpster(callbackContext.SessionWithBestAccess, dumpster.RecoverableItemsPurgesFolderId, itemIds, COWTriggerAction.DoneWithMessageDelete == operation);
 }
Esempio n. 4
0
        public void GroupOperation(COWSettings settings, IDumpsterItemOperations dumpster, COWTriggerAction operation, FolderChangeOperationFlags flags, StoreSession sourceSession, StoreSession destinationSession, StoreObjectId destinationFolderId, StoreObjectId[] itemIds, GroupOperationResult result, bool onBeforeNotification, CallbackContext callbackContext)
        {
            EnumValidator.ThrowIfInvalid <COWTriggerAction>(operation, "operation");
            EnumValidator.ThrowIfInvalid <FolderChangeOperationFlags>(flags, "flags");
            Util.ThrowOnNullArgument(dumpster, "dumpster");
            if (itemIds == null)
            {
                return;
            }
            if (dumpster.IsDumpsterOverCalendarLoggingQuota(callbackContext.SessionWithBestAccess, settings))
            {
                ExTraceGlobals.CalendarLoggingTracer.Information <string, string>((long)sourceSession.GetHashCode(), "User {0} has exceeded the calendar logging quota of {1}", sourceSession.UserLegacyDN, settings.CalendarLoggingQuota.Value.ToString("A"));
                StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_COWCalendarLoggingStopped, sourceSession.UserLegacyDN, new object[]
                {
                    sourceSession.UserLegacyDN
                });
                return;
            }
            if (dumpster.IsDumpsterOverWarningQuota(settings))
            {
                ExTraceGlobals.CalendarLoggingTracer.Information <string, string>((long)sourceSession.GetHashCode(), "Disabling calendar logging for user {0}, since it has exceeded the dumpster warning quota of {1}", sourceSession.UserLegacyDN, settings.DumpsterWarningQuota.Value.ToString("A"));
                dumpster.DisableCalendarLogging();
                return;
            }
            foreach (StoreObjectId storeObjectId in itemIds)
            {
                ICoreItem coreItem           = null;
                StoragePermanentException ex = null;
                try
                {
                    if (CalendarLoggingHelper.ShouldBeCopiedOnWrite(storeObjectId))
                    {
                        if (CalendarLoggingHelper.ShouldLogInitialCheck(storeObjectId, operation))
                        {
                            try
                            {
                                coreItem = CoreItem.Bind(callbackContext.SessionWithBestAccess, storeObjectId, CalendarLoggingHelper.RequiredOriginalProperties);
                                if (!CalendarLoggingHelper.ShouldLog(coreItem, operation))
                                {
                                    goto IL_25A;
                                }
                                if (coreItem.PropertyBag.GetValueOrDefault <bool>(InternalSchema.HasBeenSubmitted))
                                {
                                    ExTraceGlobals.CalendarLoggingTracer.TraceWarning <ICoreItem, COWTriggerAction>((long)callbackContext.SessionWithBestAccess.GetHashCode(), "Save Item for Calendar Logging skipped as the item.HasBeenSubmitted is true (item {0}, operation {1}.", coreItem, operation);
                                    goto IL_25A;
                                }
                                switch (operation)
                                {
                                case COWTriggerAction.Move:
                                case COWTriggerAction.MoveToDeletedItems:
                                case COWTriggerAction.SoftDelete:
                                    if (!this.PerformFolderCopyOnWrite(settings, dumpster, coreItem, callbackContext.SessionWithBestAccess, operation, flags, false))
                                    {
                                        goto IL_25A;
                                    }
                                    break;

                                case COWTriggerAction.HardDelete:
                                {
                                    StoreObjectId parentIdFromMessageId = IdConverter.GetParentIdFromMessageId(storeObjectId);
                                    if (DumpsterFolderHelper.IsAuditFolder(callbackContext.SessionWithBestAccess, parentIdFromMessageId))
                                    {
                                        goto IL_25A;
                                    }
                                    if (DumpsterFolderHelper.IsDumpsterFolder(callbackContext.SessionWithBestAccess, parentIdFromMessageId))
                                    {
                                        this.PerformCopyOnWrite(callbackContext.SessionWithBestAccess, dumpster, storeObjectId);
                                        goto IL_25A;
                                    }
                                    if (!this.PerformFolderCopyOnWrite(settings, dumpster, coreItem, callbackContext.SessionWithBestAccess, operation, flags, !settings.HoldEnabled()))
                                    {
                                        goto IL_25A;
                                    }
                                    break;
                                }
                                }
                            }
                            catch (ObjectNotFoundException ex2)
                            {
                                ex = ex2;
                            }
                            catch (VirusDetectedException ex3)
                            {
                                ex = ex3;
                            }
                            catch (VirusMessageDeletedException ex4)
                            {
                                ex = ex4;
                            }
                            catch (VirusException ex5)
                            {
                                ex = ex5;
                            }
                            if (ex != null)
                            {
                                ExTraceGlobals.CalendarLoggingTracer.TraceWarning <StoreObjectId, StoragePermanentException, COWTriggerAction>((long)callbackContext.SessionWithBestAccess.GetHashCode(), "Item ({0}) processing for Calendar Logging failure {1} (operation {2}).", storeObjectId, ex, operation);
                            }
                        }
                    }
                }
                finally
                {
                    if (coreItem != null)
                    {
                        coreItem.Dispose();
                    }
                }
                IL_25A :;
            }
        }