Allow admin or superuser to uninvite students from any school

This commit is contained in:
james 2011-03-08 17:46:25 +00:00
parent 43283059ae
commit ae8ec49388
2 changed files with 14 additions and 3 deletions

View File

@ -81,7 +81,12 @@
//this is ajax too, but we dont explicitly say AJAX==1, thats silly :p //this is ajax too, but we dont explicitly say AJAX==1, thats silly :p
if($_POST['action']=="uninvite") { if($_POST['action']=="uninvite") {
if($_POST['userid']) { if($_POST['userid']) {
user_uninvite(intval($_POST['userid']),$type); echo "uninviting userid: ".$_POST['userid']." from type: ".$type."\n";
$r=user_uninvite(intval($_POST['userid']),$type);
//this will return the user object if valid, if its just a string, then its an error string
if(!is_array($r)) {
echo "error: $r";
}
} }
exit; exit;
} }
@ -157,6 +162,7 @@
function uninvite(id) { function uninvite(id) {
if(confirmClick('Are you sure you want to uninvite this participant?')) { if(confirmClick('Are you sure you want to uninvite this participant?')) {
$.post("participant_invite.php",{action: 'uninvite', userid: id},function() { $.post("participant_invite.php",{action: 'uninvite', userid: id},function() {
// alert('done');
document.location.href='participant_invite.php'; document.location.href='participant_invite.php';
}); });
} }

View File

@ -1807,10 +1807,15 @@ function user_uninvite($uid, $roles_id){
} }
if($returnval == null){ if($returnval == null){
if($_SESSION['superuser']=="yes" || array_key_exists('admin',$u['roles'])) {
//superuser or admin, let them do it
} else {
//else, the school must match
if($user['schools_id'] != $u['schools_id']){ if($user['schools_id'] != $u['schools_id']){
$returnval = 'You can not uninvite students form other schools'; $returnval = 'You can not uninvite students form other schools';
} }
} }
}
if($returnval == null){ if($returnval == null){
// ok, looks like all of the data checks out. Let's remove this user's role // ok, looks like all of the data checks out. Let's remove this user's role