What about a situation where you have certain display elements that only
show to logged-in users? Why not wrap <cflogin> around those elements? I
know you're immediate answer is "use conditional logic to see if
getAuthUser()returns an empty string", but I don't see why one is better
than the other. Using getAuthUser() means using conditional logic (yes, I
know that <cflogin> is an explicit conditional check) which is more sore on
the eyes and requires a developer to expend more thought in order to figure
out what the conditional logic is. <cflogin> is intended to be wrapped
around code to run when people aren't logged in. GetAuthUser() is supposed
to return the name of the logged-in user. Right now, getAuthUser() happens
to return an empty string when you're not logged in, but that functionality
isn't set in stone. If that functionality is set in stone, I still think
<cflogin> leaves less doubt about the intention of the code. Thoughts?
~Simon
Simon Horwith
CTO, Etrilogy Ltd.
Member of Team Macromedia
Macromedia Certified Instructor
Certified Advanced ColdFusion MX Developer
Certified Flash MX Developer
CFDJList - List Administrator
http://www.how2cf.com/
-----Original Message-----
From: Raymond Camden [mailto:[EMAIL PROTECTED]
Sent: 06 February 2004 16:04
To: CF-Talk
Subject: RE: Another CFLogin issue - Roles
> I'm trying to trace the error and one main thing I find is
> that if there's 2 CFLOGIN tags on the page, the second one
> always assumes that your not logged in.
You mean 2 blocks of cflogin tags? I'd consider that a bug, but also
non-standard usage. There should only be one <cflogin> block per request
(imho).
Just remove the second <cflogin> block.
In my opinion, CF should simply throw an error if two or more blocks are
encountered.
> -- begin code --
> <cfapplication name="test" sessionmanagement="Yes"
> loginstorage="Session"> <CFLOGIN applicationtoken="test"></CFLOGIN>
>
> <CFLOGIN applicationtoken="test">
> <CFLOGINUSER name="username2" password="password2"
> roles="admin">
> not logged in
> <CFABORT>
> </cflogin>
> logged in
> -- end code--
> Now my issue was that I was running a CFLOGINUSER within a
> CFC which was called from within a CFLOGIN block (outside of
> the CFC) and the CFLOGINUSER was within a CFLOGIN within the
> CFC. The two CFLOGIN blocks probably interacted. This means
> that the external CFLOGIN affects the internal CFLOGINUSER.
> I'll have more info soon.
> (the code above is not production, it only showcases an issue).
> Also, the IsUserInRole() function will not take more than one
> role where the docs says that it can take a list.
Yes, it will take more then one role. This works fine in all my tests.
However, do not forget thatit will do an AND check. So if you pass A,B it
will only return true if the user is in both.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

