Products

Solutions

Resources

Partners

Community

About

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

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsReportsReportsSimple Report?Simple Report?
Previous
 
Next
New Post
8/27/2008 9:58 AM
 

Can someone head me in the right direction to add column(s) in the following report that display the Security Roles for each record?

 

select UserID, DisplayName, Email from dbo.Users order by UserID asc

 
New Post
8/29/2008 6:05 AM
 

This will add a roles column with all roles for each user:

SELECT 
	UserID, 
	DisplayName, 
	Email,
	(
		SELECT 
			RoleName + ', '
		FROM
			{databaseOwner}{objectQualifier}Roles R
			INNER JOIN {databaseOwner}{objectQualifier}UserRoles UR ON (UR.RoleID=R.RoleID AND UR.UserID=U.UserID)
		WHERE 
			(UR.EffectiveDate IS NULL OR UR.EffectiveDate <= getdate()) AND (UR.ExpiryDate IS NULL OR getdate() < UR.ExpiryDate)
		FOR XML PATH('')
	) AS Roles 
FROM {databaseOwner}{objectQualifier}Users U
ORDER BY UserID ASC

 
New Post
8/29/2008 9:56 AM
 

Did I need to wdit something for my specific installation?  I never claimed any expertise!

There was an error executing the data source: There is an error in your SQL at line 13: Line 13: Incorrect syntax near 'XML'.

 
New Post
8/30/2008 5:54 AM
 

All I can say that the query works on my installation. Using DotNetNuke 4.8.4 on SQL Server Express. I can see that the the query sql is not being displayed properly by the forum. Here it is again with another format:

SELECT
    UserID,
    DisplayName,
    Email,
    (
        SELECT
            RoleName + ', '
        FROM
            {databaseOwner}{objectQualifier}Roles R
            INNER JOIN {databaseOwner}{objectQualifier}UserRoles
                UR ON (UR.RoleID=R.RoleID AND UR.UserID=U.UserID)
        WHERE
            (UR.EffectiveDate IS NULL OR UR.EffectiveDate <= getdate())
            AND (UR.ExpiryDate IS NULL OR getdate() < UR.ExpiryDate)
        FOR
            XML PATH('')
    ) AS Roles
FROM
    {databaseOwner}{objectQualifier}Users U
ORDER BY
    UserID ASC

 

 
New Post
8/31/2008 12:19 AM
 

Still failed on my local host (SQL 2005).  It worked perfectly on my live host, so thank you!

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsReportsReportsSimple Report?Simple Report?


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