<?php
/*
* ConPortal - Pomona College ITS scheduling appplication
* Copyright (C) 2005-2006 Pomona College
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License
* as published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once('standard.php');
if (!isset($_GET['group']) || !intval($_GET['group'])) {
header("Location: " . BASE_URL . "permissions.php");
exit;
}
xhtml_header_privileged("Modifying Permissions", 'manage_perms');
$group = intval($_GET['group']);
$info = getGroupDetails($group);
?>
<div class='center'>
<h1><?= $info['description'] ?></h1>
<p>On this page, you can change the users who are in this group as well as what
permissions this group has.
<br />Click 'Modify...' to apply your changes when you're done.</p>
<form method='post' action='redirects/perms_modify.php' onsubmit='selectAll()'>
<div>
<input type='hidden' name='group' value='<?=$group?>' />
<h3>Permissions</h3>
<?
$perms = getPermissionsForGroup($group);
$all = getPermissions();
if (!$all) {
?>
<p class='warn'>There are no permissions defined.
<a href='perm_add.php'>Add perms</a></p>
<?
} else {
$other_perms = array_diff($all, $perms);
draw_dual_selects('perms', $other_perms, $perms,
'getPermissionDetails', 'sortPermissionsByName');
}
?>
<hr style='margin: 1em 0px' />
<h3>Users</h3>
<?
if ($info['primary_group']) {
?>
<p class='note'>You cannot use this interface to modify the set of
users for a primary group. You must edit each user's primary group
individually through the 'Manage Users' interface.</p>
<?
} else {
$users = getUsersForSecurityGroup($group);
$all = getUsers();
if (!$all) {
?>
<p class='warn'>There are no users defined.
<a href='register_users.php'>Add users</a>
</p>
<?
} else {
$other_users = array_diff($all, $users);
draw_dual_selects('users', $other_users, $users,
'getUserDetails', 'sortUsersByName');
}
}
?>
<br />
<input type='submit' name='mod_group' value='Modify...' />
<button onclick='javascript:window.history.back(); return false;'>Go back a page
</button>
</div>
</form>
</div>
<?
xhtml_footer();
?>