Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

DotNetNuke Marketplace
  Ads  
Active Modules -- Active Forums for DotNetNuke
 


  Sponsors  

Meet Our Sponsors

Merak Mail Server
WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
Salaro -- Skins and more
OnyakTech
CrystalTech Web Hosting™
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Configure It! (...  UserControl View Control by Role Permission
Previous Previous
 
Next Next
New Post 9/2/2008 8:54 PM
User is offline Caesar Tan
7 posts
10th Ranked


UserControl View Control by Role Permission 
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 9:51 AM
User is offline Brandon Haynes
705 posts
brandonhaynes.org
7th Ranked


Re: UserControl View Control by Role Permission 

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 3:40 AM
User is offline Caesar Tan
7 posts
10th Ranked


Re: UserControl View Control by Role Permission 

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 Previous
 
Next Next
  Forum  General DotNetN...  Configure It! (...  UserControl View Control by Role Permission
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


EMAS Pro
Strategic Enrollment Management Software for Higher Education Recruitment, Retention and Financial Aid
www.emaspro.com
Subzero Solutions
Dutch / English DotNetNuke consultancy services. Custom module development in any version. Complete application integration. Small business portal hosting. Your ideas our innovation - Your success our motivation. K.v.k Amsterdam: 34236342
www.subzero-solutions.net
Hosting for DotNetNuke
SiteGround.com is the best place to host your DotNetNuke website! Expert DotNetNuke support, reliable servers, low price!
www.SiteGround.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP