Access Denied to Edit Page of custom module

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
3/30/2012 4:18:42 AM
Gravatar
Total Posts 8

Access Denied to Edit Page of custom module

Hi, Joe.

Now I'm creating my custom module as it is shown in the training video "Building a Guestbook". I created the edit page for my custom module with buttons "Save" and "Delete". After entering the code

LoadParams();

if (!UserCanEditModule(moduleId, ItemGuid))
{
SiteUtils.RedirectToAccessDeniedPage(this);
return;
}

LoadSettings();

if (article == null)
{
SiteUtils.RedirectToAccessDeniedPage(this);
return;
}

to the Edit.aspx.cs  I have no access to the Edit Page despite my administrator role.

What can be the cause?

3/30/2012 7:39:25 AM
Gravatar
Total Posts 18439

Re: Access Denied to Edit Page of custom module

Hi Vlad,

This part is not correct:

if (!UserCanEditModule(moduleId, ItemGuid))

You should be passing in FeatureGuid of the feature not an ItemGuid. This check is to make sure the module exists on the page corresponding to pageid param and the feature guid is needed to make sure the module is an instance of your feature and not some other module that the user may have permission on. 

FeatureGuid represents the feature, ModuleId/ModuleGuid represents the instance of the feature, ItemGuid is some item contained within the instance.

Hope that helps,

Joe

3/30/2012 12:43:41 PM
Gravatar
Total Posts 8

Re: Access Denied to Edit Page of custom module

Joe, on your training video "Building GuestBook" this part is:

if (!UserCanEditModule(moduleId))

and the Edit page works.

But in the Edit.aspx.cs from GuestBookTutorialFiles  this part is:

if (!UserCanEditModule(moduleId, GuestBook.FeatureGuid))

I have done like that:

if (!UserCanEditModule(moduleId, [MyFeature].FeatureGuid))

but it doesn't help.

3/30/2012 12:47:04 PM
Gravatar
Total Posts 18439

Re: Access Denied to Edit Page of custom module

You should step into that method using the VS debugger. I think your feature intsance does not have the featureguid you are passing in.

Hope that helps,

Joe

3/31/2012 2:55:42 PM
Gravatar
Total Posts 8

Re: Access Denied to Edit Page of custom module

Joe, I've found the cause. It happened because of my inattention. When creating a table for my custom feature I named one of columns as Module ID instead of Modile Id.

After correcting all mistakes the problem was solved.

Thank you for your help

You must sign in to post in the forums. This thread is closed to new posts.