Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 38 lines (30 sloc) 1.026 kb
<?php
/**
* Add a new user to a group.
*
* @since 8/28/09
* @package
*
* @copyright Copyright &copy; 2009, Middlebury College
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
*/
if (!isset($_POST['group_id']) || !$_POST['group_id'])
throw new InvalidArgumentException("No group_id passed");
$groupId = base64_decode_fix($_POST['group_id'], true);
if (!$groupId)
throw new InvalidArgumentException("Invalid group_id passed");
// Verify that the current user really can manage the group.
$groups = $ldap->read('(objectclass=group)', $groupId, array('managedby', 'member'));
if (count($groups) != 1)
throw new Exception("Could not find the group specified");
$group = $groups[0];
if ($group['managedby'][0] != $_SESSION['user_dn'])
throw new PermissionDeniedException("You are not authorized to manage this group.");
// Delete the group
$ldap->delete($groupId);
while(ob_get_level())
ob_end_clean();
header('Content-Type: text/plain');
notify($groupId);
print "Success";
exit;
Jump to Line
Something went wrong with that request. Please try again.