All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

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

Add GetElabInElabAttrs() and SetElabInElabAttr() methods.

parent 141dd243
......@@ -4864,5 +4864,62 @@ sub ReserveSharedBandwidth($;$$)
return -1;
}
#
# Get/Set ElabInElab attributes.
#
sub GetElabInElabAttrs($)
{
my ($self) = @_;
my $idx = $self->idx();
my $foo = {};
my $query_result =
DBQueryWarn("select * from elabinelab_attributes ".
"where exptidx='$idx'");
return undef
if (!$query_result);
return $foo
if (!$query_result->num_rows);
while (my $row = $query_result->fetchrow_hashref()) {
my $key = $row->{'attrkey'};
my $value = $row->{'attrvalue'};
my $role = $row->{'role'};
my $order = $row->{'ordering'};
if (!exists($foo->{$key})) {
$foo->{$key} = {};
}
if (!exists($foo->{$key}->{$role})) {
$foo->{$key}->{$role} = [];
}
$foo->{$key}->{$role}->[$order] = $value;
}
return $foo;
}
sub SetElabInElabAttr($$$$;$)
{
my ($self, $role, $attrkey, $attrvalue, $ordering) = @_;
my $idx = $self->idx();
my $pid = $self->pid();
my $eid = $self->eid();
$ordering = 0
if (!defined($ordering));
my $safe_value = DBQuoteSpecial($attrvalue);
DBQueryWarn("replace into elabinelab_attributes set ".
" pid='$pid', eid='$eid', exptidx='$idx', ".
" role='$role', attrkey='$attrkey', ".
" attrvalue=$safe_value, ordering='$ordering'")
or return -1;
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