Commit c0119684 authored by Leigh Stoller's avatar Leigh Stoller

Tie in the wiki code (add/del account, mkproj, setgroups, web pages, etc).

Wiki support is turned on in the defs file with a WIKISUPPORT=1 directive.
parent 21b37a35
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -40,6 +40,7 @@ my $TBLOGS = "@TBLOGSEMAIL@";
my $CONTROL = "@USERNODE@";
my $BOSSNODE = "@BOSSNODE@";
my $WITHSFS = @SFSSUPPORT@;
my $WIKISUPPORT = @WIKISUPPORT@;
my $SAMBANODE = "fs"; # DNS makes this do the right thing in E-in-E.
my $SMBPASSWD = "/usr/local/bin/smbpasswd";
......@@ -58,6 +59,8 @@ my $MKUSERCERT = "$TB/sbin/mkusercert";
my $SFSUPDATE = "$TB/sbin/sfskey_update";
my $PBAG = "$TB/sbin/paperbag";
my $EXPORTSSETUP= "$TB/sbin/exports_setup";
my $ADDWIKIUSER = "$TB/sbin/addwikiuser";
my $DELWIKIUSER = "$TB/sbin/delwikiuser";
my $NOLOGIN = "/sbin/nologin";
my $SSH = "$TB/bin/sshtb";
my $SAVEUID = $UID;
......@@ -319,6 +322,10 @@ sub AddUser()
system("$GENELISTS -u $user")
if (! $batch);
# And to the wiki if enabled.
system("$ADDWIKIUSER $user")
if ($WIKISUPPORT && !$batch);
# Generate the SSL cert for the user.
system("$MKUSERCERT $user");
......@@ -394,6 +401,11 @@ sub DelUser()
# Remove from elists.
system("$GENELISTS -u $user");
# And to the wiki if enabled.
system("$DELWIKIUSER $user")
if ($WIKISUPPORT);
$EUID = 0;
$sfsupdate = 1;
......@@ -426,6 +438,13 @@ sub UpdatePassword()
}
}
$UID = $SAVEUID;
$EUID = $UID;
# And to the wiki if enabled.
system("$ADDWIKIUSER -u $user")
if ($WIKISUPPORT);
$EUID = 0;
return 0;
}
......
......@@ -1305,6 +1305,7 @@ fi
#
......@@ -1353,6 +1354,7 @@ OUTERBOSS_SSLCERTNAME="/etc/outer_emulab.pem"
PLABSUPPORT=0
PLAB_ROOTBALL="change.me"
PLAB_SLICEPREFIX="utah_elab"
WIKISUPPORT=0
TBLOGFACIL="local5"
LINKTEST_NSPATH="/share/linktest-ns"
BOSSEVENTPORT=2927
......@@ -1852,17 +1854,17 @@ for ac_hdr in ulxmlrpcpp/ulxr_config.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1856: checking for $ac_hdr" >&5
echo "configure:1858: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1861 "configure"
#line 1863 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1866: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1868: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -1901,17 +1903,17 @@ for ac_hdr in linux/videodev.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1905: checking for $ac_hdr" >&5
echo "configure:1907: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1910 "configure"
#line 1912 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1915: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1917: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -1944,7 +1946,7 @@ done
# Extract the first word of "gtk-config", so it can be a program name with args.
set dummy gtk-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1948: checking for $ac_word" >&5
echo "configure:1950: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GTK_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -2023,7 +2025,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:2027: checking for a BSD compatible install" >&5
echo "configure:2029: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -2084,7 +2086,7 @@ esac
# Extract the first word of "rsync", so it can be a program name with args.
set dummy rsync; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2088: checking for $ac_word" >&5
echo "configure:2090: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_RSYNC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -2265,7 +2267,10 @@ outfiles="$outfiles Makeconf GNUmakefile \
robots/mezzanine/libmezz/GNUmakefile \
robots/mezzanine/mezzanine/GNUmakefile \
robots/tracker/GNUmakefile \
robots/mezzanine/mezzcal/GNUmakefile robots/robomonitord "
robots/mezzanine/mezzcal/GNUmakefile robots/robomonitord \
wiki/GNUmakefile wiki/addwikiuser wiki/wikiproxy \
wiki/usertemplate wiki/webhometemplate \
wiki/delwikiuser wiki/setwikigroups wiki/addwikiproj "
#
# Do this for easy distclean.
......@@ -2476,6 +2481,7 @@ s%@OUTERBOSS_NODENAME@%$OUTERBOSS_NODENAME%g
s%@OUTERBOSS_XMLRPCPORT@%$OUTERBOSS_XMLRPCPORT%g
s%@OUTERBOSS_SSLCERTNAME@%$OUTERBOSS_SSLCERTNAME%g
s%@PLABSUPPORT@%$PLABSUPPORT%g
s%@WIKISUPPORT@%$WIKISUPPORT%g
s%@TBLOGFACIL@%$TBLOGFACIL%g
s%@PLAB_ROOTBALL@%$PLAB_ROOTBALL%g
s%@PLAB_SLICEPREFIX@%$PLAB_SLICEPREFIX%g
......
......@@ -109,6 +109,7 @@ AC_SUBST(OUTERBOSS_NODENAME)
AC_SUBST(OUTERBOSS_XMLRPCPORT)
AC_SUBST(OUTERBOSS_SSLCERTNAME)
AC_SUBST(PLABSUPPORT)
AC_SUBST(WIKISUPPORT)
AC_SUBST(TBLOGFACIL)
AC_SUBST(PLAB_ROOTBALL)
AC_SUBST(PLAB_SLICEPREFIX)
......@@ -188,6 +189,7 @@ OUTERBOSS_SSLCERTNAME="/etc/outer_emulab.pem"
PLABSUPPORT=0
PLAB_ROOTBALL="change.me"
PLAB_SLICEPREFIX="utah_elab"
WIKISUPPORT=0
TBLOGFACIL="local5"
LINKTEST_NSPATH="/share/linktest-ns"
BOSSEVENTPORT=2927
......@@ -760,7 +762,10 @@ outfiles="$outfiles Makeconf GNUmakefile \
robots/mezzanine/libmezz/GNUmakefile \
robots/mezzanine/mezzanine/GNUmakefile \
robots/tracker/GNUmakefile \
robots/mezzanine/mezzcal/GNUmakefile robots/robomonitord "
robots/mezzanine/mezzcal/GNUmakefile robots/robomonitord \
wiki/GNUmakefile wiki/addwikiuser wiki/wikiproxy \
wiki/usertemplate wiki/webhometemplate \
wiki/delwikiuser wiki/setwikigroups wiki/addwikiproj "
#
# Do this for easy distclean.
......
......@@ -34,6 +34,7 @@ TBMAINSITE=1
THISHOMEBASE=Emulab.Net
PLABSUPPORT=1
PLAB_ROOTBALL="plabroot-10.tar.bz2"
WIKISUPPORT=1
#
# SSL Certificate stuff. Used to customize config files in ssl directory.
# Note that OrganizationalUnit is set in the cnf file.
......
......@@ -25,6 +25,8 @@ my $TBOPS = "@TBOPSEMAIL@";
my $MKGROUP = "$TB/sbin/mkgroup";
my $MKACCT = "$TB/sbin/tbacct add";
my $GRANTTYPE= "$TB/sbin/grantnodetype -d";
my $WIKISUPPORT = @WIKISUPPORT@;
my $ADDWIKIPROJ = "$TB/sbin/addwikiproj";
my $PROJROOT = "/proj";
my $GRPROOT = "/groups";
......@@ -125,6 +127,11 @@ $EUID = $UID;
system("$MKGROUP $pid $pid") == 0 or
fatal("$MKGROUP $pid failed!");
if ($WIKISUPPORT) {
system("$ADDWIKIPROJ $pid") == 0 or
fatal("$ADDWIKIPROJ $pid failed!");
}
system("$MKACCT $projhead") == 0 or
fatal("$MKACCT $projhead failed!");
......
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -39,10 +39,13 @@ my $TBLOGS = "@TBLOGSEMAIL@";
my $CONTROL = "@USERNODE@";
my $BOSSNODE= "@BOSSNODE@";
my $ADMINGRP= "@TBADMINGROUP@";
my $WIKISUPPORT = @WIKISUPPORT@;
my $SETWIKIGROUPS = "$TB/sbin/setwikigroups";
my $SSH = "$TB/bin/sshtb";
my $GENELISTS="$TB/sbin/genelists";
my $USERMOD = "/usr/sbin/pw usermod";
my $SAVEUID = $UID;
my $dbuid;
my @userlist;
......@@ -202,7 +205,7 @@ foreach my $uid (@userlist) {
#
# Form a list of project (group) membership names. We do this in two
# steps to ensure that we get the default group membership since we
# want that to be the user's primary group. Not sure this really matters
# want that to be the users primary group. Not sure this really matters
# all that much, but might as well.
#
$query_result =
......@@ -363,6 +366,17 @@ else {
}
}
# and the twiki.
if ($WIKISUPPORT) {
$UID = $SAVEUID;
$EUID = $UID;
foreach $user (@userlist) {
system("$SETWIKIGROUPS $user") == 0 or
fatal("$SETWIKIGROUPS $user failed!");
}
}
print "Group Update Completed!\n";
exit(0);
......
......@@ -15,6 +15,8 @@ $TBDOCBASE = "@TBDOCBASE@";
$TBWWW = "@TBWWW@";
$THISHOMEBASE = "@THISHOMEBASE@";
$ELABINELAB = @ELABINELAB@;
$WIKISUPPORT = @WIKISUPPORT@;
$WIKIURL = "https://${USERNODE}/twiki/bin/logon";
$TBMAILADDR_OPS = "@TBOPSEMAIL_NOSLASH@";
$TBMAILADDR_WWW = "@TBWWWEMAIL_NOSLASH@";
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -221,7 +221,8 @@ function WRITEPLABBOTTOMBAR() {
#
function WRITESIDEBAR() {
global $login_status, $login_uid;
global $TBBASE, $TBDOCBASE, $BASEPATH;
global $TBBASE, $TBDOCBASE, $BASEPATH, $WIKISUPPORT, $WIKIURL;
global $CHECKLOGIN_WIKINAME;
global $THISHOMEBASE;
#
......@@ -377,6 +378,14 @@ function WRITESIDEBAR() {
WRITESIDEBARBUTTON("My Emulab",
$TBBASE,
"showuser.php3?target_uid=$login_uid");
if ($WIKISUPPORT && $CHECKLOGIN_WIKINAME != "") {
$wikiname = $CHECKLOGIN_WIKINAME;
WRITESIDEBARBUTTON_ABSCOOL("My Wikis",
"${WIKIURL}/Main/$wikiname",
"${WIKIURL}/Main/$wikiname");
}
# Since a user can be a member of more than one project,
# display this option, and let the form decide if the
......
......@@ -14,10 +14,12 @@
# A project
#
function SHOWPROJECT($pid, $thisuid) {
global $TBDBNAME;
global $WIKISUPPORT, $WIKIURL;
$query_result =
DBQueryFatal("SELECT * FROM projects WHERE pid='$pid'");
DBQueryFatal("select p.*,g.wikiname from projects as p ".
"left join groups as g on g.pid=p.pid and g.gid=g.pid ".
"where p.pid='$pid'");
$row = mysql_fetch_array($query_result);
echo "<center>
......@@ -42,6 +44,7 @@ function SHOWPROJECT($pid, $thisuid) {
$approved = $row[approved];
$expt_count = $row[expt_count];
$expt_last = $row[expt_last];
$wikiname = $row[wikiname];
if ($proj_public) {
$proj_public = "Yes";
......@@ -87,6 +90,16 @@ function SHOWPROJECT($pid, $thisuid) {
<td class=\"left\">
<A href='$proj_URL'>$proj_URL</A></td>
</tr>\n";
if ($WIKISUPPORT && isset($wikiname)) {
$wikiurl = "${WIKIURL}/$wikiname/WebHome";
echo "<tr>
<td>Project Wiki:</td>
<td class=\"left\">
<A href='$wikiurl'>$wikiname</A></td>
</tr>\n";
}
echo "<tr>
<td>Publicly Visible: </td>
......@@ -370,7 +383,7 @@ function SHOWGROUPMEMBERSHIP($uid) {
# A User
#
function SHOWUSER($uid) {
global $TBDBNAME;
global $WIKISUPPORT, $WIKIURL;
$userinfo_result =
DBQueryFatal("SELECT * from users where uid='$uid'");
......@@ -397,6 +410,7 @@ function SHOWUSER($uid) {
$frozen = $row['weblogin_frozen'];
$failcount = $row['weblogin_failcount'];
$failstamp = $row['weblogin_failstamp'];
$wikiname = $row['wikiname'];
if (!strcmp($usr_addr2, ""))
$usr_addr2 = "&nbsp";
......@@ -452,6 +466,16 @@ function SHOWUSER($uid) {
<td>Home Page URL:</td>
<td><A href='$usr_URL'>$usr_URL</A></td>
</tr>\n";
if ($WIKISUPPORT && isset($wikiname)) {
$wikiurl = "${WIKIURL}/Main/$wikiname";
echo "<tr>
<td>Emulab Wiki Page:</td>
<td class=\"left\">
<A href='$wikiurl'>$wikiname</A></td>
</tr>\n";
}
#echo "<tr>
# <td>Expiration date:</td>
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
#
......@@ -13,6 +13,7 @@
$CHECKLOGIN_STATUS = -1;
$CHECKLOGIN_UID = 0;
$CHECKLOGIN_NOLOGINS = -1;
$CHECKLOGIN_WIKINAME = "";
#
# New Mapping.
......@@ -125,6 +126,7 @@ function GETUID() {
function CHECKLOGIN($uid) {
global $TBAUTHCOOKIE, $TBLOGINCOOKIE, $HTTP_COOKIE_VARS, $TBAUTHTIMEOUT;
global $CHECKLOGIN_STATUS, $CHECKLOGIN_UID, $CHECKLOGIN_NODETYPES;
global $CHECKLOGIN_WIKINAME;
global $nocookieauth;
#
# If we already figured this out, do not duplicate work!
......@@ -149,7 +151,7 @@ function CHECKLOGIN($uid) {
$query_result =
DBQueryFatal("select NOW()>=u.pswd_expires,l.hashkey,l.timeout, ".
" status,admin,cvsweb,g.trust,adminoff,webonly, " .
" user_interface,n.type,u.stud " .
" user_interface,n.type,u.stud,u.wikiname " .
" from users as u ".
"left join login as l on l.uid=u.uid ".
"left join group_membership as g on g.uid=u.uid ".
......@@ -186,6 +188,7 @@ function CHECKLOGIN($uid) {
$type = $row[10];
$stud = $row[11];
$wikiname = $row[12];
$CHECKLOGIN_NODETYPES[$type] = 1;
}
......@@ -309,6 +312,8 @@ function CHECKLOGIN($uid) {
$CHECKLOGIN_STATUS |= CHECKLOGIN_UNVERIFIED;
if (strcmp($status, TBDB_USERSTATUS_ACTIVE) == 0)
$CHECKLOGIN_STATUS |= CHECKLOGIN_ACTIVE;
if (isset($wikiname) && $wikiname != "")
$CHECKLOGIN_WIKINAME = $wikiname;
#
# Set the magic enviroment variable, if appropriate, for the sake of
......
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