showgroup.php3 3.2 KB
Newer Older
Leigh B. Stoller's avatar
Leigh B. Stoller committed
1
<?php
Leigh B. Stoller's avatar
Leigh B. Stoller committed
2
#
3
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
Leigh B. Stoller's avatar
Leigh B. Stoller committed
23
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
24
include("defs.php3");
25
include_once("template_defs.php");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
26 27 28 29 30 31 32 33 34

#
# Note the difference with which this page gets it arguments!
# I invoke it using GET arguments, so uid and pid are are defined
# without having to find them in URI (like most of the other pages
# find the uid).
#

#
35
# Only known and logged in users.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
36
#
37 38 39
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
40 41

#
42
# Verify page arguments.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
43
#
44
$reqargs = RequiredPageArguments("group", PAGEARG_GROUP);
45
$project = $group->Project();
46 47
$pid     = $group->pid();
$gid     = $group->gid();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
48

49 50 51 52 53
#
# Standard Testbed Header
#
PAGEHEADER("Group $pid/$gid");

Leigh B. Stoller's avatar
Leigh B. Stoller committed
54
#
55 56
# Verify permission to look at the group. This is a little different,
# since the standard test would look for permission in just the group,
57
# but we also want to allow users from the project with appropriate
58 59
# privs to look at the group.
#
60 61 62 63
if (! ($group->AccessCheck($this_user, $TB_PROJECT_READINFO) ||
       $project->AccessCheck($this_user, $TB_PROJECT_EDITGROUP))) {
    USERERROR("You do not have permission to view ".
	      "group $gid in project $pid!", 1);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
64 65
}

66 67 68 69
#
# See if user is privledged for deletion.
#
$prived = 0;
70
if ($isadmin || $project->AccessCheck($this_user, $TB_PROJECT_DELUSER)) {
71 72 73
    $prived = 1;
}

74
#
75
# This menu only makes sense for people with privs to use them.
76
#
77 78 79
$showmenu = ($group->AccessCheck($this_user, $TB_PROJECT_EDITGROUP) ||
	     (! $group->IsProjectGroup() &&
	      $project->AccessCheck($this_user, $TB_PROJECT_DELGROUP)));
80

81
if ($showmenu) {
82 83 84
    SUBPAGESTART();
    SUBMENUSTART("Group Options");

85
    if ($group->AccessCheck($this_user, $TB_PROJECT_EDITGROUP)) {
86
	WRITESUBMENUBUTTON("Edit this Group",
87
			   "editgroup.php3?pid=$pid&gid=$gid");
88 89 90 91 92
    }

    #
    # A delete option, but not for the default group!
    #
93 94
    if (! $group->IsProjectGroup() &&
	  $project->AccessCheck($this_user, $TB_PROJECT_DELGROUP)) {
95 96 97 98
	WRITESUBMENUBUTTON("Delete this Group",
			   "deletegroup.php3?pid=$pid&gid=$gid");
    }
    SUBMENUEND();
99 100
}

101 102
$group->Show();
$group->ShowMembers($prived);
103

104
if ($showmenu) {
105 106
    SUBPAGEEND();
}
Leigh B. Stoller's avatar
Leigh B. Stoller committed
107

108 109 110 111 112
# Project wide Templates.
if ($EXPOSETEMPLATES) {
    SHOWTEMPLATELIST("GROUP", 0, $uid, $pid, $gid);
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
113 114 115
#
# A list of Group experiments.
#
116
ShowExperimentList("GROUP", $this_user, $group);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
117

118 119 120 121 122
if ($isadmin) {
    echo "<center>
          <h3>Group Stats</h3>
         </center>\n";

123
    $group->ShowStats();
124 125
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
126 127 128 129 130
#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>