WebGUI
      Click here to register.
      
Sprechen Sie WebGUI? Parlez vous WebGUI? Se habla WebGUI? Spreekt u WebGUI?

Do you speak WebGUI? Please help us translate WebGUI into your language.



     Report a Bug > WebGUI Bug Tracker

SQL pseudo groups do not work

User elnino
Date 6/29/2007 10:24 am
Severity Fatal (can't continue until this is resolved)
Version WebGUI 7.1.3
Views 254
Rating 1    Rate [
|
]
Karma Rank 0.000000
Previous · Next
User Message
elnino

I realize that I'm using an older version, but I'm not ready to upgrade so if you could direct me to the portion of code to fix this that would be great...

http://www.plainblack.com/etcetera/group_privilege_question/re_group_privilege_question4 says  that if the sql query returns the boolean 1 then the user is considered part of that group. It also says that I do not have to assign any webgui users to that sql-based group in order for a user to authenticate for that group.

SO - I've created an sql-based group that uses values stored in a cookie, and then queries an external database to see if a particular webuser can look at the page. My webuser is NOT logged into webgui - but they DID validate at another site (which created the cookie). So when the SQL query returns true - I expect that they should be able to view the webgui page.

But currently webgui presents a logon page even though the sql query returns 1 (true)

Please help, as this is critical to geting this site up. Thanks!

LN



Back to Top
Rate [
|
]
 
 
colink

Always consider the date and version of other posts that you read.  That post is from 2004, and is currently not correct.  In WebGUI 6.99.0, the group code was changed.  Instead of doing a lookup by userId and returning 1, the SQL query is supposed to return a list of userIds.

This was documented in the gotchas file (docs/gotchas.txt), in the online help for the Add/Edit Group form, and in the hoverHelp in the Edit Group form itself.  I've explained to you how to access the online help before, but you may not have stumbled across the hoverHelp.

In almost every form in WebGUI, if you place your mouse over the label for a form field, a little box will pop-up with help for that form field.  In this case, it would have shown you this:

 Many organizations have external databases that map users to groups; for example an HR database might map Employee ID to Health Care Plan.  To validate users against an external database, you need to construct an SQL statement that will return the list of WebGUI userIds for users in the group.  You may use macros in this query to access data in a user's WebGUI profile, such as Employee ID.  Here is an example that checks a user against a fictional HR database.  This assumes you have created an additional WebGUI profile field called employeeId

Closing this as not a bug.



Back to Top
Rate [
|
]
 
 
elnino

Please reopen because I saw that hover help originally and if what you and the hover help says is true, then returning 1 should work because '1' is the webgui's "visitor" user's UID.

If for some reason you choose to disable the visitor - can you tell me where I can remove that piece of code?



Back to Top
Rate [
|
]
 
 
colink

Replying to a closed bug automatically reopens it.

You can't expect to get help from poorly written bug reports.  You quoted old help which doesn't currently describe how WebGUI works.

In any case, let's restate the case and see what we can do to help you out.

You want to write a single sign-on system that pulls a value out of a cookie and then checks to see if that value exists in an external database.  However, whether or not the user has the cookie, it considers them as the Visitor user and presents them with a logon screen.

Have you made sure that your SQL query is correct?

Have you made sure that the data is pulled out of the cookie and placed correctly in the query? 

 

And if you'd like some realtime help for this, hop onto the WebGUI IRC channel. 



Back to Top
Rate [
|
]
 
 
elnino

Hi thank ou for your quick responses. You've stated my situation correctly.

Yes. I've verifed the accuracy of the cookie as it is used on the other site for it's validation. I've also dumped out the cookie's content via macro's Ive written on my webgui's site and my other site. I also verrifed that the sql returns the correct data as I ran it in the query analyzer for mysql.

LN



Back to Top
Rate [
|
]
 
 
colink
After what we talked about on IRC, is it okay to close this bug?

Back to Top
Rate [
|
]
 
 
elnino
Hi. I talked with another person on IRC, and I have some things to
try.. I still think somewhere in the code, there is an exception to
returning the userid of 1... But I haven't found it yet.  I may
have some questions later ontoday. When are you usually on iRC? I'm at
work so I'm unable to chat now.  I certainly appreciate all your
help and the other person's help as well.  BTW, I'm using 7.2.1.

Back to Top
Rate [
|
]
 
 
elnino

Ok. I created two macro to check my sanity.

my $session = shift;
        my $output;
        my $gid = "GoQ2Dm_PER6H2hoW9FwFlg";
        #isInGroup is from Users.pm
        return $session->user->isInGroup($gid);

always return 0 (false) when logged in as visitor even though the query returns 1 which is the uid of the visitor.

So then I created this macro to call getDatabaseUsers to verify what it's returning.  but this just returns returns just "eggs"

my $session = shift;
        my $output;
        my $gid = "GoQ2Dm_PER6H2hoW9FwFlg";

        my $g = WebGUI::Group->new($session,$gid);

        my @users = ();
        #getDatabaseUsers is from Groups.pm
        push @users, @{$g->getDatabaseUsers() }, "eggs" ;
        foreach my $uid (@users) {
             $output .= $uid."</br/>";
        }
        return $output;

So I'm concluding that when the list of users is retrieved from a sql-based qroup via via getDatabaseUsers function, the uid of "1" is somehow ignored.

Again, I verfied the SQL with SQLreport and it does return "1" correctly.

I just don't know perl enough to find the offending code that ignores the "1".

Thanks!



Back to Top
Rate [
|
]
 
 
elnino
man o man.  It's been a caching issue all along!  returning 1 works dandy. You may close this "bug" Thanks for your help!

Back to Top
Rate [
|
]
 
 
colink
Closing as not a bug


Back to Top
Rate [
|
]