// 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);
        }
示例#2
0
 public RestrictionInfo(ContentRight usageRights, ExDateTime expiryTime, string owner)
 {
     EnumValidator.ThrowIfInvalid <ContentRight>(usageRights, "usageRights");
     this.usageRights       = usageRights;
     this.expiryTime        = expiryTime;
     this.conversationOwner = owner;
 }
示例#3
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);
        }
示例#5
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);
            }
        }
示例#6
0
 private ItemPartIrmInfo(bool isRestricted, ContentRight usageRights, string templateName, string templateDescription, string conversationOwner, RightsManagedMessageDecryptionStatus decryptionStatus, ExDateTime userLicenseExpiryTime, bool requiresRepublishingWhenRecipientsChange, bool canRepublish)
 {
     this.isRestricted          = isRestricted;
     this.usageRights           = usageRights;
     this.templateName          = templateName;
     this.templateDescription   = templateDescription;
     this.conversationOwner     = conversationOwner;
     this.decryptionStatus      = decryptionStatus;
     this.userLicenseExpiryTime = userLicenseExpiryTime;
     this.requiresRepublishingWhenRecipientsChange = requiresRepublishingWhenRecipientsChange;
     this.canRepublish = canRepublish;
 }
示例#7
0
 private void CheckPermission(ContentRight perms)
 {
     if ((this.effectiveRights & ContentRight.Owner) == ContentRight.Owner)
     {
         return;
     }
     if ((this.effectiveRights & perms) != perms)
     {
         ExTraceGlobals.RightsManagementTracer.TraceError(0L, "Not enough permissions to perform the requested operation.");
         throw new RightsManagementPermanentException(RightsManagementFailureCode.UserRightNotGranted, ServerStrings.NotEnoughPermissionsToPerformOperation);
     }
 }
示例#8
0
        private void UpdateEffectiveRights()
        {
            ContentRight usageRightsInternal = this.UsageRightsInternal;

            this.effectiveRights = usageRightsInternal;
            foreach (ContentRight[] array2 in RightsManagedMessageItem.impliedRights)
            {
                if ((usageRightsInternal & array2[0]) == array2[0])
                {
                    this.effectiveRights |= array2[1];
                }
            }
        }
示例#9
0
 internal UseLicenseAndUsageRights(string useLicense, ContentRight usageRights, ExDateTime expiryTime, byte[] drmPropsSignature, OrganizationId organizationId, string publishingLicense, Uri licensingUri)
 {
     ArgumentValidator.ThrowIfNullOrEmpty("useLicense", useLicense);
     ArgumentValidator.ThrowIfNull("drmPropsSignature", drmPropsSignature);
     ArgumentValidator.ThrowIfNull("organizationId", organizationId);
     ArgumentValidator.ThrowIfNullOrEmpty("publishingLicense", publishingLicense);
     ArgumentValidator.ThrowIfNull("licensingUri", licensingUri);
     this.UseLicense        = useLicense;
     this.UsageRights       = usageRights;
     this.ExpiryTime        = expiryTime;
     this.DRMPropsSignature = drmPropsSignature;
     this.OrganizationId    = organizationId;
     this.PublishingLicense = publishingLicense;
     this.LicensingUri      = licensingUri;
 }
示例#10
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);
        }
示例#11
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));
        }
示例#12
0
        /// <summary>
        /// Constructor for the read only ContentGrant class. It takes values for
        ///     user, right, validFrom, and validUntil as parameters.
        /// </summary>
        public ContentGrant(ContentUser user, ContentRight right, DateTime validFrom, DateTime validUntil)
        {
            SecurityHelper.DemandRightsManagementPermission();
            // Add validation here

            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            if ((right != ContentRight.View) &&
                (right != ContentRight.Edit) &&
                (right != ContentRight.Print) &&
                (right != ContentRight.Extract) &&
                (right != ContentRight.ObjectModel) &&
                (right != ContentRight.Owner) &&
                (right != ContentRight.ViewRightsData) &&
                (right != ContentRight.Forward) &&
                (right != ContentRight.Reply) &&
                (right != ContentRight.ReplyAll) &&
                (right != ContentRight.Sign) &&
                (right != ContentRight.DocumentEdit) &&
                (right != ContentRight.Export))
            {
                throw new ArgumentOutOfRangeException("right");
            }

            if (validFrom > validUntil)
            {
                throw new ArgumentOutOfRangeException("validFrom");
            }

            _user  = user;
            _right = right;

            _validFrom  = validFrom;
            _validUntil = validUntil;
        }
