House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Cfswitch question

  << Previous Post |  RSS |  Tree View |  Sort Oldest First |  Subscribe to this Group Next >> 

Cfswitch question

Gotcha... Candace Cottrell 06/30/2003 11:27 AM
> Thanks Jim... Jim Davis 06/30/2003 11:24 AM
Well you could use the pre-cfswitch option... Ian Skinner 06/30/2003 11:20 AM
Thanks Jim... Candace Cottrell 06/30/2003 11:12 AM
It's not illegal, but it won't work. Jim Davis 06/30/2003 11:06 AM
Don't know, but if so you will need pounds in the expression.  I Ian Skinner 06/30/2003 11:03 AM
yeah, so that it will actually parse the value of isUserInRole() rather Tony Weeg 06/30/2003 11:03 AM
IsUserInRole() needs to be in pounds Michael Dinowitz 06/30/2003 11:01 AM
I think it should be <Cfswitch expression="#IsUserInRole()#"> Neculai Macarie 06/30/2003 11:00 AM
Is this illegal? Candace Cottrell 06/30/2003 10:57 AM

06/30/2003 11:27 AM
Author: Candace Cottrell Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:25165#126585 Gotcha... Thx Candace K. Cottrell, Web Developer The Children's Medical Center One Children's Plaza Dayton, OH 45404 937-641-4293 http://www.childrensdayton.org cottrellc@childrensdayton.org >>> ian.skinner@bloodsource.org 6/30/2003 11:17:48 AM >>> Well you could use the pre-cfswitch option... <cfif IsUserInRole.... <cfelseif IsUserInRole... <cfelseif IsUserInRole.... <cfelse>     No mathing roles found. </cfif> Not quite as clean as a cfswitch...but some of the benifits and should be a bit faster then a bunch of complete <cfif></cfif> blocks.  This code block will stop testing conditions once a match is found.  To optimize it, put your conditions in order of most likely to least likely. -------------- Ian Skinner Web Programmer BloodSource Sacramento, CA Thanks Jim... Sooo, I guess I have to do this by going through each of my roles and doing cfifs? Seems like I am "hardcoding" almost. Candace K. Cottrell, Web Developer The Children's Medical Center One Children's Plaza Dayton, OH 45404 937-641-4293 http://www.childrensdayton.org cottrellc@childrensdayton.org >>> hoflists@depressedpress.com 6/30/2003 11:01:08 AM >>> It's not illegal, but it won't work. IsUserInRole() takes a role and returns a Boolean (true/false) - it really can't be used in a switch like that.  (The "value" attribute looks at the RETURN of "expression" - it doesn't act as input to it.) Jim Davis ----- Excess quoted text cut - see Original Post for more -----
06/30/2003 11:24 AM
Author: Jim Davis Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:25165#126582 > Thanks Jim... > > Sooo, I guess I have to do this by going through each of my roles and > doing cfifs? Pretty much. I've personally never used CFLOGIN, but my own security system is similar. I create a list of approved roles in each user's session scope and use UDFs to deal with it.  You can do the same thing with "IsUserInRole()" So instead of really clunky CFIFs you end up with a little more streamlined CFIFs: <cfif IsUSerInRole("Admin")>   <h2>Administrator Functions: </h2> </cfif> <cfif IsUSerInRole("Facilities")>   <h2>Facilities Functions: </h2> </cfif> This is actually a bit more flexible than CFSWITCH in any case as a user can be in more than one role (I'm not sure if that's possible in your situation, but using CFIF it's technically simpler - CFSWITCH would stop at the first match). Jim Davis ----- Excess quoted text cut - see Original Post for more -----
06/30/2003 11:20 AM
Author: Ian Skinner Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:25165#126581 Well you could use the pre-cfswitch option... <cfif IsUserInRole.... <cfelseif IsUserInRole... <cfelseif IsUserInRole.... <cfelse>   No mathing roles found. </cfif> Not quite as clean as a cfswitch...but some of the benifits and should be a bit faster then a bunch of complete <cfif></cfif> blocks.  This code block will stop testing conditions once a match is found.  To optimize it, put your conditions in order of most likely to least likely. -------------- Ian Skinner Web Programmer BloodSource Sacramento, CA Thanks Jim... Sooo, I guess I have to do this by going through each of my roles and doing cfifs? Seems like I am "hardcoding" almost. Candace K. Cottrell, Web Developer The Children's Medical Center One Children's Plaza Dayton, OH 45404 937-641-4293 http://www.childrensdayton.org cottrellc@childrensdayton.org >>> hoflists@depressedpress.com 6/30/2003 11:01:08 AM >>> It's not illegal, but it won't work. IsUserInRole() takes a role and returns a Boolean (true/false) - it really can't be used in a switch like that.  (The "value" attribute looks at the RETURN of "expression" - it doesn't act as input to it.) Jim Davis ----- Excess quoted text cut - see Original Post for more -----
06/30/2003 11:12 AM
Author: Candace Cottrell Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:25165#126576 Thanks Jim... Sooo, I guess I have to do this by going through each of my roles and doing cfifs? Seems like I am "hardcoding" almost. Candace K. Cottrell, Web Developer The Children's Medical Center One Children's Plaza Dayton, OH 45404 937-641-4293 http://www.childrensdayton.org cottrellc@childrensdayton.org >>> hoflists@depressedpress.com 6/30/2003 11:01:08 AM >>> It's not illegal, but it won't work. IsUserInRole() takes a role and returns a Boolean (true/false) - it really can't be used in a switch like that.  (The "value" attribute looks at the RETURN of "expression" - it doesn't act as input to it.) Jim Davis ----- Excess quoted text cut - see Original Post for more -----
06/30/2003 11:06 AM
Author: Jim Davis Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:25165#126571 It's not illegal, but it won't work. IsUserInRole() takes a role and returns a Boolean (true/false) - it really can't be used in a switch like that.  (The "value" attribute looks at the RETURN of "expression" - it doesn't act as input to it.) Jim Davis ----- Excess quoted text cut - see Original Post for more -----
06/30/2003 11:03 AM
Author: Ian Skinner Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:25165#126567 Don't know, but if so you will need pounds in the expression.  I always forget that. <cfswithc expression="#IsUserInRole()#> -------------- Ian Skinner Web Programmer BloodSource Sacramento, CA Is this illegal? <Cfswitch expression="IsUserInRole()">      <CfCase value="Admin">                  <h2>Administrator Functions: </h2>      </cfcase>       <CfCase value="Facilities">                   <h2>Facilities Functions: </h2>      </cfcase>      </Cfswitch> Candace K. Cottrell, Web Developer The Children's Medical Center One Children's Plaza Dayton, OH 45404 937-641-4293 http://www.childrensdayton.org cottrellc@childrensdayton.org
06/30/2003 11:03 AM
Author: Tony Weeg Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:25165#126568 yeah, so that it will actually parse the value of isUserInRole() rather than validate that the value is actually = "IsUserInRole()" make sense? tony weeg uncertified advanced cold fusion developer tony at navtrak dot net www.navtrak.net office 410.548.2337 fax 410.860.2337 I think it should be <Cfswitch expression="#IsUserInRole()#"> <mack /> ----- Excess quoted text cut - see Original Post for more -----
06/30/2003 11:01 AM
Author: Michael Dinowitz Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:25165#126566 IsUserInRole() needs to be in pounds ----- Excess quoted text cut - see Original Post for more -----
06/30/2003 11:00 AM
Author: Neculai Macarie Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:25165#126564 I think it should be <Cfswitch expression="#IsUserInRole()#"> <mack /> ----- Excess quoted text cut - see Original Post for more -----
06/30/2003 10:57 AM
Author: Candace Cottrell Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:25165#126562 Is this illegal? <Cfswitch expression="IsUserInRole()">      <CfCase value="Admin">                  <h2>Administrator Functions: </h2>      </cfcase>       <CfCase value="Facilities">                   <h2>Facilities Functions: </h2>      </cfcase>      </Cfswitch> Candace K. Cottrell, Web Developer The Children's Medical Center One Children's Plaza Dayton, OH 45404 937-641-4293 http://www.childrensdayton.org cottrellc@childrensdayton.org
<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     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     

Designer, Developer and mobile workflow conference