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.
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.
Hi
How do I ask for the Role of the User in MojoPortal?
I have a custom page with two controls on, A and B. What if I would like the page with control A to be visible to everyone, but only control B to be visible to adminstrators? How do I manage that with MojoPortals role based security system?
Example mentioned:
Script:
protected void Page_Load(object sender, EventArgs e) { ControlB.Visible = false; if (Roles.IsUserInRole("Administrators")) ControlB.Visible = true;
}
...
Pages and Controls:
Home
--Contact Us
--Custom page (=aspx)
<asp:Listview ID="ControlA" ....
<asp:FormView ID="ControlB" visibility="false" .....
Best regards
Lars
You need
using mojoPortal.Business.WebHelpers;
and this line should be changed as follows
if (WebUser.IsInRoles("Admins;")) ControlB.Visible = true;
or
if(WebUser.IsAdmin) ControlB.Visible = true;
Hope it helps,
Joe
Excellent that worked!!
Thanks for rocket fast answer