Topics: Customizing Orchard, Writing modules
Jul 4, 2011 at 2:33 PM
Edited Jul 4, 2011 at 2:33 PM

I don't know if I am doing this correctly, but I have some static forms I want to enable in tenant websites (using the great Multi-Tenant feature). I have many forms I'd like to just put into this one module. I can get them working, except that if I enable them on each of the sub-tenants, then some sub-tenants would technically have access to other tenants forms if the URL is typed in.  For example, if tenant 1 has use of "/Form1" (I'd use a link in tenant 1's site), then tenant 2 (who doesn't need the form), can also type in "/Form1" and have use of the form (without a link). I am trying to avoid creating many modules specific to each tenant.

Would I somehow be able to use Routes.cs to only display "/Form1" for "/Domain1"? 

Jul 4, 2011 at 3:57 PM

I think you should make a feature for Form1, and enable it in one tenant while disabling it in the other.

Jul 4, 2011 at 5:28 PM

Sorry if I misunderstand, but I see "feature" as the module itself. I can disable the module on those sites I don't need it, yes, but my problem is that there are certain things within the module that I do not want certain tenants to use. I am not sure how I can turn off certain aspects of one module for one tenant so that another cannot use it.  I am trying to avoid creating three modules that do the same thing and enabling Module 1 for Tenant 1, Module 2 for Tenant 2, etc.  

Jul 5, 2011 at 9:53 AM

A module can contain multiple features, and declares so in its manifest. The classes providing functionality for a particular feature can be marked with Orchard.Environment.Extensions.OrchardFeatureAttribute to be able to enable and/or disable each feature separately, and you can even declare dependencies between features in the manifest. You can find examples of having multiple features in a module in the Blogs and the Experimental modules. (Start with reading the manifest.)

Jul 5, 2011 at 11:36 AM

I confess to not having seen that as being available.  Thanks for sending me in the right direction, this is going to be very helpful.

Jul 5, 2011 at 11:40 AM

You're welcome. Glad it helped!