I'll post my own solution!
If a record has more than one owner simply make the userid field contain more than one userid separated by spaces. For example if joe and tom should be able to view record 1, then for record1, $rec{'userid'} = 'joe tom'.
Make sure that $auth_user_field in .cfg points to the field # for 'userid' and that
$auth_modify_own and $auth_view_own both are 1.
Make the following changes in db.cgi:
1) in sub query, add $auth to the first my statement, then replace:
####################
Code:
# Now we go through the database and do the actual searching.
# First figure out which records we want:
$first = ($maxhits * ($nh - 1));
$last = $first + $maxhits - 1;
open (DB, "<$db_file_name") or &cgierr("error in search. unable to open database: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
(/^#/) and next LINE; # Skip comment Lines.
(/^\s*$/) and next LINE; # Skip blank lines.
$line = $_; chomp ($line); # Remove trailing new line.
@values = &split_decode($line);
# If we are only allowed to view/mod our own record, then let's check here.
next LINE if ($restricted and ($db_userid ne $values[$auth_user_field]));
####################
with
####################
Code:
# Now we go through the database and do the actual searching.
# First figure out which records we want:
$first = ($maxhits * ($nh - 1));
$last = $first + $maxhits - 1;
open (DB, "<$db_file_name") or &cgierr("error in search. unable to open database: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
(/^#/) and next LINE; # Skip comment Lines.
(/^\s*$/) and next LINE; # Skip blank lines.
$line = $_; chomp ($line); # Remove trailing new line.
@values = &split_decode($line);
@auth_users = split(' ',"$values[$auth_user_field]");
# If we are only allowed to view/mod our own record, then let's check here.
if ($restricted) {
$auth = 0;
foreach $user (@auth_users) {
if ($db_userid eq $user) { $auth++; }
}
next LINE if ($auth == 0);
}
####################
2) Corresponding changes need to be made in sub get_record, sub delete_record, and sub modify_record. Note that in some of these subroutines the @values does not exist. In these routines it is called @data.
If anyone wants more details feel free to ask.
Lauren