示例#13
0
文件: Grant.cs 项目: JianwenSun/cc
        /// <summary>
        /// Constructor for the read only ContentGrant class. It takes values for
        ///     user, right, validFrom, and validUntil as parameters. 
        /// </summary>
        public ContentGrant(ContentUser user, ContentRight right, DateTime validFrom, DateTime validUntil)
        {
            SecurityHelper.DemandRightsManagementPermission();
            // Add validation here 

            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            if ((right != ContentRight.View) && 
                (right != ContentRight.Edit) && 
                (right != ContentRight.Print) && 
                (right != ContentRight.Extract) && 
                (right != ContentRight.ObjectModel) && 
                (right != ContentRight.Owner) && 
                (right != ContentRight.ViewRightsData) && 
                (right != ContentRight.Forward) && 
                (right != ContentRight.Reply) &&
                (right != ContentRight.ReplyAll) &&
                (right != ContentRight.Sign) &&
                (right != ContentRight.DocumentEdit)  &&
                (right != ContentRight.Export))
            {
                throw new ArgumentOutOfRangeException("right");                
            }

            if (validFrom > validUntil)
            {
                throw new ArgumentOutOfRangeException("validFrom");                
            }

            _user = user;
            _right = right;

            _validFrom = validFrom;
            _validUntil = validUntil;
        }
示例#14
0
 /// <summary>
 /// Constructor for the read only ContentGrant class. It takes values for user and right as parameters.
 /// </summary>
 public ContentGrant(ContentUser user, ContentRight right)
     : this(user, right, DateTime.MinValue, DateTime.MaxValue)
 {
 }
示例#15
0
 internal static ItemPartIrmInfo Create(ContentRight usageRights, string templateName, string templateDescription, string conversationOwner, ExDateTime userLicenseExpiryTime, bool requiresRepublishingWhenRecipientsChange, bool canRepublish)
 {
     return(new ItemPartIrmInfo(true, usageRights, templateName, templateDescription, conversationOwner, RightsManagedMessageDecryptionStatus.Success, userLicenseExpiryTime, requiresRepublishingWhenRecipientsChange, canRepublish));
 }
示例#16
0
        internal static string GetStringFromRight(ContentRight right)
        {
            for (int i = 0; i < _rightEnums.Length; i++)
            {
                if (_rightEnums[i] == right)
                {
                    return _rightNames[i];
                }
            }

            throw new ArgumentOutOfRangeException("right");
        }
示例#17
0
 public ContentGrant(ContentUser user, ContentRight right, DateTime validFrom, DateTime validUntil)
 {
     throw new NotImplementedException();
 }
示例#18
0
 public ContentGrant(ContentUser user, ContentRight right)
 {
     throw new NotImplementedException();
 }
示例#19
0
 private bool IsUsageRightRestricted(ContentRight right)
 {
     return(this.message != null && base.OwaContext.UserContext.IsIrmEnabled && Utilities.IsIrmRestrictedAndDecrypted(this.message) && !((RightsManagedMessageItem)this.message).UsageRights.IsUsageRightGranted(right));
 }
示例#20
0
		public ContentGrant (ContentUser user, ContentRight right)
		{
			throw new NotImplementedException ();
		}
示例#21
0
文件: Grant.cs 项目: JianwenSun/cc
 /// <summary>
 /// Constructor for the read only ContentGrant class. It takes values for user and right as parameters. 
 /// </summary>
 public ContentGrant(ContentUser user, ContentRight right)
             : this(user, right, DateTime.MinValue, DateTime.MaxValue)
 {
 }
示例#22
0
		public ContentGrant (ContentUser user, ContentRight right, DateTime validFrom, DateTime validUntil)
		{
			throw new NotImplementedException ();
		}