2

I'm trying to build a site using Umbraco 6, for which I need to be able to restrict access to some Media content.

The approach I have come around to ( after a lot of trial and error ) is to create a custom MediaFileSystem replacement in which I will post media content of restricted types to a different, out of context, directory. From there I hope to be able to retrieve them with a permissions checked controller.

If this was a normal MVC site this would be a trivial task ( indeed, I rather suspect that using Umbraco in this case has added days of development time as I try to understand it's complexities and spend hours at a stretch wandering through documentation that is largely out of date ) but I can't for the life of me figure out how I am supposed to read configuration properties from umbracoSettings.config in my own code. The Umbraco.Core.Configuration library includes an UmbracoSettings class to contain the data, but it's internal and I can't find any kind of developer-accessible alternative.

Is there a "correct" way to go through Umbraco and retrieve this data somehow? If not do I need to roll my own configuration reader to pick up any data that I need from these files adapt code from the existing source library regardless of the fact it is apparently deprecated?

glenatron
  • 11,018
  • 13
  • 64
  • 112
  • Maybe check out if the Media Protect package would be a good option for you to use: http://soetemansoftware.nl/media-protect – sebastiaan Dec 15 '13 at 20:31
  • I have seen that, but I'm not certain that it will do what I am looking for. It may be that I have to use it- would certainly be cheaper than figuring out my way through the documentation - but I couldn't see a way to make it fit into the overall framework I have been working with. It may still be easier to rework that framework, however. – glenatron Dec 15 '13 at 21:05
  • 1
    Make sure to shoot Richard an e-mail with your requirements, he'll get back to you quickly and will let you know if it's possible. He's been working on that for years so it should probably save you a lot of time to not duplicate things he's solved already. – sebastiaan Dec 16 '13 at 09:33
  • I don't think this would be a "trivial" task in MVC. And if you have a simple solution, it's easy to port to umbraco. – dampee Feb 02 '14 at 10:52

1 Answers1

1

It's all a little confusing with namespaces in v6 - but if you reference umbraco.dll you can read the settings from the class UmbracoSettings

e.g. umbraco.UmbracoSettings.UmbracoLibraryCacheDuration gives the value stored for UmbracoLibraryCacheDuration in the UmbracoSettings.config file

Carl Sargunar
  • 577
  • 1
  • 5
  • 15
  • V7 makes this easier by including the settings in the proper namespace, but in v6 it's in the old umbraco.UmbracoSettings and not Umbraco.Core namespace. – Carl Sargunar Apr 16 '14 at 10:18