Ejemplo n.º 1
0
        // Token: 0x0600156C RID: 5484 RVA: 0x0007E3B8 File Offset: 0x0007C5B8
        internal static SendMailBase.IrmAction GetIrmActionForReplyForward(ContentRight originalMessageRights, bool replaceMime, bool sameTemplateId)
        {
            bool flag  = originalMessageRights.IsUsageRightGranted(ContentRight.Export);
            bool flag2 = originalMessageRights.IsUsageRightGranted(ContentRight.Edit);

            SendMailBase.IrmAction result;
            if (flag2)
            {
                if (replaceMime)
                {
                    result = (sameTemplateId ? SendMailBase.IrmAction.ReusePublishingLicense : SendMailBase.IrmAction.CreateNewPublishingLicense);
                }
                else if (sameTemplateId)
                {
                    result = SendMailBase.IrmAction.ReusePublishingLicenseInlineOriginalBody;
                }
                else
                {
                    result = (flag ? SendMailBase.IrmAction.CreateNewPublishingLicenseInlineOriginalBody : SendMailBase.IrmAction.CreateNewPublishingLicenseAttachOriginalMessage);
                }
            }
            else
            {
                result = (replaceMime ? SendMailBase.IrmAction.CreateNewPublishingLicense : SendMailBase.IrmAction.CreateNewPublishingLicenseAttachOriginalMessage);
            }
            return(result);
        }
Ejemplo n.º 2
0
        private bool IsUsageRightRestricted(ContentRight right)
        {
            if (this.isIrmMessageInJunkEmailFolder)
            {
                if (right <= ContentRight.Forward)
                {
                    if (right != ContentRight.Print && right != ContentRight.Forward)
                    {
                        goto IL_32;
                    }
                }
                else if (right != ContentRight.Reply && right != ContentRight.ReplyAll)
                {
                    goto IL_32;
                }
                return(true);
            }
IL_32:
            RightsManagedMessageItem rightsManagedMessageItem = this.message as RightsManagedMessageItem;

            if (rightsManagedMessageItem == null || !rightsManagedMessageItem.IsRestricted)
            {
                return(false);
            }
            if (!this.userContext.IsIrmEnabled)
            {
                return(false);
            }
            if (this.irmDecryptionStatus.Failed)
            {
                return(!right.IsUsageRightGranted(ContentRight.Extract) && !right.IsUsageRightGranted(ContentRight.Print));
            }
            return(!rightsManagedMessageItem.UsageRights.IsUsageRightGranted(right));
        }
        public static ExDateTime GetUseLicenseExpiryTime(string license, ContentRight usageRights)
        {
            ArgumentValidator.ThrowIfNullOrEmpty("license", license);
            XmlDocument firstNodeXdoc = RmsClientManagerUtils.GetFirstNodeXdoc(license);

            if (firstNodeXdoc == null)
            {
                Microsoft.Exchange.Diagnostics.Components.Data.Storage.ExTraceGlobals.RightsManagementTracer.TraceDebug(0L, "Failed to parse the use license. Returning DateTime.MaxValue");
                return(ExDateTime.MaxValue);
            }
            XmlNode xmlNode = firstNodeXdoc.SelectSingleNode("XrML/BODY[@type=\"LICENSE\"]/ISSUEDTIME/text()");

            if (xmlNode == null || string.IsNullOrEmpty(xmlNode.Value))
            {
                Microsoft.Exchange.Diagnostics.Components.Data.Storage.ExTraceGlobals.RightsManagementTracer.TraceError(0L, "Failed to parse the use license to get the issued Time. Returning DateTime.MaxValue");
                return(ExDateTime.MaxValue);
            }
            DateTime d;

            if (!DateTime.TryParseExact(xmlNode.Value, "yyyy-MM-ddTHH:mm", CultureInfo.InvariantCulture, DateTimeStyles.None, out d))
            {
                Microsoft.Exchange.Diagnostics.Components.Data.Storage.ExTraceGlobals.RightsManagementTracer.TraceError <string>(0L, "Invalid IssuedTime entry {0}. Returning DateTime.MaxValue", xmlNode.Value);
                return(ExDateTime.MaxValue);
            }
            if (usageRights.IsUsageRightGranted(ContentRight.Owner))
            {
                Microsoft.Exchange.Diagnostics.Components.Data.Storage.ExTraceGlobals.RightsManagementTracer.TraceDebug(0L, "User has OWNER rights - trying to get the expiry time from owner node");
                XmlNode xmlNode2 = firstNodeXdoc.SelectSingleNode("XrML/BODY[@type=\"LICENSE\"]/WORK/RIGHTSGROUP[@name=\"Main-Rights\"]/RIGHTSLIST/OWNER/CONDITIONLIST/TIME/INTERVALTIME/@days");
                if (xmlNode2 != null)
                {
                    Microsoft.Exchange.Diagnostics.Components.Data.Storage.ExTraceGlobals.RightsManagementTracer.TraceDebug <string>(0L, "Found the owner node {0}", xmlNode2.Value);
                    int num;
                    if (int.TryParse(xmlNode2.Value, out num))
                    {
                        return(new ExDateTime(ExTimeZone.TimeZoneFromKind(DateTimeKind.Utc), d + TimeSpan.FromDays((double)num)));
                    }
                }
                Microsoft.Exchange.Diagnostics.Components.Data.Storage.ExTraceGlobals.RightsManagementTracer.TraceDebug(0L, "Couldn't find the OWNER node - either OWNER has no expiry or the value is not parsable");
                return(ExDateTime.MaxValue);
            }
            if (usageRights.IsUsageRightGranted(ContentRight.View))
            {
                Microsoft.Exchange.Diagnostics.Components.Data.Storage.ExTraceGlobals.RightsManagementTracer.TraceDebug(0L, "User has VIEW rights - trying to get the expiry time from VIEW node");
                XmlNode xmlNode3 = firstNodeXdoc.SelectSingleNode("XrML/BODY[@type=\"LICENSE\"]/WORK/RIGHTSGROUP[@name=\"Main-Rights\"]/RIGHTSLIST/VIEW/CONDITIONLIST/TIME/INTERVALTIME/@days");
                if (xmlNode3 != null)
                {
                    Microsoft.Exchange.Diagnostics.Components.Data.Storage.ExTraceGlobals.RightsManagementTracer.TraceDebug <string>(0L, "Found the view node {0}", xmlNode3.Value);
                    int num2;
                    if (int.TryParse(xmlNode3.Value, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out num2))
                    {
                        return(new ExDateTime(ExTimeZone.TimeZoneFromKind(DateTimeKind.Utc), d + TimeSpan.FromDays((double)num2)));
                    }
                }
                Microsoft.Exchange.Diagnostics.Components.Data.Storage.ExTraceGlobals.RightsManagementTracer.TraceDebug(0L, "Couldn't find the VIEW node - either VIEW rights has no expiry or the value is not parsable");
            }
            return(ExDateTime.MaxValue);
        }
