i've created a simple DNN module using MVC (based on the Christoc.com DNN 8 MVC module template from nuget), with a custom ControlKey. The purpose of this custom ControlKey is to call a specific MVC Action. For this exmaple I'll call this ControlKey "DoIt".
So, I define the ControlKey in the .dnn file:
<moduleControl>
<controlKey>DoIt</controlKey>
<controlSrc>MyApp.Modules.TestModule.Controllers/DoIt/DoIt.mvc</controlSrc>
<supportsPartialRendering>False</supportsPartialRendering>
<controlTitle>DoIt</controlTitle>
<controlType>View</controlType>
<iconFile />
<helpUrl />
<viewOrder>0</viewOrder>
<supportsPopUps>True</supportsPopUps>
</moduleControl>
The View of the module only contains a link to the custom ControlKey, formatted using NavigateURL, like so:
http://dnndev.me/TestPage/tabid/89/ctl/DoIt//mid/450/Default.aspx
When logged in as a SuperUser account, this link works and correctly executes the DoIt action. But, when logged in as a Non-SuperUser account, even as Administrator, I get an Access Denied message.
I've tried to adjust the module and page permissions, (either inherited from the page, or at the module itself), but I can't get it to with with non-SuperUser accounts.
What I am missing? Do I need to set the permissions for this custom ControlKey somewhere? Is there a way to find out what permission is missing?
I am going to assume since your default view works that you have an MVC controller (DnnController) name DoItController with an action method called DoIt() as well as a default view action called Index() (or something similar).
Try using the MVC Url helper to link to your DoIt action from your default view (Index.cshtml).
<a href="@Url.Action("DoIt", "DoIt", new {ctl = "DoIt", itemId = item.ItemId})">Do It!</a>
The Url.Action takes as arguments:
The rendered href looks like this:
http://801.dnndev.me/TestPage/ctl/DoIt/mid/437/controller/DoIt/action/DoIt