X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fcommon%2Factions.php;fp=planetlab%2Fcommon%2Factions.php;h=66d6c0ae5ac63d853079947211f5b173badf474a;hb=c410670fb3c8027ceb0f111e1a3242335b4fd2f5;hp=ae98281d0a4998c58ca82922d7990e76e288cce2;hpb=c75673b4b6262e2c4370c862911dc1ecbf8291c8;p=plewww.git diff --git a/planetlab/common/actions.php b/planetlab/common/actions.php index ae98281..66d6c0a 100644 --- a/planetlab/common/actions.php +++ b/planetlab/common/actions.php @@ -167,19 +167,23 @@ switch ($action) { case 'remove-roles-from-person' : { $role_ids=$_POST['role_ids']; if ( ! $role_ids) { - drupal_set_message("action=$action - No role selected"); - return; - } - foreach( $role_ids as $role_id) { - $api->DeleteRoleFromPerson( intval( $role_id ), intval( $person_id ) ); + drupal_set_error("You have not selected role(s) to remove"); + } else { + foreach( $role_ids as $role_id) + if ( $api->DeleteRoleFromPerson( intval( $role_id ), intval( $person_id ) ) != 1 ) + drupal_set_error ("Could not remove role $role_id from person $person_id"); } - plc_redirect (l_person($person_id)); + plc_redirect (l_person_roles($person_id)); } case 'add-role-to-person' : { $role_id=$_POST['role_id']; - $api->AddRoleToPerson( intval( $role_id ), intval( $person_id ) ); - plc_redirect (l_person($person_id)); + if ( ! $role_id) { + drupal_set_error ("You have not selected a role to add"); + } else if ($api->AddRoleToPerson( intval( $role_id ), intval( $person_id ) ) != 1) { + drupal_set_error("Could not add role $role_id to person $person_id"); + } + plc_redirect (l_person_roles($person_id)); } case 'enable-person' : {