Image only for a group of user

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/13/2009 5:42:13 AM
Gravatar
Total Posts 30

Image only for a group of user

Hallo to everybody,
I added an element in my left column not adding content but direclty in layout.master.
It is an image, I added it after Panel id="divLeft" to seem it like a last element of the menu. But now I want that this image must be shown only for a group of user for exemple Administrators.
How can I do it?

Thanks
 

1/13/2009 7:17:47 AM
Gravatar
Total Posts 18439

Re: Image only for a group of user

You should wrap the logic to show and hide the image in a UserControl, then put the user control in layout.master instead fo directly putting the image.

In the pageload event of usercontrol you can do something like this.Visible = WebUser.IsAdmin;

That will hide the whole user control unless the user is in the Admins role.

Hope it helps,

Joe

1/13/2009 7:37:43 AM
Gravatar
Total Posts 30

Re: Image only for a group of user

And where I find these variables like "IsAdmin"? If I need to apply the restriction to more groups? (I also have new groups created by me)

1/13/2009 7:52:57 AM
Gravatar
Total Posts 18439

Re: Image only for a group of user

In that case you can use WebUser.IsInRoles("Admins;MyCustomRole;MyOtherCustomRole");

It will resolve true if the user is in any of the roles separated by semi colons.

Hope it helps,

Joe

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