This package may have just saved my life. I've been trying to find a way around Umbraco's *lacking* user permission model for a few months now. I do have some questions though:
1. Is this package compatible with things like : Content pickers, MNTP, DAMP, Ultimate Picker, etc? Basically, does the rest of Umbraco still see it as the default Content tree?
2. Would it be possible to duplicate the same functionality for the media section?
3. Should it still performe well with 100's of editors & 1000's of content nodes?
4. Would you be opposed to sharing the source? I'm very curious how it works.
I'm not surer on 1, it definitley works with the built in content pickers, I haven't tried it with the others though. As long as they being rendered using the standard content picker code though, it should work in theory, as the code for this package just hooks into the standard content tree events.
In theory it should be possible to get this to work with the media section as well, I'll have a look into doing that.
It should work with lots of nodes, as it's basically just the standard content tree with some hooks into the events system. I've had it running on a site with around 5000 nodes wih no problems so far.
I'd be happy to share the source, I need to tidy up the solution a bit, but I'll see if I can get a spare hour or so this week to get it up on Codeplex or something! The code isn't actually all that complex really.
I've been mad busy with work, and haven't had time to sort this out yet, sorry! I'll put the code up on codeplex or bitbucket at lunchtime today for you to grab if you want to have a look at it?
Here we go, it's up on Codeplex as a Git repository: https://customcontenttree.codeplex.com/ if you do make any changes, feel free to submit them as a pull request and I'll update the plugin with them :)
I don't override BaseTree because I think that would require me to swap out the default content tree for my custom one, which causes problems with upgrades, and in previous versions of Umbraco, broke the site page permissions selector in the back office (due to a hard coded reference to the default content tree in the code). It's not actually a full content tree, it's just overriding the rendering of the default tree by hooking into its rendering events. If I was inheriting from any of the Tree stuff, it would be a full replacement content tree.
It inherits from ApplicationBase because at the time it was written, that was how you hooked into Umbraco events at application startup! See here for more info: http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events this has now been superceeded by a newer method in v6 though (although the older method does still work for the moment).
Its effectively hooking into the events of the default content tree, and because some of the methods that you need to call on the tree items in the normal tree aren't public, I had to rip them out and add them to my code.
The code is pretty hacky, and I've never been 100% happy with it. I'm sure there must be a better way of accomplishing this, but all of the other events that I could hook into only give readonly access to the underlying collection that powers the tree, so I couldn't change the tree that way, which would have been neater, and not required all trhe extra code that I had to add. I've been meaning to revisit this and see if there's a better way to do this now that a lot of the core code has been tidyed up a bit, but I just haven't had the time!
If there's anything else you need to know, give me a shout!
Questions & Praise
Hey,
This package may have just saved my life. I've been trying to find a way around Umbraco's *lacking* user permission model for a few months now. I do have some questions though:
1. Is this package compatible with things like : Content pickers, MNTP, DAMP, Ultimate Picker, etc? Basically, does the rest of Umbraco still see it as the default Content tree?
2. Would it be possible to duplicate the same functionality for the media section?
3. Should it still performe well with 100's of editors & 1000's of content nodes?
4. Would you be opposed to sharing the source? I'm very curious how it works.
Thanks!
Dan
Thanks! I'm glad it was helpful :)
I'm not surer on 1, it definitley works with the built in content pickers, I haven't tried it with the others though. As long as they being rendered using the standard content picker code though, it should work in theory, as the code for this package just hooks into the standard content tree events.
In theory it should be possible to get this to work with the media section as well, I'll have a look into doing that.
It should work with lots of nodes, as it's basically just the standard content tree with some hooks into the events system. I've had it running on a site with around 5000 nodes wih no problems so far.
I'd be happy to share the source, I need to tidy up the solution a bit, but I'll see if I can get a spare hour or so this week to get it up on Codeplex or something! The code isn't actually all that complex really.
Tim,
Thanks a lot! I'll let you know if I run across anything with other content pickers.
@Tim
Any luck with adding Media section support?
I wouldn't mind giving it a try with the source and some direction.
We're in need of a solution for this.
Thanks
Dan
Hiya,
I've been mad busy with work, and haven't had time to sort this out yet, sorry! I'll put the code up on codeplex or bitbucket at lunchtime today for you to grab if you want to have a look at it?
Here we go, it's up on Codeplex as a Git repository: https://customcontenttree.codeplex.com/ if you do make any changes, feel free to submit them as a pull request and I'll update the plugin with them :)
Tim,
Thanks a lot. I'm digging through the code now.
I think I have general idea now how you accomplished it and I see that you had to copy out a lot of parts from BaseConentTree.cs
I can't understand why you're inheriting from umbraco.BusinessLogic.ApplicationBase instead of BaseTree or ITree, ITreeService.
If you had to guess, do you think I'd be able to get away with just overriding the Render method in BaseMediaTree.cs? [https://umbraco.codeplex.com/SourceControl/latest#src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseMediaTree.cs]
Thanks again!
Idk what I was thinking : "If you had to guess, do you think I'd be able to get away with just overriding the Render method in BaseMediaTree.cs? "
That wouldn't work, because the default Media tree would still be being used.
Hiya,
I don't override BaseTree because I think that would require me to swap out the default content tree for my custom one, which causes problems with upgrades, and in previous versions of Umbraco, broke the site page permissions selector in the back office (due to a hard coded reference to the default content tree in the code). It's not actually a full content tree, it's just overriding the rendering of the default tree by hooking into its rendering events. If I was inheriting from any of the Tree stuff, it would be a full replacement content tree.
It inherits from ApplicationBase because at the time it was written, that was how you hooked into Umbraco events at application startup! See here for more info: http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events this has now been superceeded by a newer method in v6 though (although the older method does still work for the moment).
Its effectively hooking into the events of the default content tree, and because some of the methods that you need to call on the tree items in the normal tree aren't public, I had to rip them out and add them to my code.
The code is pretty hacky, and I've never been 100% happy with it. I'm sure there must be a better way of accomplishing this, but all of the other events that I could hook into only give readonly access to the underlying collection that powers the tree, so I couldn't change the tree that way, which would have been neater, and not required all trhe extra code that I had to add. I've been meaning to revisit this and see if there's a better way to do this now that a lot of the core code has been tidyed up a bit, but I just haven't had the time!
If there's anything else you need to know, give me a shout!
:)
is working on a reply...