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 |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Is this illegal?
Candace Cottrell
06/30/03 10:57 A
IsUserInRole() needs to be in pounds
Michael Dinowitz
06/30/03 11:01 A
It's not illegal, but it won't work.
Jim Davis
06/30/03 11:06 A
Thanks Jim...
Candace Cottrell
06/30/03 11:12 A
> Thanks Jim...
Jim Davis
06/30/03 11:24 A
Gotcha...
Candace Cottrell
06/30/03 11:27 A
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Candace Cottrell
06/30/2003 10:57 AM

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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Neculai Macarie
06/30/2003 11:00 AM

I think it should be <Cfswitch expression="#IsUserInRole()#"> <mack /> ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Tony Weeg
06/30/2003 11:03 AM

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 -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jim Davis
06/30/2003 11:06 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 -----

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ian Skinner
06/30/2003 11:03 AM

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

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Candace Cottrell
06/30/2003 11:12 AM

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 -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jim Davis
06/30/2003 11:24 AM

> 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 -----

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ian Skinner
06/30/2003 11:20 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 -----

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Candace Cottrell
06/30/2003 11:27 AM

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 -----


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

September 09, 2010

<<   <   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