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.0GetUserRoles returns partially populated objects?GetUserRoles returns partially populated objects?
Previous
 
Next
New Post
12/7/2006 3:10 AM
 
Hi

I'm pretty new to DNN so this may be the wrong place for this post
and I may be doing things wrong, but...

The GetUserRole method on DotNetNuke.Security.Roles.RoleController
returns a UserRoleInfo which is full populated (Exactly as I would
expect it to look).

However the GetUserRoles returns an array of UserRoleInfo objects
that are partially populated.
Which seems wrong and not what I want,
as I need the information that is missing.

Looking at the 2 code, the calls go through the same mechanisum,
the only real difference being the store procs.

the GetUserRole proc looks like this

SELECT r.*,
ur.UserRoleID,
ur.UserID,
ur.EffectiveDate,
ur.ExpiryDate,
ur.IsTrialUsed
FROM UserRoles ur
INNER JOIN UserPortals up on ur.UserId = up.UserId
INNER JOIN Roles r on r.RoleID = ur.RoleID
....

The GetUserRoles looks like this

SELECT
UR.UserRoleID,
U.UserID,
U.DisplayName,
U.Email,
UR.EffectiveDate,
UR.ExpiryDate,
UR.IsTrialUsed
FROM UserRoles UR
INNER JOIN Users U ON UR.UserID = U.UserID
INNER JOIN Roles R ON UR.RoleID = R.RoleID

IF I change it to this

SELECT
r.*, -- ADDED THIS TO Match GetUserRole
UR.UserRoleID,
U.UserID,
U.DisplayName,
U.Email,
UR.EffectiveDate,
UR.ExpiryDate,
UR.IsTrialUsed
FROM UserRoles UR
INNER JOIN Users U ON UR.UserID = U.UserID
INNER JOIN Roles R ON UR.RoleID = R.RoleID

then everything seems to work fine.


Is this a change I can safley make, and should it
be rolled into the main code base?


Also Why is there no caching on the user roles,
this strikes me as an area the would benefit
significantly from a bit of caching (maybe
im just using the wrong objects?)


For reference.
DotNetNuke.Security.Roles.RoleController ends up calling the
DNNRoleProvider:-


Public Overrides Function GetUserRole(
ByVal portalId As Integer,
ByVal userId As Integer,
ByVal roleId As Integer) As UserRoleInfo

Return CType(CBO.FillObject(
dataProvider.GetUserRole(portalId, userId, roleId),
GetType(UserRoleInfo)), UserRoleInfo)
End Function

Public Overloads Overrides Function GetUserRoles(
ByVal portalId As Integer,
ByVal userId As Integer,
ByVal includePrivate As Boolean) As ArrayList

If includePrivate Then
Return CBO.FillCollection(
dataProvider.GetUserRoles(portalId, userId),
GetType(UserRoleInfo))
Else
Return CBO.FillCollection(
dataProvider.GetServices(portalId, userId),
GetType(UserRoleInfo))
End If
End Function


 
New Post
12/7/2006 8:29 AM
 

Dont take my word for it but I dont think the change you made will break anything - the reason tehy are different I believe is they have different base purposes - not sure I can really say exactly what but one is to get all the information for a user in a certain role and the other is to get all the roles for a certain user (at least I think havent messed with users in awhile but will be in the next few weeks)

I dont know if that answers the question but at least its something


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0GetUserRoles returns partially populated objects?GetUserRoles returns partially populated objects?


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