Advertisement

07.13.2008 at 05:36PM PDT, ID: 23561453
[x]
Attachment Details

How to permit logged in users to view certain menu items, or folders, based on an assigned UserRoleID?

Asked by EricBourland in Cold Fusion Markup Language

Tags: ColdFusion 8

ColdFusion 8
MS SQL Server 2005

Hi. I built a login application for a client's web site, guardianhelp.org.

I based the application on code in the Forta / Camden book: ColdFusion 8 Web Application Construction Kit (CF8 WACK).

I have successfully set up basic security using session management. It's working.

But I need help with the next two tasks:

* I want certain menu items to be available, or omitted, depending on the logged-in user's UserRoleID.

For example, I want to allow users with UserRoleID = 1, and no one else, to access the /admin/ folder; and I want users with UserRoleID = 5 OR 1 to be able to access the discussion board; so I set up this code:

      <CFIF IsDefined('request.user.userRoleID') and request.user.UserRoleID LT 6>
    <li><a href="/board/"><span>Discussion Board</span></a></li>
</CFIF>

<CFIF IsDefined('SESSION.auth.userRoleID') and SESSION.auth.UserRoleID IS 1>
    <li><a href="/admin/"><span>Admin</span></a></li>
</CFIF>

But when I log in as user Kathryn, with UserRoleID = 1, the Discussion Board and Admin menu items are NOT visible. They should be visible b/c Kathryn has UserRoleID = 1.

* I also want to secure only certain parts of the web site, starting with /admin/ and /board/. Is there an easy way to do this in my application.cfc? The application.cfc appended below executes for every page request, such that a user must be logged in to view any page. I want to secure only a couple of folders.

Thanks very much for any advice.

EricStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
<!--- 
 Filename: Application.cfc
 Created by: Raymond Camden (ray@camdenfamily.com)
 Please Note Executes for every page request
--->
 
<cfcomponent output="false">
 
  <!--- Name the application. --->
  <cfset this.name="GuardianHelpSite">
  <!--- Turn on session management. --->
  <cfset this.sessionManagement=true>
  
  <cffunction name="onApplicationStart" output="false" returnType="void">
 
    <!--- Any variables set here can be used by all our pages --->
    <cfset APPLICATION.dataSource = "ebwebwork">
    <cfset APPLICATION.companyName = "Guardian Help">
  
  </cffunction>
 
  <cffunction name="onRequestStart" output="false" returnType="void">
  
    <!--- If user isn't logged in, force them to now ---> 
    <cfif not isDefined("SESSION.auth.isLoggedIn")>
      <!--- If the user is now submitting "Login" form, --->
      <!--- Include "Login Check" code to validate user --->
      <cfif isDefined("FORM.UserLogin")> 
        <cfinclude template="LoginCheck.cfm">
      </cfif>
 
      <cfinclude template="LoginForm.cfm">
      <cfabort>
    </cfif> 
 
  </cffunction>
  
</cfcomponent>
 
Loading Advertisement...
 
[+][-]07.14.2008 at 01:50PM PDT, ID: 22001989

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.14.2008 at 02:51PM PDT, ID: 22002450

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.14.2008 at 08:57PM PDT, ID: 22004020

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.15.2008 at 08:43PM PDT, ID: 22013160

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.15.2008 at 08:53PM PDT, ID: 22013184

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.19.2008 at 03:47PM PDT, ID: 22043856

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 09:13PM PDT, ID: 22056409

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 05:35PM PDT, ID: 22075243

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 06:28PM PDT, ID: 22075490

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 07:14PM PDT, ID: 22075642

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 07:23PM PDT, ID: 22075678

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Cold Fusion Markup Language
Tags: ColdFusion 8
Sign Up Now!
Solution Provided By: gdemaria
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.23.2008 at 07:29PM PDT, ID: 22075699

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 07:42PM PDT, ID: 22075737

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 07:47PM PDT, ID: 22075757

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 08:09PM PDT, ID: 22075837

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 08:20PM PDT, ID: 22075873

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 08:25PM PDT, ID: 22075896

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 08:30PM PDT, ID: 22075907

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 08:41PM PDT, ID: 22075958

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628