Menu

Action Form Notes

Action Form is a module developed by DNNSharp.com for the DNN Content Management System and Development Platform. The developers at LetItShine.biz have used the Action Form module for countless projects and solutions for a number of years. The following is an modest collection of notes that we have started to record about techniques to take advantage of the strengths of this module. We record this here not to become a secondary help system for Action Form users or DNNSharp. But if you can find something here that helps you, that makes us happy too.

Return to the list

HasRole SP

Mark Buelsing 0 0 Article rating: No rating

This script will return true or false after testing that a userid is in a given role or is superuser

 

   

    DECLARE @CheckUserID int
    DECLARE @HitCount int = 0

    SET @CheckUserID = '[User:UserID]'
    IF @CheckUserID <> 0 
    BEGIN
    --if user is superuser
    SET @HitCount = (SELECT IsSuperUser FROM Users WHERE UserID = @CheckUserID)
     -- if user is administrator
    SET @HitCount = @HitCount + (
    SELECT COUNT(*)
    FROM UserRoles INNER JOIN
    Roles ON UserRoles.RoleID = Roles.RoleID INNER JOIN
    Users ON UserRoles.UserID = Users.UserID
    WHERE Roles.Rolename = 'Administrators' AND Users.UserID = @CheckUserID)

    SELECT CAST(CASE WHEN @HitCount > 0 THEN 'True' ELSE 'False' END AS nvarchar(10)) AS HasRole
END
ELSE
    SELECT 'False' AS HasRole
    

RSS