From a249540ebf3e64fb69296c585b50786a80a503df Mon Sep 17 00:00:00 2001 From: Martin Kamerbeek Date: Tue, 2 Mar 2004 16:33:34 +0000 Subject: [PATCH] Fixing a bug where isInGroup always returns false when no gid is passed. Now defaults to gid=3. --- lib/WebGUI/Privilege.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/WebGUI/Privilege.pm b/lib/WebGUI/Privilege.pm index 5da52c72b..fea524d50 100644 --- a/lib/WebGUI/Privilege.pm +++ b/lib/WebGUI/Privilege.pm @@ -240,7 +240,7 @@ sub insufficient { #------------------------------------------------------------------- -=head2 isInGroup ( groupId [ , userId ] ) +=head2 isInGroup ( [ groupId [ , userId ] ] ) Returns a boolean (0|1) value signifying that the user has the required privileges. Always returns true for Admins. @@ -248,7 +248,7 @@ Returns a boolean (0|1) value signifying that the user has the required privileg =item groupId -The group that you wish to verify against the user. +The group that you wish to verify against the user. Defaults to group with Id 3 (the Admin group). =item userId @@ -263,6 +263,9 @@ sub isInGroup { ($gid, $uid) = @_; $uid = $session{user}{userId} if ($uid eq ""); + unless (defined $gid) { + $gid = 3; + } ### The following several checks are to increase performance. If this section were removed, everything would continue to work as normal. if ($gid == 7) {