private void SetBanner(ClassificationSummary summary, StoreDriverDeliveryEventArgsImpl args)
 {
     if (summary.IsValid)
     {
         if (summary.IsClassified)
         {
             ClassificationApplicationAgent.diag.TraceDebug <string>(0L, "Promote banner for recipient {0}", args.MailRecipient.Email.ToString());
             args.ReplayItem[ItemSchema.IsClassified]              = summary.IsClassified;
             args.ReplayItem[ItemSchema.Classification]            = summary.DisplayName;
             args.ReplayItem[ItemSchema.ClassificationDescription] = summary.RecipientDescription;
             args.ReplayItem[ItemSchema.ClassificationGuid]        = summary.ClassificationID.ToString();
             args.ReplayItem[ItemSchema.ClassificationKeep]        = summary.RetainClassificationEnabled;
             return;
         }
         ClassificationApplicationAgent.diag.TraceDebug <string>(0L, "Clear banner for recipient {0}", args.MailRecipient.Email.ToString());
         args.ReplayItem.DeleteProperties(new PropertyDefinition[]
         {
             ItemSchema.IsClassified,
             ItemSchema.Classification,
             ItemSchema.ClassificationDescription,
             ItemSchema.ClassificationGuid,
             ItemSchema.ClassificationKeep
         });
     }
 }
        private void ProcessClassificationsForJournalReport(StoreDriverDeliveryEventArgsImpl argsImpl)
        {
            ClassificationSummary classificationSummary = this.GetClassificationSummary(argsImpl);

            if (classificationSummary != null && classificationSummary.IsValid && classificationSummary.IsClassified)
            {
                using (ItemAttachment itemAttachment = this.TryOpenFirstAttachment(argsImpl.ReplayItem) as ItemAttachment)
                {
                    if (itemAttachment != null)
                    {
                        using (MessageItem itemAsMessage = itemAttachment.GetItemAsMessage(StoreObjectSchema.ContentConversionProperties))
                        {
                            if (itemAsMessage != null)
                            {
                                ClassificationApplicationAgent.diag.TraceDebug <string>(0L, "Promote banner for recipient {0} on embedded message of journal report", argsImpl.MailRecipient.Email.ToString());
                                itemAsMessage[ItemSchema.IsClassified]              = classificationSummary.IsClassified;
                                itemAsMessage[ItemSchema.Classification]            = classificationSummary.DisplayName;
                                itemAsMessage[ItemSchema.ClassificationDescription] = classificationSummary.RecipientDescription;
                                itemAsMessage[ItemSchema.ClassificationGuid]        = classificationSummary.ClassificationID.ToString();
                                itemAsMessage[ItemSchema.ClassificationKeep]        = classificationSummary.RetainClassificationEnabled;
                                itemAsMessage.Save(SaveMode.NoConflictResolution);
                                itemAttachment.Save();
                            }
                        }
                    }
                }
            }
        }
        private void RenderCompliance(TextWriter output, object compliance)
        {
            string                text                  = string.Empty;
            string                text2                 = string.Empty;
            ComplianceType        complianceType        = ComplianceType.Unknown;
            ClassificationSummary classificationSummary = compliance as ClassificationSummary;

            if (classificationSummary != null)
            {
                text           = classificationSummary.ClassificationID.ToString();
                text2          = classificationSummary.DisplayName;
                complianceType = ComplianceType.MessageClassification;
            }
            RmsTemplate rmsTemplate = compliance as RmsTemplate;

            if (rmsTemplate != null)
            {
                text           = rmsTemplate.Id.ToString();
                text2          = rmsTemplate.GetName(base.UserContext.UserCulture);
                complianceType = ComplianceType.RmsTemplate;
            }
            if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2))
            {
                string additionalAttributes = " iCType=\"" + (uint)complianceType + "\"";
                base.RenderMenuItem(output, text2, ThemeFileId.Clear, "divCPLA" + text, text, false, additionalAttributes, null, null, null, null, false);
            }
        }
        private void ProcessClassifications(StoreDriverDeliveryEventArgsImpl argsImpl)
        {
            ClassificationSummary classificationSummary = this.GetClassificationSummary(argsImpl);

            if (classificationSummary != null)
            {
                this.SetBanner(classificationSummary, argsImpl);
            }
        }
        // Token: 0x06000C42 RID: 3138 RVA: 0x0005484C File Offset: 0x00052A4C
        public string GetDescription(Guid guid, CultureInfo locale, bool checkForPermissionMenuVisible)
        {
            ClassificationSummary classificationSummary = this.LookupMessageClassification(guid, locale);

            if (checkForPermissionMenuVisible && !classificationSummary.PermissionMenuVisible)
            {
                return(string.Empty);
            }
            return(this.GetDescription(classificationSummary));
        }
        public ComplianceType GetComplianceType(Guid guid, CultureInfo locale)
        {
            ClassificationSummary classificationSummary = this.messageClassificationReader.LookupMessageClassification(guid, locale);

            if (classificationSummary != null)
            {
                return(ComplianceType.MessageClassification);
            }
            RmsTemplate rmsTemplate = this.rmsTemplateReader.LookupRmsTemplate(guid);

            if (rmsTemplate != null)
            {
                return(ComplianceType.RmsTemplate);
            }
            return(ComplianceType.Unknown);
        }
        // Token: 0x06000C43 RID: 3139 RVA: 0x0005487C File Offset: 0x00052A7C
        private string GetDescription(ClassificationSummary classification)
        {
            string result = string.Empty;

            if (classification != null)
            {
                if (classification.SenderDescription != null && !string.IsNullOrEmpty(classification.SenderDescription.Trim()))
                {
                    result = (string.IsNullOrEmpty(classification.DisplayName) ? string.Empty : classification.DisplayName) + " - " + classification.SenderDescription;
                }
                else if (classification.DisplayName != null && !string.IsNullOrEmpty(classification.DisplayName.Trim()))
                {
                    result = classification.DisplayName;
                }
            }
            return(result);
        }
