Custom Module and Custom Page Security problem

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.
1/18/2010 3:53:50 AM
Gravatar
Total Posts 15
Growing old is inevitable, growing up is optional :)

Custom Module and Custom Page Security problem

Hi,
I'll try to explain my problem :)

I have custom created Module
public partial class Proposals : SiteModuleControl ....

and have edit details page for that module
public partial class ProposalDetail : mojoBasePage ....

from module I call page as:
LinkButton lbtn = (LinkButton)sender;
Response.Redirect("xxxxxxx/ProposalDetail.aspx?mid=" + ModuleId + "&prId=" + lbtn.CommandArgument);

There is member User1 in Role1

if I set Module Security as
Roles that can view this content: All Users
Roles that can edit content: Role1

In ProposalDetail.aspx Page_Load I have
int moduleId = WebUtils.ParseInt32FromQueryString("mid", -1);
if (!UserCanEditModule(moduleId))

........

And there is problem, when it goes into UserCanEditModule in part:
bool moduleFoundOnPage = false;
foreach (Module m in CurrentPage.Modules)
{
if (m.ModuleId == moduleId) moduleFoundOnPage = true;
}

It stays moduleFoundOnPage = false because CurrentPage is as I see from debug Home Page and my custom module is on a page that is not Home :), and I get page with message "Sorry, you are not allowed to view this content. If you have questions about your permissions, please contact a site administrator....."

How can I set CurrentPage? Or how can I check if user can edit content if I am on page called from module (and module is on portal Home/Test page)

What is correct procedure?


Thanx
G.

1/18/2010 4:06:44 AM
Gravatar
Total Posts 15
Growing old is inevitable, growing up is optional :)

Re: Custom Module and Custom Page Security problem

And after I searched forums more thoroughly I have found that I need to pass pageId so I have corrected page call as
Response.Redirect("xxxxxxx/ProposalDetail.aspx?mid=" + ModuleId + "&prId=" + lbtn.CommandArgument + "&pageId=" + currentPage.PageId);

and it works now.

Sorry for new topic. Delete it if you want :)

G.

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