private void UpdateRuleAction(StoreObjectId replytemplateMessageId)
 {
     using (IModifyTable ruleTable = base.Context.CurrentFolder.GetRuleTable(null))
     {
         RuleAction       ruleAction = base.Context.CurrentRule.Actions[base.ActionIndex];
         RuleAction.Reply reply      = (RuleAction.Reply)ruleAction;
         RuleAction[]     value      = new RuleAction[]
         {
             new RuleAction.ReplyAction(reply.UserFlags, RuleActionConverter.MapiReplyFlagsToReplyFlags(reply.Flags), replytemplateMessageId, this.replyTemplateGuid)
         };
         PropValue[] propValues = new PropValue[]
         {
             new PropValue(InternalSchema.RuleId, base.Context.CurrentRule.ID),
             new PropValue(InternalSchema.RuleActions, value)
         };
         ruleTable.ModifyRow(propValues);
         ruleTable.ApplyPendingChanges();
     }
     base.Context.TraceDebug("Successfully updated the rule action with TemplateMessageId and/or Guid");
 }
        void IDestinationFolder.SetACL(SecurityProp secProp, PropValueData[][] aclData)
        {
            MrsTracer.Provider.Function("StorageDestinationFolder.SetACL: {0}, isNullAcl: {1}", new object[]
            {
                base.DisplayNameForTracing,
                aclData == null
            });
            if (aclData == null)
            {
                return;
            }
            ModifyTableOptions options = (secProp == SecurityProp.FreeBusyNTSD) ? ModifyTableOptions.FreeBusyAware : ModifyTableOptions.None;

            using (IModifyTable permissionTable = base.CoreFolder.GetPermissionTable(options))
            {
                permissionTable.Clear();
                foreach (PropValueData[] array in aclData)
                {
                    long?        num          = null;
                    byte[]       array2       = null;
                    MemberRights memberRights = MemberRights.None;
                    foreach (PropValueData propValueData in array)
                    {
                        int propTag = propValueData.PropTag;
                        if (propTag != 268370178)
                        {
                            if (propTag != 1718681620)
                            {
                                if (propTag == 1718812675)
                                {
                                    memberRights = (MemberRights)propValueData.Value;
                                }
                            }
                            else
                            {
                                num = new long?((long)propValueData.Value);
                            }
                        }
                        else
                        {
                            array2 = (byte[])propValueData.Value;
                        }
                    }
                    PropValue[] array3 = new PropValue[2];
                    array3[0] = new PropValue(PermissionSchema.MemberRights, memberRights);
                    if (num != null && (num.Value == 0L || num.Value == -1L))
                    {
                        array3[1] = new PropValue(PermissionSchema.MemberId, num);
                        permissionTable.ModifyRow(array3);
                    }
                    else if (array2 != null)
                    {
                        array3[1] = new PropValue(PermissionSchema.MemberEntryId, array2);
                        permissionTable.AddRow(array3);
                    }
                }
                using (base.Mailbox.RHTracker.Start())
                {
                    permissionTable.ApplyPendingChanges();
                }
            }
        }
Exemple #3
0
        public override void Apply(CoreFolder folder)
        {
            if (this.Value == null)
            {
                return;
            }
            ModifyTableOptions modifyTableOptions = this.Flags.HasFlag(AclFlags.FreeBusyAcl) ? ModifyTableOptions.FreeBusyAware : ModifyTableOptions.None;

            modifyTableOptions |= ModifyTableOptions.ExtendedPermissionInformation;
            using (IModifyTable permissionTableDoNotLoadEntries = folder.GetPermissionTableDoNotLoadEntries(modifyTableOptions))
            {
                foreach (PropValueData[] array in this.Value)
                {
                    List <PropValue> list = new List <PropValue>();
                    int j = 0;
                    while (j < array.Length)
                    {
                        PropValueData propValueData = array[j];
                        int           propTag       = propValueData.PropTag;
                        if (propTag <= 1718747166)
                        {
                            if (propTag != 268370178)
                            {
                                if (propTag != 1718681620)
                                {
                                    if (propTag != 1718747166)
                                    {
                                        goto IL_168;
                                    }
                                    list.Add(new PropValue(PermissionSchema.MemberName, (string)propValueData.Value));
                                }
                            }
                            else
                            {
                                byte[] array2 = (byte[])propValueData.Value;
                                if (array2 != null)
                                {
                                    list.Add(new PropValue(PermissionSchema.MemberEntryId, array2));
                                }
                            }
                        }
                        else if (propTag != 1718812675)
                        {
                            if (propTag != 1718878466)
                            {
                                if (propTag != 1718943755)
                                {
                                    goto IL_168;
                                }
                                list.Add(new PropValue(PermissionSchema.MemberIsGroup, (bool)propValueData.Value));
                            }
                            else
                            {
                                list.Add(new PropValue(PermissionSchema.MemberSecurityIdentifier, (byte[])propValueData.Value));
                            }
                        }
                        else
                        {
                            list.Add(new PropValue(PermissionSchema.MemberRights, (MemberRights)propValueData.Value));
                        }
IL_191:
                        j++;
                        continue;
IL_168:
                        MrsTracer.Provider.Warning("StorageDestinationFolder.SetAcl: Unknown PropTag 0x{0:x}", new object[]
                        {
                            propValueData.PropTag
                        });
                        goto IL_191;
                    }
                    permissionTableDoNotLoadEntries.AddRow(list.ToArray());
                }
                permissionTableDoNotLoadEntries.ApplyPendingChanges();
            }
        }