Beispiel #8
0
        protected void UpdateComplianceAction(MessageItem message)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }
            object parameter = base.GetParameter("CmpAc");

            if (parameter == null)
            {
                return;
            }
            string text = (string)parameter;

            if (text == "0")
            {
                message[ItemSchema.IsClassified]              = false;
                message[ItemSchema.ClassificationGuid]        = string.Empty;
                message[ItemSchema.ClassificationDescription] = string.Empty;
                message[ItemSchema.Classification]            = string.Empty;
                if (Utilities.IsIrmDecrypted(message))
                {
                    ((RightsManagedMessageItem)message).SetRestriction(null);
                }
                return;
            }
            Guid           empty          = Guid.Empty;
            ComplianceType complianceType = ComplianceType.Unknown;

            if (GuidHelper.TryParseGuid(text, out empty))
            {
                complianceType = OwaContext.Current.UserContext.ComplianceReader.GetComplianceType(empty, base.UserContext.UserCulture);
            }
            switch (complianceType)
            {
            case ComplianceType.MessageClassification:
            {
                ClassificationSummary classificationSummary = base.UserContext.ComplianceReader.MessageClassificationReader.LookupMessageClassification(empty, base.UserContext.UserCulture);
                if (classificationSummary == null)
                {
                    throw new OwaEventHandlerException("Invalid classification being set from client", LocalizedStrings.GetNonEncoded(-1799006479), OwaEventHandlerErrorCode.ComplianceLabelNotFoundError);
                }
                message[ItemSchema.IsClassified]              = true;
                message[ItemSchema.ClassificationGuid]        = classificationSummary.ClassificationID.ToString();
                message[ItemSchema.ClassificationDescription] = classificationSummary.SenderDescription;
                message[ItemSchema.Classification]            = classificationSummary.DisplayName;
                message[ItemSchema.ClassificationKeep]        = classificationSummary.RetainClassificationEnabled;
                if (Utilities.IsIrmDecrypted(message))
                {
                    ((RightsManagedMessageItem)message).SetRestriction(null);
                    return;
                }
                return;
            }

            case ComplianceType.RmsTemplate:
                if (Utilities.IsIrmDecrypted(message))
                {
                    RmsTemplate rmsTemplate = base.UserContext.ComplianceReader.RmsTemplateReader.LookupRmsTemplate(empty);
                    if (rmsTemplate == null)
                    {
                        throw new OwaEventHandlerException("Invalid RMS template was sent from client.", LocalizedStrings.GetNonEncoded(-1799006479), OwaEventHandlerErrorCode.ComplianceLabelNotFoundError);
                    }
                    ((RightsManagedMessageItem)message).SetRestriction(rmsTemplate);
                    if (message.Sender == null)
                    {
                        message.Sender = new Participant(base.UserContext.MailboxSession.MailboxOwner);
                    }
                }
                message[ItemSchema.IsClassified]              = false;
                message[ItemSchema.ClassificationGuid]        = string.Empty;
                message[ItemSchema.ClassificationDescription] = string.Empty;
                message[ItemSchema.Classification]            = string.Empty;
                return;
            }
            if (!OwaContext.Current.UserContext.ComplianceReader.RmsTemplateReader.IsInternalLicensingEnabled)
            {
                throw new OwaEventHandlerException("Unable to determine compliance type because licensing against internal RMS server has been disabled.", LocalizedStrings.GetNonEncoded(-27910813), OwaEventHandlerErrorCode.ComplianceLabelNotFoundError, true);
            }
            if (OwaContext.Current.UserContext.ComplianceReader.RmsTemplateReader.TemplateAcquisitionFailed)
            {
                throw new OwaEventHandlerException("Unable to determine compliance type because there was an error loading templates from the RMS server.", LocalizedStrings.GetNonEncoded(1084956906), OwaEventHandlerErrorCode.ComplianceLabelNotFoundError, true);
            }
            throw new OwaEventHandlerException("Invalid compliance label was sent from client.", LocalizedStrings.GetNonEncoded(-1799006479), OwaEventHandlerErrorCode.ComplianceLabelNotFoundError);
        }