Auth now checks the defaulton field on the userflags table as well

This commit is contained in:
finlayt 2002-12-04 02:38:33 +00:00
parent bc4af355b9
commit 8fefd6658c
1 changed files with 6 additions and 3 deletions

View File

@ -70,13 +70,16 @@ sub getuserflags {
my $sth=$dbh->prepare("SELECT flags FROM borrowers WHERE cardnumber=?");
$sth->execute($cardnumber);
my ($flags) = $sth->fetchrow;
$sth=$dbh->prepare("SELECT bit, flag FROM userflags");
$sth=$dbh->prepare("SELECT bit, flag, defaulton FROM userflags");
$sth->execute;
while (my ($bit, $flag) = $sth->fetchrow) {
if ($flags & (2**$bit)) {
while (my ($bit, $flag, $defaulton) = $sth->fetchrow) {
if (($flags & (2**$bit)) || $defaulton) {
$userflags->{$flag}=1;
}
}
foreach my $key (keys %$userflags) {
warn "$key \n";
}
return $userflags;
}