public void LoadFrom(Uri manifestLocation)
        {
            ArgumentUtility.CheckNotNull ("manifestLocation", manifestLocation);

              var configuration = DesktopGapConfigurationProvider.Create (String.Empty, manifestLocation.ToString()).GetConfiguration();

              Application = new ApplicationInfo
                    {
                        Name = configuration.Application.Name,
                        BaseUri = configuration.Application.GetBaseUri(),
                        IconUri = configuration.Application.GetIconUri(),
                        ManifestUri = manifestLocation,
                        AllowCloseHomeTab = configuration.Application.AllowCloseHomeTab,
                        AlwaysShowUrl = configuration.Application.AlwaysShowUrl,
                        AlwaysOpenHomeUrl = configuration.Application.AlwaysOpenHomeUrl,
                        HomeUri = configuration.Application.GetHomeUri()
                    };

              var thirdPartyUrlRules = configuration.Security.NonApplicationUrlRules;
              var applicationUrlRules = configuration.Security.ApplicationUrlRules;
              var startUpUrlRules = configuration.Security.StartupUrlRules;

              var resourceUrls = thirdPartyUrlRules.Union (applicationUrlRules);

              var addInRules = configuration.Security.AddInRules;

              ResourceFilter = new UrlFilter (resourceUrls);
              NonApplicationUrlFilter = new UrlFilter (thirdPartyUrlRules);
              AddInAllowedFilter = new UrlFilter (applicationUrlRules);
              StartUpFilter = new UrlFilter (startUpUrlRules);
              AddInFilter = new AddInFilter (addInRules);

              HomeTabColorCode = configuration.Application.TabColors.Home;
              NonApplicationTabColorCode = configuration.Application.TabColors.NonApplication;
              ApplicationTabColorCode = configuration.Application.TabColors.Application;

              EnableResourceFilter = configuration.Security.EnableResourceFilter;
        }
Пример #2
0
 public void IsAllowed_AskForPermittedAddIn_ShouldReturnTrue()
 {
     var addInGuard = new AddInFilter (_addInRules);
       Assert.That (addInGuard.IsAllowed ("Test.AddIn.Allowed"), Is.True);
 }
Пример #3
0
 public void IsAllowed_AskForProhibitedAddIn_ShouldReturnFalse()
 {
     var addInGuard = new AddInFilter (_addInRules);
       Assert.That (addInGuard.IsAllowed ("Test.AddIn.Denied"), Is.False);
 }
Пример #4
0
 public void IsAllowed_AskForInexistentAddIn_ShouldReturnFalse()
 {
     var addInGuard = new AddInFilter (_addInRules);
       Assert.That (addInGuard.IsAllowed ("this/is/not/allowed.html"), Is.False);
 }