public CowClientOperationSensitivity SkipGroupOperation(COWSettings settings, IDumpsterItemOperations dumpster, COWTriggerAction operation, FolderChangeOperationFlags flags, StoreSession sourceSession, StoreSession destinationSession, StoreObjectId sourceFolderId, StoreObjectId destinationFolderId, ICollection <StoreObjectId> itemIds, bool onBeforeNotification, bool onDumpster, CallbackContext callbackContext) { EnumValidator.ThrowIfInvalid <COWTriggerAction>(operation, "operation"); EnumValidator.ThrowIfInvalid <FolderChangeOperationFlags>(flags, "flags"); MailboxSession mailboxSession = sourceSession as MailboxSession; if (mailboxSession == null) { return(CowClientOperationSensitivity.Skip); } if (onBeforeNotification && (COWTriggerAction.Copy == operation || COWTriggerAction.HardDelete == operation || COWTriggerAction.Move == operation || COWTriggerAction.MoveToDeletedItems == operation || COWTriggerAction.SoftDelete == operation)) { StoreObjectId auditsFolderId = dumpster.AuditsFolderId; StoreObjectId adminAuditLogsFolderId = dumpster.AdminAuditLogsFolderId; if (settings.CurrentFolderId != null && (COWTriggerAction.HardDelete != operation || LogonType.SystemService != sourceSession.LogonType || !settings.IsMrmAction())) { this.CheckAccessOnAuditFolders(mailboxSession, settings.CurrentFolderId, dumpster, false); } if (itemIds != null) { foreach (StoreObjectId storeObjectId in itemIds) { if (storeObjectId != null) { if (storeObjectId.IsMessageId) { if (settings.CurrentFolderId == null && (COWTriggerAction.HardDelete != operation || LogonType.SystemService != sourceSession.LogonType || !settings.IsMrmAction())) { StoreObjectId parentIdFromMessageId = IdConverter.GetParentIdFromMessageId(storeObjectId); if (parentIdFromMessageId.Equals(auditsFolderId)) { throw new AccessDeniedException(ServerStrings.ExAuditsUpdateDenied); } if (parentIdFromMessageId.Equals(adminAuditLogsFolderId)) { throw new AccessDeniedException(ServerStrings.ExAdminAuditLogsUpdateDenied); } if (dumpster.IsAuditFolder(parentIdFromMessageId)) { throw new AccessDeniedException((auditsFolderId != null) ? ServerStrings.ExAuditsUpdateDenied : ServerStrings.ExAdminAuditLogsUpdateDenied); } } } else if (storeObjectId.IsFolderId) { this.CheckAccessOnAuditFolders(mailboxSession, storeObjectId, dumpster, true); } } } } } return(CowClientOperationSensitivity.Skip); }
public CowClientOperationSensitivity SkipGroupOperation(COWSettings settings, IDumpsterItemOperations dumpster, COWTriggerAction operation, FolderChangeOperationFlags flags, StoreSession sourceSession, StoreSession destinationSession, StoreObjectId sourceFolderId, StoreObjectId destinationFolderId, ICollection <StoreObjectId> itemIds, bool onBeforeNotification, bool onDumpster, CallbackContext callbackContext) { EnumValidator.ThrowIfInvalid <COWTriggerAction>(operation, "operation"); EnumValidator.ThrowIfInvalid <FolderChangeOperationFlags>(flags, "flags"); Util.ThrowOnNullArgument(settings, "settings"); Util.ThrowOnNullArgument(sourceSession, "sourceSession"); if (onDumpster) { return(CowClientOperationSensitivity.Skip); } if (!onBeforeNotification) { return(CowClientOperationSensitivity.Skip); } bool flag; if (!settings.HoldEnabled()) { flag = true; } else { switch (operation) { case COWTriggerAction.Move: case COWTriggerAction.MoveToDeletedItems: { Util.ThrowOnNullArgument(sourceSession, "sourceSession"); if (destinationSession == null) { flag = true; ExTraceGlobals.SessionTracer.TraceDebug((long)dumpster.StoreSession.GetHashCode(), "Destination session is null, meaning item moving to same mailbox, so don't keep a copy."); goto IL_187; } Guid mailboxGuid = destinationSession.MailboxGuid; Guid mailboxGuid2 = sourceSession.MailboxGuid; if (destinationSession.MailboxGuid == sourceSession.MailboxGuid) { flag = true; ExTraceGlobals.SessionTracer.TraceDebug((long)dumpster.StoreSession.GetHashCode(), "Mailbox guids are the same, meaning item moving to same mailbox, so don't keep a copy."); goto IL_187; } if (destinationSession is MailboxSession && sourceSession is MailboxSession && string.Compare(((MailboxSession)sourceSession).MailboxOwner.LegacyDn, ((MailboxSession)destinationSession).MailboxOwner.LegacyDn, StringComparison.OrdinalIgnoreCase) == 0) { flag = true; ExTraceGlobals.SessionTracer.TraceDebug((long)dumpster.StoreSession.GetHashCode(), "MailboxOwner.LegacyDistinguishedName is the same, meaning same person owns both mailboxes (eg primary and archive), so don't keep a copy."); goto IL_187; } flag = false; ExTraceGlobals.SessionTracer.TraceDebug((long)dumpster.StoreSession.GetHashCode(), "Item moving to a different mailbox owned by someone else. Keep a copy."); goto IL_187; } case COWTriggerAction.HardDelete: flag = (settings.IsMrmAction() && DumpsterFolderHelper.IsDumpsterFolder(callbackContext.SessionWithBestAccess, sourceFolderId)); goto IL_187; case COWTriggerAction.DoneWithMessageDelete: flag = false; goto IL_187; } flag = true; } IL_187: if (flag) { return(CowClientOperationSensitivity.Skip); } if (COWSession.IsDelegateSession(sourceSession)) { return(CowClientOperationSensitivity.Capture); } return(CowClientOperationSensitivity.CaptureAndPerformOperation); }