Ejemplo n.º 4
0
        protected void RenderMessageViewItemMetaDataExpandos(TextWriter writer)
        {
            this.InternalRenderItemMetaDataExpandos(writer);
            if (!this.DataSource.GetItemProperty <bool>(MessageItemSchema.IsRead, true))
            {
                writer.Write(" ");
                writer.Write("read");
                writer.Write("=\"0\"");
            }
            bool itemProperty = this.DataSource.GetItemProperty <bool>(MessageItemSchema.IsDraft, false);

            if (itemProperty)
            {
                writer.Write(" ");
                writer.Write("s");
                writer.Write("=\"Draft\"");
            }
            if (this.viewDescriptor.ContainsColumn(ColumnId.FlagDueDate) || this.viewDescriptor.ContainsColumn(ColumnId.ContactFlagDueDate))
            {
                this.RenderFlagState(writer);
            }
            writer.Write(" ");
            writer.Write("fPhsh");
            int  itemProperty2 = this.DataSource.GetItemProperty <int>(ItemSchema.EdgePcl, 1);
            bool itemProperty3 = this.DataSource.GetItemProperty <bool>(ItemSchema.LinkEnabled, false);

            if (JunkEmailUtilities.IsSuspectedPhishingItem(itemProperty2) && !itemProperty3)
            {
                writer.Write("=1");
            }
            else
            {
                writer.Write("=0");
            }
            bool itemProperty4 = this.DataSource.GetItemProperty <bool>(StoreObjectSchema.IsRestricted, false);

            if (itemProperty4 && base.UserContext.IsIrmEnabled)
            {
                ContentRight itemProperty5 = (ContentRight)this.DataSource.GetItemProperty <int>(MessageItemSchema.DRMRights, 0);
                RenderingUtilities.RenderExpando(writer, "fRplR", itemProperty5.IsUsageRightGranted(ContentRight.Reply) ? 0 : 1);
                RenderingUtilities.RenderExpando(writer, "fRAR", itemProperty5.IsUsageRightGranted(ContentRight.ReplyAll) ? 0 : 1);
                RenderingUtilities.RenderExpando(writer, "fFR", itemProperty5.IsUsageRightGranted(ContentRight.Forward) ? 0 : 1);
            }
            if (ConversationUtilities.IsConversationExcludedType(this.DataSource.GetItemClass()))
            {
                RenderingUtilities.RenderExpando(writer, "fExclCnv", 1);
            }
            this.RenderMeetingRequestExpandos(writer);
            if (this.RenderLastModifiedTime)
            {
                this.RenderLastModifiedTimeExpando(writer);
            }
        }
