• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Name

IsUserInRole

Synopsis

                   IsUserInRole("role")

Returns true if the current authenticated user belongs in the specified role. IsUserInRole( ) is used in conjunction with ColdFusion MX’s built-in security. Example:

<cflogin>
  <cfquery name="AuthenticateUser" datasource="ProgrammingCF">
    SELECT *
    FROM Users
    WHERE Username='pmoney' 
    AND   Password='#Hash("cat")#'
  </cfquery>
   
  <cfloginuser 
    name="pmoney"
    password="#Hash("cat")#"
    roles="editor,user">
</cflogin>
   
<cfoutput>
Is #GetAuthUser( )# an editor? #IsUserInRole("editor")#
</cfoutput>


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint