Browse files

Merge branch 'master' of https://github.com/n2cms/n2cms into Local_2.3

  • Loading branch information...
2 parents 97f3fe9 + d83da9d commit 5a6de2cea716b4ac67493f21c703b2ea43f12ae5 @GrimaceOfDespair GrimaceOfDespair committed May 4, 2012
View
7 src/Framework/Management.Tests/FileSystem/VirtualFolderInitializerTests.cs
@@ -30,6 +30,7 @@ public class VirtualFolderInitializerTests : ItemPersistenceMockingBase
ContentItem root;
ContentItem start;
FolderNodeProvider nodeProvider;
+ private Plugin.ConnectionMonitor monitor;
[SetUp]
public override void SetUp()
@@ -52,7 +53,7 @@ public override void SetUp()
var sizeCache = new ImageSizeCache(new ConfigurationManagerWrapper { Sections = new ConfigurationManagerWrapper.ContentSectionTable(null, null, null, config) });
injector.injectors.Add(new EntityDependencySetter<ImageSizeCache>(sizeCache));
nodeProvider = new FolderNodeProvider(fs, persister, injector);
- initializer = new VirtualFolderInitializer(host, persister, fs, vnf, new Plugin.ConnectionMonitor().SetConnected(SystemStatusLevel.UpAndRunning), new UploadFolderSource(host, config), nodeProvider);
+ initializer = new VirtualFolderInitializer(host, persister, fs, vnf, monitor = new Plugin.ConnectionMonitor().SetConnected(SystemStatusLevel.UpAndRunning), new UploadFolderSource(host, config), nodeProvider);
}
class FakeStatus : DatabaseStatusCache
@@ -159,6 +160,8 @@ public void Get_UploadFolder2()
{
fs.CreateDirectory("/upload2/");
config.UploadFolders.Add("/upload2/");
+ initializer = new VirtualFolderInitializer(host, persister, fs, vnf, monitor, new UploadFolderSource(host, config), nodeProvider);
+
initializer.Start();
vnf.Register(nodeProvider);
@@ -173,6 +176,8 @@ public void GetChildren_Includes_UploadFolder2()
{
fs.CreateDirectory("/upload2/");
config.UploadFolders.Add("/upload2/");
+ initializer = new VirtualFolderInitializer(host, persister, fs, vnf, monitor, new UploadFolderSource(host, config), nodeProvider);
+
initializer.Start();
vnf.Register(nodeProvider);
View
13 src/Framework/N2/Edit/UploadFolderSource.cs
@@ -50,7 +50,7 @@ private static string FixPath(string path)
public static implicit operator FileSystemRoot(string path)
{
- return new FileSystemRoot(path, new Site(0));
+ return new FileSystemRoot(path, null);
}
public int GetParentID()
@@ -90,9 +90,14 @@ public IEnumerable<FileSystemRoot> GetUploadFoldersForAllSites()
foreach (var folder in globalFolders)
yield return folder;
foreach (var folder in host.DefaultSite.UploadFolders)
- yield return folder;
- foreach (var folder in host.Sites.SelectMany(s => s.UploadFolders))
- yield return folder;
+ yield return folder;
+ foreach (var folder in host.Sites.SelectMany(s => s.UploadFolders.Select(f =>
+ {
+ if (f.Site == null)
+ f.Site = s;
+ return f;
+ })))
+ yield return folder;
}
public virtual IEnumerable<FileSystemRoot> GetUploadFolders(Site site)
View
4 src/Framework/N2/Security/PermissionMap.cs
@@ -43,9 +43,7 @@ public virtual bool MapsTo(Permission permission)
public virtual bool Authorizes(IPrincipal user, ContentItem item, Permission permission)
{
- if (item == null) throw new ArgumentNullException("item");
-
- if(permission == Permission.Read && !item.IsAuthorized(user))
+ if(item != null && permission == Permission.Read && !item.IsAuthorized(user))
return false;
return MapsTo(permission) && Contains(user);
View
4 src/Mvc/MvcTemplates/Areas/Tests/Controllers/TestContentController.cs
@@ -96,6 +96,9 @@ private void CreateChildren(ContentItem parent, Type type, string name, int widt
Engine.Persister.Repository.SaveOrUpdate(item);
CreateChildren(item, type, name, width, depth - 1);
}
+ parent.ChildState |= Collections.CollectionState.ContainsVisiblePublicPages;
+ Engine.Persister.Repository.SaveOrUpdate(parent);
+
HttpContext.Response.Write(name + " 0-" + width + " (" + depth + ")" + "<br/>");
HttpContext.Response.Flush();
}
@@ -105,6 +108,7 @@ private ContentItem Create(ContentItem parent, Type type, string name, int depth
ContentItem item = activator.CreateInstance(type, parent);
item.Name = name + i;
item.Title = name + " " + i + " (" + depth + ")";
+ item.ChildState = Collections.CollectionState.IsEmpty;
if (item is PageBase)
(item as ContentPageBase).Text = @"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec sagittis mi. Donec pharetra vestibulum facilisis. Sed sodales risus vel nulla vulputate volutpat. Mauris vel arcu in purus porta dapibus. Aliquam erat volutpat. Maecenas suscipit tincidunt purus porttitor auctor. Quisque eget elit at justo facilisis malesuada sit amet sit amet eros. Duis convallis porta congue. Nulla commodo faucibus diam in mollis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec ut nibh eu sapien ornare consectetur.</p>
<p>Aliquam id massa nec mi pellentesque rhoncus id vel neque. Pellentesque malesuada venenatis sollicitudin. Maecenas at nisl urna, vel feugiat ipsum. Integer imperdiet rhoncus libero sit amet ullamcorper. Vestibulum et purus et ipsum dignissim molestie id sed urna. Nulla vitae neque neque, tempor fermentum lectus. Proin pellentesque blandit diam, in vehicula ipsum suscipit vel. Pellentesque elementum feugiat egestas. Duis scelerisque metus suscipit massa mattis tempor. Vestibulum sed dolor sed felis pharetra semper eu sed quam. Nam vitae lectus nunc, in placerat dui. Vivamus massa lorem, faucibus in semper ac, tincidunt non massa.</p>";

0 comments on commit 5a6de2c

Please sign in to comment.