Closed Bug 169561 Opened 22 years ago Closed 22 years ago

Speed up UserInGroup by using cached information

Categories

(Bugzilla :: Bugzilla-General, defect)

2.17
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: gerv, Assigned: gerv)

Details

Attachments

(1 file)

UserInGroup currently does a DB lookup. We already have all the information we
need to answer the UserInGroup question, because we found it out and stashed it
away in $vars->{'user'}{'groups'} in the GetUserInfo() sub in CGI.pl, which is
always executed.

So, UserInGroup should use this information instead of accessing the DB.
Hopefully this should speed things up a bit, as this is a frequently-called
function.

Gerv
Attached patch Patch v.1Splinter Review
Simple, yet effective :-)

Gerv
Comment on attachment 99741 [details] [diff] [review]
Patch v.1

Looks good, works. r=myk
Attachment #99741 - Flags: review+
It's trivial, but since it affects security, this should get a second pair of
eyes on it.
Joel's our groups man :-) Joel: does this look sane to you? I know you are
probably rewriting this stuff, but anyway...

Gerv
Comment on attachment 99741 [details] [diff] [review]
Patch v.1

Eww. 'global variables are bad'.

OTOH, we can't get rid of $vars until we have a User.pm anyway. Hmm....

Yeah, this probably is OK for now, but please don't go arround changing
everywhere else.

Joel should look at this, anyway.
Comment on attachment 99741 [details] [diff] [review]
Patch v.1


This is fine.  It will actually even still work after the groups stuff is in
because GetUserInfo will populate the user hash as before.
Attachment #99741 - Flags: review+
Fixed.

Checking in globals.pl;
/cvsroot/mozilla/webtools/bugzilla/globals.pl,v  <--  globals.pl
new revision: 1.201; previous revision: 1.200
done

Gerv
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Target Milestone: --- → Bugzilla 2.18
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: