SiteModuleControl function ShouldAllowEdit()

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
12/2/2011 10:27:28 AM
Gravatar
Total Posts 88

SiteModuleControl function ShouldAllowEdit()

hi,

After upgradind mojo for 2.3.7.5 version some modules doesn't work. in debug mode i found this issue on ShouldAllowEdit().

 if (WebUser.IsAdmin)
{
return true;
}
else
{//moduleConfiguration = null and this code will fail.
if (moduleConfiguration.AuthorizedEditRoles == "Admins;") { return false; }
if (currentPage.EditRoles == "Admins;") { return false; }
}...

in last version the firs instruction after check isAdmin the code are:

if (moduleConfiguration != null)

why this change? i need to change something to put my modules working?

 

 

12/2/2011 10:37:32 AM
Gravatar
Total Posts 18439

Re: SiteModuleControl function ShouldAllowEdit()

Hi,

I agree that check should be inside the null check for moduleconfiguration like this, I will change it like this:

private bool ShouldAllowEdit()
{
if (WebUser.IsAdmin)
{
return true;
}

if (moduleConfiguration != null)
{
if (moduleConfiguration.AuthorizedEditRoles == "Admins;") { return false; }
if (currentPage.EditRoles == "Admins;") { return false; }

if (WebUser.IsContentAdmin) { return true; }

if (isSiteEditor) { return true; }

if (WebUser.IsInRoles(moduleConfiguration.AuthorizedEditRoles)) { return true; }

if((!moduleConfiguration.IsGlobal)&&WebUser.IsInRoles(currentPage.EditRoles)) { return true;}

}

return false;
}

However, the question is why is it null in your custom modules and not null in included features?

If it is null it is going to return false in any case, so you should figure out why it is null in your feature and try to make it not be null.

Hope that helps,

Joe

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