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 fdc86d7f authored by Leigh B Stoller's avatar Leigh B Stoller

Hook in duration that Keith added in commit 8dc2af90. Still hard

coded to 16 hours, need to fix that.
parent 8dc2af90
......@@ -60,6 +60,7 @@ my $privkeyfile;
my $slice;
my $sitemap;
my $usetracker = 0;
my $maxduration = 3; # Hours. For guests. Need to make this a site variable.
my @aggregate_urns = ();
# Protos
......@@ -182,6 +183,7 @@ if (getpwuid($UID) ne "nobody") {
fatal("You ($UID) do not exist!");
}
$localuser = 1;
$maxduration = 16; # Hours.
}
if (!defined($this_user) || !$this_user->IsAdmin()) {
if ($xmlfile =~ /^([-\w\.\/]+)$/) {
......@@ -251,7 +253,7 @@ fatal($@)
#
# Make sure all the required arguments were provided.
#
foreach my $key ("username", "email", "profile", "portal") {
foreach my $key ("username", "email", "profile", "portal", "duration") {
fatal("Missing required attribute '$key'")
if (! (exists($xmlparse->{'attribute'}->{"$key"}) &&
defined($xmlparse->{'attribute'}->{"$key"}) &&
......@@ -263,11 +265,21 @@ foreach my $key ("username", "email", "profile", "portal") {
#
my ($value, $user_urn, $user_uid, $user_hrn, $user_email, $project, $pid,
$gid, $group, $sshkey, $profile, $profileid, $version, $rspecstr, $errmsg,
$userslice_id, $portal, $script, $reporef, $repohash);
$userslice_id, $portal, $script, $reporef, $repohash, $duration);
# This is used internally to determine which portal was used.
$portal = $xmlparse->{'attribute'}->{"portal"}->{'value'};
# User specified duration.
$duration = $xmlparse->{'attribute'}->{"duration"}->{'value'};
if ($duration !~ /^\d+$/) {
fatal("Duration is not an integer");
}
if ($duration < 1 || $duration > $maxduration) {
UserError("Duration must be at least 1 hour but ".
"not more then $maxduration hour(s)");
}
#
# Username and email has to be acceptable to Emulab user system.
#
......@@ -731,7 +743,7 @@ if (!defined($slice)) {
fatal("Could not create new slice object for $slice_urn");
}
# These get quick expirations, unless it is a real user.
if ($slice->SetExpiration(time() + (($localuser ? 16 : 3) * 3600)) != 0) {
if ($slice->SetExpiration(time() + ($duration * 3600)) != 0) {
fatal("Could not set the slice expiration for $slice_urn");
}
my $slice_uuid = $slice->uuid();
......
<?php
#
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
# Copyright (c) 2000-2017 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -907,6 +907,7 @@ function Do_Submit()
$args["auth_token"] = $_SESSION["auth_token"];
}
}
$args["duration"] = $formfields["duration"];
if (0) {
TBERROR(print_r($args, true), 0);
......
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