Example #1
0
 public static RmsTemplate LookupRmsTemplate(OrganizationId organizationId, Guid templateId)
 {
     foreach (RmsTemplate rmsTemplate in RmsTemplateReaderCache.GetRmsTemplates(organizationId))
     {
         if (rmsTemplate.Id == templateId)
         {
             return(rmsTemplate);
         }
     }
     return(null);
 }
Example #2
0
 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.");
     }
 }