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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0UserInfo Roles property and IsInRole methodUserInfo Roles property and IsInRole method
Previous
 
Next
New Post
7/13/2006 9:19 AM
 

A web service used in the FotoVision DNN module needs to authenticate a user of the FotoVision desktop client before allowing photo uploads and as part of the authentication needs to obtain the roles to which the authenticating user belongs.  In DNN version 3.2.x, the non-shared method Microsoft.ScalableHosting.Roles.IsUserInRole was was used.  In DNN version 4.0.x the roles provider was changed to that native in ASPNet 2.0 - so the call was changed to the shared method System.Web.Security.Roles.IsUserInRole. In release candidate 4.3.2, the membership, profile and role providers have again changed (great job BTW!) resulting in a breaking change how we determine if a particular user (not the currently logged in user) is in a particular role or the roles to which a particular user belongs.

It appears that the UserInfo object has been enhanced to include a new Roles property (array of strings) and the new method IsInRole (ByVal rolename As String). However, the Roles array is never populated by the method GetUserByName (even if the IsHydrated parameter is set true) causing the IsInRole to always return false.  Is this by design to save a call to the database, a future capability not yet implemented in this version, or bug?  As a workaround, I can either manually populate the UserInfo object's Roles property (by calling the GetRolesByUser method of an instantiated DotNetNuke.Security.Roles object) and then successfully call the UserInfo object's IsInRole method or write my own code which does not make use of the Roles property or the IsInRole method.  Can anyone on the core team advise the intent of the new Roles property of the UserInfo object?

In a related question - what are the best practices in module development when it comes to deprecated methods?  For example, the GetUserByUsername method of the user conroller has been deprecated and replaced by the GetUserByName method?  If I use the new method, the module will no longer be compatible with version 4.0.2.  If I use the deprecated method, I run the risk of the deprecated method being dropped completely in later releases.


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0UserInfo Roles property and IsInRole methodUserInfo Roles property and IsInRole method


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