Пример #1
0
        public void SetUp()
        {
            /* Set up a mock configuration with the following permissions: 
             * 
             * Wiki-wide: 
             * Alice: read, write, administer
             * Bob: read
             * 
             * NamespaceOne: 
             * Alice: read
             * 
             * NamespaceTwo
             * Bob: read, write, administer
             */
            MockWikiApplication application = new MockWikiApplication(
                null,
                null,
                OutputFormat.HTML,
                new MockTimeProvider(TimeSpan.FromSeconds(1))); 

            _federation = new Federation(application);

            MockAuthorizationConfigurationProvider configProvider = new MockAuthorizationConfigurationProvider();
            configProvider.AddWikiPermission("Alice", Permission.Read);
            configProvider.AddWikiPermission("Alice", Permission.Edit);
            configProvider.AddWikiPermission("Alice", Permission.Administer);
            configProvider.AddWikiPermission("Bob", Permission.Read);
            configProvider.AddWikiPermission("WikiReaders", Permission.Read);
            configProvider.AddWikiPermission("WikiEditors", Permission.Edit);
            configProvider.AddWikiPermission("WikiAdmins", Permission.Administer);

            configProvider.AddNamespacePermission("Alice", "NamespaceOne", Permission.Read);

            configProvider.AddNamespacePermission("Bob", "NamespaceTwo", Permission.Read);
            configProvider.AddNamespacePermission("Bob", "NamespaceTwo", Permission.Edit);
            configProvider.AddNamespacePermission("Bob", "NamespaceTwo", Permission.Administer);

            configProvider.AddNamespacePermission("NS4Readers", "NamespaceFour", Permission.Read);
            configProvider.AddNamespacePermission("NS4Editors", "NamespaceFour", Permission.Edit);
            configProvider.AddNamespacePermission("NS4Admins", "NamespaceFour", Permission.Administer);

            configProvider.AddNamespacePermission("*", "NamespaceFive", Permission.Read);
            configProvider.AddNamespacePermission("?", "NamespaceFive", Permission.Edit);

            _federation.AuthorizationConfigurationProvider = configProvider;
        }
Пример #2
0
    public void SetUp()
    {
      /* Set up a mock configuration with the following permissions: 
       * 
       * Wiki-wide: 
       * Alice: read, write, administer
       * Bob: read
       * 
       * NamespaceOne: 
       * Alice: read
       * 
       * NamespaceTwo
       * Bob: read, write, administer
       */

      MockAuthorizationConfigurationProvider configProvider = new MockAuthorizationConfigurationProvider(); 
      configProvider.AddWikiPermission("Alice", Permission.Read);
      configProvider.AddWikiPermission("Alice", Permission.Edit);
      configProvider.AddWikiPermission("Alice", Permission.Administer); 
      configProvider.AddWikiPermission("Bob"  , Permission.Read); 
      configProvider.AddWikiPermission("WikiReaders", Permission.Read); 
      configProvider.AddWikiPermission("WikiEditors", Permission.Edit); 
      configProvider.AddWikiPermission("WikiAdmins", Permission.Administer); 

      configProvider.AddNamespacePermission("Alice", "NamespaceOne", Permission.Read); 

      configProvider.AddNamespacePermission("Bob"  , "NamespaceTwo", Permission.Read);
      configProvider.AddNamespacePermission("Bob"  , "NamespaceTwo", Permission.Edit);
      configProvider.AddNamespacePermission("Bob"  , "NamespaceTwo", Permission.Administer);
      
      configProvider.AddNamespacePermission("NS4Readers", "NamespaceFour", Permission.Read);
      configProvider.AddNamespacePermission("NS4Editors", "NamespaceFour", Permission.Edit); 
      configProvider.AddNamespacePermission("NS4Admins",  "NamespaceFour", Permission.Administer); 
      
      configProvider.AddNamespacePermission("*", "NamespaceFive", Permission.Read); 
      configProvider.AddNamespacePermission("?", "NamespaceFive", Permission.Edit); 
      
      _helper.ConfigurationProvider = configProvider; 
    }