Ejemplo n.º 5
0
        protected override void RenderItemMetaDataExpandos(TextWriter writer)
        {
            base.RenderItemMetaDataExpandos(writer);
            if (this.IsAssignedTask)
            {
                writer.Write(" fAT=1");
            }
            bool itemProperty = this.DataSource.GetItemProperty <bool>(TaskSchema.IsTaskRecurring, false);

            if (itemProperty)
            {
                writer.Write(" fRT=1");
            }
            RecurrenceType itemProperty2 = this.DataSource.GetItemProperty <RecurrenceType>(TaskSchema.RecurrenceType, RecurrenceType.None);

            if (TaskUtilities.IsRegeneratingRecurrenceType(itemProperty2))
            {
                writer.Write(" fRgT=1");
            }
            ExDateTime itemProperty3 = this.DataSource.GetItemProperty <ExDateTime>(TaskSchema.DueDate, ExDateTime.MinValue);
            ExDateTime date          = DateTimeUtilities.GetLocalTime().Date;

            if (itemProperty3 > ExDateTime.MinValue && itemProperty3.Date < date)
            {
                writer.Write(" fOD=1");
            }
            ExDateTime date2 = (itemProperty3 > ExDateTime.MinValue) ? itemProperty3 : date;

            writer.Write(" dtDD=\"");
            writer.Write(DateTimeUtilities.GetJavascriptDate(date2));
            writer.Write("\"");
            Importance itemProperty4 = this.DataSource.GetItemProperty <Importance>(ItemSchema.Importance, Importance.Normal);

            writer.Write(" iI=");
            writer.Write((int)itemProperty4);
            base.RenderFlagState(writer);
            bool itemProperty5 = this.DataSource.GetItemProperty <bool>(StoreObjectSchema.IsRestricted, false);

            if (itemProperty5 && base.UserContext.IsIrmEnabled)
            {
                ContentRight itemProperty6 = (ContentRight)this.DataSource.GetItemProperty <int>(MessageItemSchema.DRMRights, 0);
                RenderingUtilities.RenderExpando(writer, "fRplR", itemProperty6.IsUsageRightGranted(ContentRight.Reply) ? 0 : 1);
                RenderingUtilities.RenderExpando(writer, "fRAR", itemProperty6.IsUsageRightGranted(ContentRight.ReplyAll) ? 0 : 1);
                RenderingUtilities.RenderExpando(writer, "fFR", itemProperty6.IsUsageRightGranted(ContentRight.Forward) ? 0 : 1);
            }
            base.RenderMeetingRequestExpandos(writer);
        }
Ejemplo n.º 6
0
        private bool IsUsageRightRestricted(ContentRight right)
        {
            RightsManagedMessageItem rightsManagedMessageItem = this.message as RightsManagedMessageItem;

            if (rightsManagedMessageItem == null || !rightsManagedMessageItem.IsRestricted)
            {
                return(false);
            }
            if (!base.OwaContext.UserContext.IsIrmEnabled)
            {
                return(false);
            }
            if (this.irmDecryptionStatus.Failed)
            {
                return(!right.IsUsageRightGranted(ContentRight.Extract) && !right.IsUsageRightGranted(ContentRight.Print));
            }
            return(!rightsManagedMessageItem.UsageRights.IsUsageRightGranted(right));
        }