showgroup.php3 3.05 KB
Newer Older
Leigh Stoller's avatar
Leigh Stoller committed
1
<?php
Leigh Stoller's avatar
Leigh Stoller committed
2
#
3
# Copyright (c) 2000-2017 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 Stoller's avatar
Leigh Stoller committed
23
#
Leigh Stoller's avatar
Leigh Stoller committed
24
include("defs.php3");
25
include_once("template_defs.php");
Leigh Stoller's avatar
Leigh 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 Stoller's avatar
Leigh Stoller committed
36
#
37 38 39
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();
Leigh Stoller's avatar
Leigh Stoller committed
40 41

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

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

Leigh Stoller's avatar
Leigh 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 Stoller's avatar
Leigh Stoller committed
64 65
}

66
#
67
# This menu only makes sense for people with privs to use them.
68
#
69 70 71
$showmenu = ($group->AccessCheck($this_user, $TB_PROJECT_EDITGROUP) ||
	     (! $group->IsProjectGroup() &&
	      $project->AccessCheck($this_user, $TB_PROJECT_DELGROUP)));
72

73
if ($showmenu) {
74 75 76
    SUBPAGESTART();
    SUBMENUSTART("Group Options");

77
    if ($group->AccessCheck($this_user, $TB_PROJECT_EDITGROUP)) {
78
	WRITESUBMENUBUTTON("Edit this Group",
79
			   "editgroup.php3?pid=$pid&gid=$gid");
80 81 82 83 84
    }

    #
    # A delete option, but not for the default group!
    #
85 86
    if (! $group->IsProjectGroup() &&
	  $project->AccessCheck($this_user, $TB_PROJECT_DELGROUP)) {
87 88 89 90
	WRITESUBMENUBUTTON("Delete this Group",
			   "deletegroup.php3?pid=$pid&gid=$gid");
    }
    SUBMENUEND();
91 92
}

93
$group->Show();
94
$group->ShowMembers($this_user);
95

96
if ($showmenu) {
97 98
    SUBPAGEEND();
}
Leigh Stoller's avatar
Leigh Stoller committed
99

100 101 102 103 104
# Project wide Templates.
if ($EXPOSETEMPLATES) {
    SHOWTEMPLATELIST("GROUP", 0, $uid, $pid, $gid);
}

Leigh Stoller's avatar
Leigh Stoller committed
105 106 107
#
# A list of Group experiments.
#
108
ShowExperimentList("GROUP", $this_user, $group);
Leigh Stoller's avatar
Leigh Stoller committed
109

110 111 112 113 114
if ($isadmin) {
    echo "<center>
          <h3>Group Stats</h3>
         </center>\n";

115
    $group->ShowStats();
116 117
}

Leigh Stoller's avatar
Leigh Stoller committed
118 119 120 121 122
#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>