Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...UserControl View Control by Role PermissionUserControl View Control by Role Permission
Previous
 
Next
New Post
9/2/2008 10:54 PM
 
Hi, I understand that in each module we can use role permission to restrict module view. Is it possible that by using role permission setting to restrict several UserCntrol in one module? What I mean is in one module maybe have several usercontrol. For certain usercontrol i created, only certain of role permission can view this usercontrol and other role cannot and this applies to other usercontrol as well. Is this all can be done by setting in Module and not coding behind? Thanks and have a nice day Regards Caesar
 
New Post
9/3/2008 11:51 AM
 

Hi Caesar,

I'm not exactly sure which question you're asking, but here are responses to the two possibilities:

1) If you have a constant, fixed set of roles with which you wish to restrict usercontrol visibility (e.g.; registered users only), you may do so in the Page_Load event of the usercontrol as follows:

this.Visible = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().IsInRole("Registered Users")

2) If you are looking to allow administrators to specify usercontrol visibility as part of the module settings page, you will need to add custom permission functionality to the module definition.  Fortunately, DNN has a very simple mechanism for allowing this.  Read the blog entry here for more details.

Hope this helps!

Brandon


Brandon Haynes
BrandonHaynes.org
 
New Post
9/5/2008 5:40 AM
 

Thanks Brandon for your reply. 2) is my solution.

However i face some problem when implement it. I already package it out the module i do custom module permission. However when i try to install the package it shows me his code return Null value

modDef.GetModuleDefinitionByName(desktopInfo.DesktopModuleID, Definition.ModuleFriendlyName)

Part of the code as Below:

Dim desktopInfo As DesktopModuleInfo = desktopMod.GetDesktopModuleByModuleName(Definition.ModuleFriendlyName) Dim modDef As New ModuleDefinitionController() Dim modDefInfo As ModuleDefinitionInfo modDefInfo = modDef.GetModuleDefinitionByName(desktopInfo.DesktopModuleID, Definition.ModuleFriendlyName)

How come the dektopInfo.DesktopModuleID have Null value? I thought when install it should already register the moduleID before upgrade.

Anyone face this error before?

Thanks and have a nice day.

Regards Caesar

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...UserControl View Control by Role PermissionUserControl View Control by Role Permission


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out