<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <title>Boardroom Home</title></head><body>Test Page<br><cfset userName = "rhiner"><cfset menuManager = CreateObject("component","components.menus").init("boardroom")> <cfdump var="#menuManager#"><cfset getMenu = menuManager.GetAuthorizedMenuItems(userName)><cfdump var="#menuManager#">Menus: <cfdump var="#this.getMenu#"></body></html><cfcomponent name="menus.cfc" hint="I am the CFC that handles functionality dealing with the menus." output="Yes"><!--- created 10/17/07 rwh ---><cffunction name="Init" hint="Initialize and set datasource" returntype="void"> <cfargument name="datasource" type="string" required="true"> <cfset variables.datasource = arguments.datasource /> <cfreturn this /></cffunction><cffunction name="GetAuthorizedMenuItems" hint="Get authorized menu items for user" access="public" returntype="string" output="Yes"> <cfargument name="UserName" type="string" required="yes"> <cfset var AuthorizedMenu = "" / > GREG<cfabort> <!--- Pass in a user name, and return the menu items that user is authorized to see ---> <cfquery name="AuthorizedMenu" datasource="#variables.datasource#"> SELECT mg.menu_group_id, mg.menu_group_short_desc, mg.menu_group_long_desc, mg.sort_seq as MG_sort_seq, mi.menu_item_id, mi.menu_description, mi.menu_action, mi.sort_seq as mi_sort_seq /* create two independent key joins, then non-equijoin them together */ FROM (brb.menu_items mi KEY JOIN brb.menu_groups mg ) JOIN (brb.users U key join brb.security_levels SL ) on MI.MIN_SECURITY_LEVEL_ID <= U.MAX_SECURITY_LEVEL_ID WHERE user_name = '#ARGUMENTS.USERNAME#' ORDER BY mg_sort_seq, mi_sort_seq, menu_description </cfquery> <!--- <cfdump var="#arguments.username#"><cfabort> ---> <!--- <cfreturn AuthorizedMenu> ---> <cfreturn "DOUG"></cffunction><cffunction name="ValidateMenuItem" hint="checks that a user is authorized to run a particular menu item" access="public" returntype="boolean"> <!--- to block url hacks of menu items. - should be used on all programs to validate that thy are good to go. ---> <cfargument name="UserName" type="string" required="yes"> <cfargument name="MenuAction" type="string" required="yes"> <cfset var qMenuItem = "" / > <cfquery name="qMenuItem" datasource="#variables.datasource#"> SELECT count(*) as valCount /* create two independent key joins, then non-equijoin them together */ FROM (brb.menu_items mi KEY JOIN brb.menu_groups mg ) JOIN (brb.users U key join brb.security_levels SL ) on MI.MIN_SECURITY_LEVEL_ID <= U.MAX_SECURITY_LEVEL_ID WHERE user_name = '#ARGUMENTS.USERNAME#' AND menu_action = '#ARGUMENTS.MenuAction#' </cfquery> <cfreturn qMenuItem.valCount></cffunction><!--- Update menu item ---><!--- Delete menu item ---><!--- need any methods on menu groups? --- not now. ---> </cfcomponent>