private string GetDescription(RmsTemplate template, CultureInfo locale) { ComplianceReader.ThrowOnNullArgument(locale, "locale"); string result = string.Empty; if (template != null) { string name = template.GetName(locale); string description = template.GetDescription(locale); if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(description)) { if (!string.IsNullOrEmpty(name)) { result = name; } else if (!string.IsNullOrEmpty(description)) { result = description; } } else { result = name + " - " + description; } } return(result); }
internal RmsTemplatePresentation(RmsTemplate template) : base(new SimpleProviderPropertyBag()) { if (template == null) { throw new ArgumentNullException("template"); } this.propertyBag.SetField(RmsTemplatePresentationSchema.Name, template.GetName(CultureInfo.CurrentUICulture)); this.propertyBag.SetField(RmsTemplatePresentationSchema.Description, template.GetDescription(CultureInfo.CurrentUICulture)); this.propertyBag.SetField(RmsTemplatePresentationSchema.Type, template.Type); this.propertyBag.SetField(RmsTemplatePresentationSchema.TemplateGuid, template.Id); this.propertyBag.SetField(SimpleProviderObjectSchema.Identity, new RmsTemplateIdentity(template.Id, template.Name, template.Type)); }
private bool LoadRightsManagementLicenseData(Item mailboxItem, RightsManagementLicenseData rightsManagementLicenseData) { if (!BodyConversionUtilities.IsMessageRestrictedAndDecoded(mailboxItem) && !BodyConversionUtilities.IsIRMFailedToDecode(mailboxItem)) { return(false); } if (BodyConversionUtilities.IsIRMFailedToDecode(mailboxItem)) { rightsManagementLicenseData.InitNoRightsTemplate(); return(true); } RightsManagedMessageItem rightsManagedMessageItem = mailboxItem as RightsManagedMessageItem; rightsManagementLicenseData.EditAllowed = new bool?(rightsManagedMessageItem.UsageRights.IsUsageRightGranted(ContentRight.Edit)); rightsManagementLicenseData.ReplyAllowed = new bool?(rightsManagedMessageItem.UsageRights.IsUsageRightGranted(ContentRight.Reply)); rightsManagementLicenseData.ReplyAllAllowed = new bool?(rightsManagedMessageItem.UsageRights.IsUsageRightGranted(ContentRight.ReplyAll)); rightsManagementLicenseData.ForwardAllowed = new bool?(rightsManagedMessageItem.UsageRights.IsUsageRightGranted(ContentRight.Forward)); rightsManagementLicenseData.PrintAllowed = new bool?(rightsManagedMessageItem.UsageRights.IsUsageRightGranted(ContentRight.Print)); rightsManagementLicenseData.ExtractAllowed = new bool?(rightsManagedMessageItem.UsageRights.IsUsageRightGranted(ContentRight.Extract)); rightsManagementLicenseData.ProgrammaticAccessAllowed = new bool?(rightsManagedMessageItem.UsageRights.IsUsageRightGranted(ContentRight.ObjectModel)); rightsManagementLicenseData.Owner = new bool?(rightsManagedMessageItem.UsageRights.IsUsageRightGranted(ContentRight.Owner)); if (!AirSyncUtility.IsProtectedVoicemailItem(mailboxItem)) { rightsManagementLicenseData.ExportAllowed = new bool?(rightsManagedMessageItem.UsageRights.IsUsageRightGranted(ContentRight.Export)); } else { rightsManagementLicenseData.ExportAllowed = new bool?(false); } if (rightsManagedMessageItem.UsageRights.IsUsageRightGranted(ContentRight.Forward) && (!rightsManagedMessageItem.Restriction.RequiresRepublishingWhenRecipientsChange || rightsManagedMessageItem.CanRepublish)) { rightsManagementLicenseData.ModifyRecipientsAllowed = new bool?(true); } else { rightsManagementLicenseData.ModifyRecipientsAllowed = new bool?(false); } rightsManagementLicenseData.ContentExpiryDate = new ExDateTime?(rightsManagedMessageItem.UserLicenseExpiryTime); rightsManagementLicenseData.ContentOwner = rightsManagedMessageItem.ConversationOwner.EmailAddress; RmsTemplate restriction = rightsManagedMessageItem.Restriction; if (restriction != null) { Guid id = restriction.Id; rightsManagementLicenseData.TemplateID = restriction.Id.ToString(); rightsManagementLicenseData.TemplateName = restriction.GetName(Command.CurrentCommand.MailboxSession.PreferedCulture); rightsManagementLicenseData.TemplateDescription = restriction.GetDescription(Command.CurrentCommand.MailboxSession.PreferedCulture); } return(true); }
private void ProcessGet() { using (this.user.Context.Tracker.Start(TimeId.RMSProcessGet)) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Processing RightsManagementInformationSetting - Get"); XmlNode xmlNode = base.Response.OwnerDocument.CreateElement("Get", "Settings:"); XmlNode xmlNode2 = base.Response.OwnerDocument.CreateElement("RightsManagementTemplates", "RightsManagement:"); try { if (this.user.IrmEnabled) { List <RmsTemplate> list = new List <RmsTemplate>(RmsTemplateReaderCache.GetRmsTemplates(this.user.OrganizationId)); IComparer <RmsTemplate> comparer = new RightsManagementInformationSetting.RmsTemplateNameComparer(this.cultureInfo); list.Sort(comparer); int count = list.Count; int maxRmsTemplates = GlobalSettings.MaxRmsTemplates; if (count > maxRmsTemplates) { list.RemoveRange(maxRmsTemplates, count - maxRmsTemplates); } using (List <RmsTemplate> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { RmsTemplate rmsTemplate = enumerator.Current; AirSyncDiagnostics.TraceInfo <Guid>(ExTraceGlobals.RequestsTracer, this, "Found RMS template {0}", rmsTemplate.Id); XmlNode xmlNode3 = base.Response.OwnerDocument.CreateElement("RightsManagementTemplate", "RightsManagement:"); XmlNode xmlNode4 = base.Response.OwnerDocument.CreateElement("TemplateID", "RightsManagement:"); xmlNode4.InnerText = rmsTemplate.Id.ToString(); xmlNode3.AppendChild(xmlNode4); XmlNode xmlNode5 = base.Response.OwnerDocument.CreateElement("TemplateName", "RightsManagement:"); xmlNode5.InnerText = rmsTemplate.GetName(this.cultureInfo); xmlNode3.AppendChild(xmlNode5); XmlNode xmlNode6 = base.Response.OwnerDocument.CreateElement("TemplateDescription", "RightsManagement:"); xmlNode6.InnerText = rmsTemplate.GetDescription(this.cultureInfo); xmlNode3.AppendChild(xmlNode6); xmlNode2.AppendChild(xmlNode3); } goto IL_205; } } AirSyncDiagnostics.TraceError <string>(ExTraceGlobals.RequestsTracer, this, "IRM feature disabled for user {0}", this.user.DisplayName); this.status = StatusCode.IRM_FeatureDisabled; IL_205 :; } catch (AirSyncPermanentException ex) { AirSyncDiagnostics.TraceError <AirSyncPermanentException>(ExTraceGlobals.RequestsTracer, this, "AirSyncPermanentException encountered while processing RightsManagementInformationSetting->Get {0}", ex); if (base.ProtocolLogger != null && !string.IsNullOrEmpty(ex.ErrorStringForProtocolLogger)) { base.ProtocolLogger.SetValueIfNotSet(ProtocolLoggerData.Error, ex.ErrorStringForProtocolLogger); } this.ProcessException(ex); this.status = ex.AirSyncStatusCode; } XmlNode xmlNode7 = base.Response.OwnerDocument.CreateElement("Status", "Settings:"); XmlNode xmlNode8 = xmlNode7; int num = (int)this.status; xmlNode8.InnerText = num.ToString(CultureInfo.InvariantCulture); base.Response.AppendChild(xmlNode7); xmlNode.AppendChild(xmlNode2); base.Response.AppendChild(xmlNode); AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Done processing RightsManagementInformationSetting - Get."); } }