Commit 040ea3be authored by Leigh Stoller's avatar Leigh Stoller

Change "genesis" to "portal" what the hell was I thinking when I

picked genesis. But this change actually has content; we need to
distinguish between classic projects and emulab portal projects
(new projects created via the portal, and used via the portal).  For now
these are distinct until we decide to bring everyone up to the new
interface.
parent ef9c1265
#!/usr/bin/perl -wT
#
# Copyright (c) 2000-2011, 2014 University of Utah and the Flux Group.
# Copyright (c) 2000-2011, 2014, 2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -42,7 +42,7 @@ my $debug = 0;
my $nonlocal= 0;
my $impotent= 0;
my $silent = 0;
my $genesis;
my $portal;
my $resend;
#
......@@ -224,12 +224,12 @@ fatal($@)
if ($@);
# APT flag. Notice and delete.
if (exists($xmlparse->{'attribute'}->{"genesis"})) {
$genesis = $xmlparse->{'attribute'}->{"genesis"}->{'value'};
delete($xmlparse->{'attribute'}->{"genesis"});
if (! ($genesis eq "aptlab" || $genesis eq "cloudlab" ||
$genesis eq "phantomnet")) {
fatal("Bad genesis: $genesis");
if (exists($xmlparse->{'attribute'}->{"portal"})) {
$portal = $xmlparse->{'attribute'}->{"portal"}->{'value'};
delete($xmlparse->{'attribute'}->{"portal"});
if (! ($portal eq "aptlab" || $portal eq "cloudlab" ||
$portal eq "phantomnet" || $portal eq "emulab")) {
fatal("Bad portal: $portal");
}
}
......@@ -375,9 +375,9 @@ exit(0)
my $new_pid = $newproj_args{'pid'};
delete($newproj_args{'pid'});
delete($newproj_args{'head_uid'});
# Genesis (APT, CloudLab, or PhantomNet)
$newproj_args{'genesis'} = $genesis
if (defined($genesis));
# Portal (Emulab, APT, CloudLab, or PhantomNet)
$newproj_args{'portal'} = $portal
if (defined($portal));
my $newproj = Project->Create($new_pid, $leader, \%newproj_args);
if (!defined($newproj)) {
......
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -41,8 +41,7 @@ my $debug = 0;
my $impotent= 0;
my $type = "";
my $silent = 0;
my $portal = 0;
my $genesis;
my $portal;
my @keyfiles = ();
#
......@@ -212,12 +211,12 @@ print STDERR Dumper($xmlparse)
if ($debug);
# APT flag. Notice and delete.
if (exists($xmlparse->{'attribute'}->{"genesis"})) {
$genesis = $xmlparse->{'attribute'}->{"genesis"}->{'value'};
delete($xmlparse->{'attribute'}->{"genesis"});
if (! ($genesis eq "aptlab" || $genesis eq "cloudlab" ||
$genesis eq "phantomnet")) {
fatal("Bad genesis: $genesis");
if (exists($xmlparse->{'attribute'}->{"portal"})) {
$portal = $xmlparse->{'attribute'}->{"portal"}->{'value'};
delete($xmlparse->{'attribute'}->{"portal"});
if (! ($portal eq "aptlab" || $portal eq "cloudlab" ||
$portal eq "phantomnet" || $portal eq "emulab")) {
fatal("Bad portal: $portal");
}
# Remove these, we do not require them on the APT path.
delete($required{"affiliation_abbreviation"});
......@@ -435,9 +434,9 @@ if (exists($newuser_args{'uid'})) {
$new_uid = $newuser_args{'uid'};
delete($newuser_args{'uid'});
}
# Genesis (APT, CloudLab or PhantomNet)
$newuser_args{'genesis'} = $genesis
if (defined($genesis));
# Portal (Emulab, APT, CloudLab or PhantomNet)
$newuser_args{'portal'} = $portal
if (defined($portal));
#
# The type modifier comes in on the command line since this is available
......@@ -461,7 +460,7 @@ my $newuser = User->Create($new_uid, $flags, \%newuser_args);
if (!defined($newuser)) {
fatal("Could not create new user!");
}
if (defined($genesis)) {
if (defined($portal)) {
$newuser->SetStatus(USERSTATUS_UNAPPROVED());
}
my $key = $newuser->verify_key();
......@@ -532,7 +531,7 @@ SENDMAIL("$usr_name '$usr_uid' <$usr_email>",
"Testbed Operations\n",
"$TBAPPROVAL",
"Bcc: $TBAUDIT")
if (!($silent || defined($genesis)));
if (!($silent || defined($portal)));
#
# Do we have a keyfile? If so, rerun addpubkey for real now that the
......
......@@ -49,7 +49,11 @@ sub Create($$)
{
my ($class, $brand) = @_;
if ($brand =~ /aptlab/) {
# No brand means the classic interface.
if (!defined($brand)) {
$brand = "classic";
}
elsif ($brand =~ /aptlab/) {
$brand = "aptlab";
}
elsif ($brand =~ /cloudlab/) {
......@@ -59,6 +63,7 @@ sub Create($$)
$brand = "phantomnet";
}
else {
# This means the new Portal interface.
$brand = "emulab";
}
my $self = {};
......@@ -72,6 +77,7 @@ sub isAPT($) { return $_[0]->brand() eq "aptlab" ? 1 : 0; }
sub isCloud($) { return $_[0]->brand() eq "cloudlab" ? 1 : 0; }
sub isPNet($) { return $_[0]->brand() eq "phantomnet" ? 1 : 0; }
sub isEmulab($) { return $_[0]->brand() eq "emulab" ? 1 : 0; }
sub isClassic($) { return $_[0]->brand() eq "classic" ? 1 : 0; }
sub wwwBase($)
{
......@@ -80,6 +86,7 @@ sub wwwBase($)
return ($self->isAPT() ? "https://www.aptlab.net" :
$self->isCloud() ? "https://www.cloudlab.us" :
$self->isPNet() ? "https://www.phantomnet.org" :
$self->isEmulab() ? "@TBBASE@" . "/portal" :
"@TBBASE@");
}
......@@ -139,7 +146,8 @@ sub SignupURL($$)
my $wwwbase = $self->wwwBase();
my $pid = $project->pid();
return ($self->isAPT() || $self->isCloud() || $self->isPNet() ?
return ($self->isAPT() || $self->isCloud() ||
$self->isPNet() || $self->isEmulab() ?
"${wwwbase}/signup.php?pid=$pid" :
"${wwwbase}/joinproject.php3?target_pid=$pid");
}
......
......@@ -108,7 +108,7 @@ sub Lookup($$)
if (!defined($self->{'GROUP'}));
bless($self, $class);
$self->{'BRAND'} = Brand->Create($self->genesis());
$self->{'BRAND'} = Brand->Create($self->portal());
# Add to cache.
$projects{$self->{'PROJECT'}->{'pid_idx'}} = $self;
......@@ -148,7 +148,7 @@ sub IsNonLocal($) { return (defined($_[0]->nonlocal_id()) ? 1 : 0); };
sub nonlocal_id($) { return field($_[0], "nonlocal_id"); }
sub nonlocal_type($) { return field($_[0], "nonlocal_type"); }
sub manager_urn($) { return field($_[0], "manager_urn"); }
sub genesis($) { return field($_[0], "genesis"); }
sub portal($) { return field($_[0], "portal"); }
sub Brand($) { return $_[0]->{'BRAND'}; }
sub isAPT($) { return $_[0]->Brand()->isAPT() ? 1 : 0; }
sub isCloud($) { return $_[0]->Brand()->isCloud() ? 1 : 0; }
......
......@@ -147,7 +147,7 @@ sub Lookup($$)
$self->{'USER'} = $query_result->fetchrow_hashref();
bless($self, $class);
$self->{'BRAND'} = Brand->Create($self->genesis());
$self->{'BRAND'} = Brand->Create($self->portal());
# Add to cache.
$users{$self->{'USER'}->{'uid_idx'}} = $self;
......@@ -217,7 +217,7 @@ sub nonlocal_id($) { return field($_[0], "nonlocal_id"); }
sub nonlocal_type($) { return field($_[0], "nonlocal_type"); }
sub IsLocal($) { return (defined($_[0]->nonlocal_id()) ? 0 : 1); };
sub IsNonLocal($) { return (defined($_[0]->nonlocal_id()) ? 1 : 0); };
sub genesis($) { return field($_[0], "genesis"); }
sub portal($) { return field($_[0], "portal"); }
sub Brand($) { return $_[0]->{'BRAND'}; }
sub isAPT($) { return $_[0]->Brand()->isAPT() ? 1 : 0; }
sub isCloud($) { return $_[0]->Brand()->isCloud() ? 1 : 0; }
......
......@@ -31,14 +31,14 @@ use Date::Parse;
#
sub usage()
{
print STDERR "Usage: announce -a <-g genesis> [-s alert_style] [-b button_label] [-u action_url] [-m max_seen_count] <announcement_text>\n";
print STDERR "Usage: announce -a <-p portal> [-s alert_style] [-b button_label] [-u action_url] [-m max_seen_count] <announcement_text>\n";
print STDERR " announce -l [active|retired|all]\n";
print STDERR " announce -r idx\n";
print STDERR " announce -i idx\n";
print STDERR " announce -h\n";
print STDERR " -h This message\n";
print STDERR " -a Create a new announcement with the given announcement text.\n";
print STDERR " -g Set the genesis to be the one given. Should be one of 'cloudlab', 'emulab', 'aptlab', 'phantomnet'.\n";
print STDERR " -p Set the portal to be the one given. Should be one of 'cloudlab', 'emulab', 'aptlab', 'phantomnet'.\n";
print STDERR " -s Set the style of the overall announcement box. Should normally be one of bootstraps alert-* classes. Defaults to 'alert-info'.\n";
print STDERR " -b If there is an action associated with this announcement, this is the text which goes into the action button. Can include HTML. If it is unset, there is no action button.\n";
print STDERR " -u URL of action associated with this announcement. {uid_idx} and {uid} can be used as URL templates to generate a different URL on a per-user basis. If it is unset, there is no action button.\n";
......@@ -48,12 +48,12 @@ sub usage()
print STDERR " -i Info about a particular announcement.\n";
exit(-1);
}
my $optlist = "hag:s:b:u:m:lr:i:";
my $optlist = "hap:s:b:u:m:lr:i:";
my $add_mode = 0;
my $list_mode = 0;
my $retire_mode = 0;
my $info_mode = 0;
my $genesis = undef;
my $portal = undef;
my $style = "alert-info";
my $button = undef;
my $url = undef;
......@@ -117,8 +117,8 @@ if (defined($options{"i"})) {
$info_mode = 1;
$info_idx = $options{"i"};
}
if (defined($options{"g"})) {
$genesis = $options{"g"};
if (defined($options{"p"})) {
$portal = $options{"p"};
}
if (defined($options{"s"})) {
$style = $options{"s"};
......@@ -137,7 +137,7 @@ if ($add_mode + $list_mode + $retire_mode + $info_mode != 1) {
usage();
}
if ($add_mode and ! defined($genesis)) {
if ($add_mode and ! defined($portal)) {
usage();
}
......@@ -159,7 +159,7 @@ if ($add_mode) {
#
my $query = "insert into apt_announcements set ";
$query .= "created=NOW()";
$query .= ", genesis=" . DBQuoteSpecial($genesis);
$query .= ", portal=" . DBQuoteSpecial($portal);
$query .= ", max_seen=" . DBQuoteSpecial($max_seen);
$query .= ", text=" . DBQuoteSpecial($text);
$query .= ", style=" . DBQuoteSpecial($style);
......@@ -179,16 +179,16 @@ if ($add_mode) {
$condition = "retired=1 and ";
}
$query_result =
DBQueryFatal("select idx, genesis, text from apt_announcements where ".$condition."uid_idx is NULL");
print "idx\tGenesis Text\n";
DBQueryFatal("select idx, portal, text from apt_announcements where ".$condition."uid_idx is NULL");
print "idx\tPortal Text\n";
print "---\t------- ----\n";
while (my ($idx, $genesis, $text) = $query_result->fetchrow_array()) {
while (my ($idx, $portal, $text) = $query_result->fetchrow_array()) {
my $textbit = substr($text, 0, 55);
if (length($text) > 55) {
$textbit = $textbit . "...";
}
my $genesispad = sprintf("%-10s", $genesis);
print "$idx\t$genesispad $textbit\n"
my $portalpad = sprintf("%-10s", $portal);
print "$idx\t$portalpad $textbit\n"
}
} elsif ($retire_mode) {
#
......@@ -214,8 +214,8 @@ if ($add_mode) {
DBQueryFatal("select count(*) from apt_announcement_info where dismissed=1 and aid=".DBQuoteSpecial($info_idx));
my ($dismissed) = $query_result->fetchrow_array();
$query_result =
DBQueryFatal("select idx, created, uid_idx, genesis, retired, max_seen, text, style, link_label, link_url from apt_announcements where idx=".DBQuoteSpecial($info_idx));
if (my ($idx, $created, $uid_idx, $genesis, $retired,
DBQueryFatal("select idx, created, uid_idx, portal, retired, max_seen, text, style, link_label, link_url from apt_announcements where idx=".DBQuoteSpecial($info_idx));
if (my ($idx, $created, $uid_idx, $portal, $retired,
$max_seen, $text, $style, $link_label,
$link_url) = $query_result->fetchrow_array())
{
......@@ -223,7 +223,7 @@ if ($add_mode) {
print "Details for announcement $idx\n";
print "-----------------------------\n\n";
print "Created:\t$created\n";
print "Genesis:\t$genesis\n\n";
print "Portal:\t$portal\n\n";
if (defined($link_label) && defined($link_url)) {
print "Button Label:\t$link_label\n";
print "Button URL:\t$link_url\n";
......
......@@ -66,8 +66,8 @@ function Do_SearchUsers()
return -1;
}
$query_result =
DBQueryFatal("select uid,usr_name,usr_affil,genesis from users ".
"where genesis='$PORTAL_GENESIS' and ".
DBQueryFatal("select uid,usr_name,usr_affil,portal from users ".
"where portal='$PORTAL_GENESIS' and ".
" (uid like '%${text}%' or ".
" usr_name like '%${text}%') ".
"order by uid");
......@@ -103,10 +103,10 @@ function Do_SearchProjects()
return -1;
}
$query_result =
DBQueryFatal("select pid,u.uid,u.usr_name,u.usr_affil,p.genesis ".
DBQueryFatal("select pid,u.uid,u.usr_name,u.usr_affil,p.portal ".
" from projects as p ".
"left join users as u on u.uid_idx=p.head_idx ".
"where p.genesis='$PORTAL_GENESIS' and ".
"where p.portal='$PORTAL_GENESIS' and ".
" (pid like '%${text}%' or ".
" u.usr_name like '%${text}%' or ".
" u.usr_affil like '%${text}%') ".
......
......@@ -437,7 +437,7 @@ function GET_ANNOUNCEMENTS($user)
$uid_idx = $user->uid_idx();
$dblink = DBConnect("tbdb");
# Add an apt_announcement_info entry for any announcements which don't have one
$query_result = DBQueryWarn('select a.idx from apt_announcements as a left join apt_announcement_info as i on a.idx=i.aid and ((a.uid_idx is NULL and i.uid_idx="'.$uid_idx.'") or (a.uid_idx is not NULL and a.uid_idx=i.uid_idx)) where a.genesis="'.$PORTAL_GENESIS.'" and a.retired=0 and i.uid_idx is NULL and (a.uid_idx is NULL or a.uid_idx="'.$uid_idx.'")');
$query_result = DBQueryWarn('select a.idx from apt_announcements as a left join apt_announcement_info as i on a.idx=i.aid and ((a.uid_idx is NULL and i.uid_idx="'.$uid_idx.'") or (a.uid_idx is not NULL and a.uid_idx=i.uid_idx)) where a.portal="'.$PORTAL_GENESIS.'" and a.retired=0 and i.uid_idx is NULL and (a.uid_idx is NULL or a.uid_idx="'.$uid_idx.'")');
while ($row = mysql_fetch_array($query_result, MYSQL_NUM)) {
DBQueryWarn('insert into apt_announcement_info set aid="'.$row[0].'", uid_idx="'.$uid_idx.'",seen_count=0');
}
......@@ -446,7 +446,7 @@ function GET_ANNOUNCEMENTS($user)
'from apt_announcements as a '.
'left join apt_announcement_info as i on a.idx=i.aid '.
'where (a.uid_idx is NULL or a.uid_idx="'.$uid_idx.'") and '.
'a.retired = 0 and a.genesis="'.$PORTAL_GENESIS.'" and '.
'a.retired = 0 and a.portal="'.$PORTAL_GENESIS.'" and '.
'i.uid_idx="'.$uid_idx.'" and '.
'i.dismissed = 0 and i.clicked = 0 and '.
'(a.max_seen = 0 or i.seen_count < a.max_seen)', $dblink);
......
......@@ -150,7 +150,7 @@ function Do_ProjectProfile()
$results["pid"] = $target_project->pid();
$results["pid_idx"] = $target_project->pid_idx();
$results["leader"] = $target_project->head_uid();
$results["genesis"] = $target_project->genesis();
$results["portal"] = $target_project->portal();
$results["created"] = DateStringGMT($target_project->created());
$results["approved"] = $target_project->approved();
$results["url"] = $target_project->URL();
......
<?php
#
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -419,7 +419,7 @@ if (!$this_user) {
# Force initial SSL cert generation.
$args["passphrase"] = $formfields["password1"];
# Flag to the backend.
$args["genesis"] = $PORTAL_GENESIS;
$args["portal"] = $PORTAL_GENESIS;
#
# Backend verifies pubkey and returns error. We first look for a
......@@ -517,7 +517,7 @@ $args["ron"] = 0;
$args["funders"] = "None";
$args["whynotpublic"] = $PORTAL_GENESIS;
# Flag to the backend.
$args["genesis"] = $PORTAL_GENESIS;
$args["portal"] = $PORTAL_GENESIS;
if (! ($project = Project::NewNewProject($args, $error))) {
$errors["error"] = $error;
......
<?php
#
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -61,7 +61,7 @@ if ($query_result) {
#
$query_result =
DBQueryFatal("select count(pid) from projects ".
"where approved=1 and genesis='cloudlab'");
"where approved=1 and portal='cloudlab'");
if ($query_result) {
$row = mysql_fetch_array($query_result);
$blob["projects"] = $row[0];
......
......@@ -21,10 +21,12 @@
<td>Created</td>
<td class="format-date"><%= fields.created %></td>
</tr>
<tr>
<td>Genesis</td>
<td><%= fields.genesis %></td>
</tr>
<% if (fields.portal) { %>
<tr>
<td>Portal</td>
<td><%= fields.portal %></td>
</tr>
<% } %>
<tr>
<td>Approved</td>
<td><% if (fields.approved) { %>Yes<% } else { %>No<% } %></td>
......
......@@ -35,10 +35,12 @@
<td><%= fields.city %></td>
</tr>
<% if (isadmin) { %>
<tr>
<td>Genesis</td>
<td><%= fields.genesis %></td>
</tr>
<% if (fields.portal) { %>
<tr>
<td>Portal</td>
<td><%= fields.portal %></td>
</tr>
<% } %>
<tr>
<td>Created</td>
<td class="format-date"><%= fields.created %></td>
......
......@@ -165,7 +165,7 @@ function Do_AccountDetails()
if (ISADMIN()) {
$results["uid_idx"] = $target_user->uid_idx();
$results["genesis"] = $target_user->genesis();
$results["portal"] = $target_user->portal();
$results["created"] = DateStringGMT($target_user->created());
$results["status"] = $target_user->status();
$results["stud"] = $target_user->stud() ? true : false;
......
......@@ -726,7 +726,7 @@ class Group
$usr_URL = $user->URL();
$url = $project->wwwBase();
if (1 ||
if ($project->isEmulab() ||
$project->isAPT() || $project->isCloud() || $project->isPNet()) {
$url .= "/approveuser.php?uid=$joining_uid&pid=$pid";
$message =
......
......@@ -164,10 +164,18 @@ class Project
function cvsrepo_public(){ return $this->field("cvsrepo_public"); }
function allow_workbench(){ return $this->field("allow_workbench"); }
function nonlocal_id() { return $this->field("nonlocal_id"); }
function genesis() { return $this->field("genesis"); }
function isAPT() { return $this->genesis() == "aptlab" ? 1 : 0; }
function isCloud() { return $this->genesis() == "cloudlab" ? 1 : 0; }
function isPNet() { return $this->genesis() == "phantomnet" ? 1 : 0; }
function portal() { return $this->field("portal"); }
function isAPT() { return ($this->portal() &&
$this->portal() == "aptlab" ? 1 : 0); }
function isCloud() { return ($this->portal() &&
$this->portal() == "cloudlab" ? 1 : 0); }
function isPNet() { return ($this->portal() &&
$this->portal() == "phantomnet" ? 1 : 0);}
function isEmulab() { return ($this->portal() &&
$this->portal() == "emulab" ? 1 : 0); }
# Not via the Portal interface.
function isClassic() { return ($this->portal() ? 0 : 1); }
function IsNonLocal() {
return ($this->field("nonlocal_id") ? 1 : 0);
}
......@@ -699,7 +707,7 @@ class Project
$wikiname = $group->wikiname();
$cvsrepo_public = $this->cvsrepo_public();
$allow_workbench = $this->allow_workbench();
$genesis = $this->genesis();
$portal = $this->portal();
$nonlocal_id = $this->nonlocal_id();
# Before project approval, display ron/plab request status.
......@@ -763,10 +771,10 @@ class Project
<a href='$proj_URL'>$proj_URL</a></td>
</tr>\n";
if ($genesis != "emulab") {
if (isset($portal)) {
echo "<tr>
<td>Genesis: </td>
<td class=\"left\">$genesis</td>
<td>Portal: </td>
<td class=\"left\">$portal</td>
</tr>\n";
}
......
......@@ -346,10 +346,17 @@ class User
function wikionly() { return $this->field("wikionly"); }
function mailman_password() { return $this->field("mailman_password"); }
function nonlocal_id() { return $this->field("nonlocal_id"); }
function genesis() { return $this->field("genesis"); }
function isAPT() { return $this->genesis() == "aptlab" ? 1 : 0; }
function isCloud() { return $this->genesis() == "cloudlab" ? 1 : 0; }
function isPNet() { return $this->genesis() == "phantomnet" ? 1 : 0; }
function portal() { return $this->field("portal"); }
function isAPT() { return ($this->portal() &&
$this->portal() == "aptlab" ? 1 : 0); }
function isCloud() { return ($this->portal() &&
$this->portal() == "cloudlab" ? 1 : 0); }
function isPNet() { return ($this->portal() &&
$this->portal() == "phantomnet" ? 1 : 0);}
function isEmulab() { return ($this->portal() &&
$this->portal() == "emulab" ? 1 : 0); }
# Not via the Portal interface.
function isClassic() { return ($this->portal() ? 0 : 1); }
function IsNonLocal() {
return ($this->field("nonlocal_id") ? 1 : 0);
......@@ -738,7 +745,7 @@ class User
$wikionly = $user->wikionly();
$stud = $user->stud();
$uuid = $user->uuid();
$genesis = $user->genesis();
$portal = $user->portal();
$nonlocal_id = $user->nonlocal_id();
if (!strcmp($usr_addr2, ""))
......@@ -921,10 +928,10 @@ class User
<td class=left>$uuid</td>
</tr>\n";
if ($genesis != "emulab") {
if (isset($portal)) {
echo "<tr>
<td>Genesis: </td>
<td class=left>$genesis</td>
<td>Portal: </td>
<td class=left>$portal</td>
</tr>\n";
}
}
......
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