Commit b9da5d29 authored by Leigh B Stoller's avatar Leigh B Stoller

Minor bug fixes.

Add BumpModified to update the user's modified flag so that changes
are pushed out when groups change.
Add a PeerExports method to get list of peers the group is exported
to.
parent 56a7b44c
......@@ -1384,8 +1384,8 @@ sub gid_idx($) { return field($_[0], "gid_idx"); }
sub trust($) { return field($_[0], "trust"); }
sub date_applied($) { return field($_[0], "date_applied"); }
sub date_approved($) { return field($_[0], "date_approved"); }
sub group($) { return $_[0]->{'group'}; }
sub user($ ) { return $_[0]->{'user'}; }
sub group($) { return $_[0]->{'GROUP'}; }
sub user($ ) { return $_[0]->{'USER'}; }
#
# Refresh a class instance by reloading from the DB.
......@@ -1495,6 +1495,9 @@ sub NewMemberShip($$$;$)
" date_applied=now() $clause ")
or return -1;
# Mark as needing an update.
$user->BumpModified();
return 0;
}
......@@ -1525,6 +1528,9 @@ sub DeleteMemberShip($$$)
"where gid_idx='$gid_idx' and uid_idx='$uid_idx'")
or return -1;
# Mark as needing an update.
$user->BumpModified();
return 0;
}
......@@ -1557,6 +1563,9 @@ sub ModifyTrust($$)
"where gid_idx='$gid_idx' and uid_idx='$uid_idx'")
or return -1;
# Mark as needing an update.
$self->user()->BumpModified();
return Refresh($self);
}
......@@ -1662,6 +1671,29 @@ sub CheckTrustConsistency($$$$)
return 1;
}
#
# Return group_exports info, as a plain hash.
#
sub PeerExports($$)
{
my ($self, $pref) = @_;
my $pid_idx = $self->pid_idx();
my $gid_idx = $self->gid_idx();
my $result = {};
my $query_result =
DBQueryWarn("select e.*,p.* from group_exports as e ".
"left join emulab_peers as p on p.name=e.peer ".
"where e.pid_idx='$pid_idx' and e.gid_idx='$gid_idx'");
while (my $row = $query_result->fetchrow_hashref()) {
my $peer = $row->{'name'};
$result->{$peer} = $row;
}
$$pref = $result;
return 0;
}
# _Always_ make sure that this 1 is at the end of the file...
1;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment