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  |  

telerik -- supercharge your DNN websites
  Ads  
 


  Sponsors  

Meet Our Sponsors

The Official Microsoft ASP.NET Website
Portal Webhosting - Hosting For Developers
Red-Gate Software
MaximumASP
SourceGear - Tools for Developers
.: CounterSoft :.
 


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
703 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.

 


Multipartner Virtual Data Rooms
The Virtual Data Rooms (VDR) provided by an expert advisor, far from any ordinary software company!, supporting the sellers and their consultants. Multipartner builds and services higly professional Virtual Data Rooms (VDR) specifically tailored to M&A, Real Estate and NPL deals.
www.multipartner.com
DNN SEO
Seablick Consulting specializes in DNN search engine optimization (SEO), DNN consulting, as well as support & training.
seablick.com
Intura Vision / Intura Enterprise
Point-of-Sale and business management applications targeted towards quick service, fast casual and delivery-based restaurant concepts.
www.intura.com

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