Пример #1
0
     if (!company::check_canedit_user($companyid, $user->id)) {
         print_error('invaliduserid');
     }
     if (is_primary_admin($user->id)) {
         print_error('nopermissions', 'error', '', 'delete the primary admin user');
     }
     if ($confirm != md5($unsuspend)) {
         $fullname = fullname($user, true);
         echo $OUTPUT->heading(get_string('unsuspenduser', 'block_iomad_company_admin') . " " . $fullname);
         $optionsyes = array('unsuspend' => $unsuspend, 'confirm' => md5($unsuspend), 'sesskey' => sesskey());
         echo $OUTPUT->confirm(get_string('unsuspendcheckfull', 'block_iomad_company_admin', "'{$fullname}'"), new moodle_url('editusers.php', $optionsyes), 'editusers.php');
         echo $OUTPUT->footer();
         die;
     } else {
         // Actually unsuspend the user.
         company_user::unsuspend($user->id);
     }
 } else {
     if ($acl and confirm_sesskey()) {
         if (!iomad::has_capability('block/iomad_company_admin:editusers', $systemcontext)) {
             // TODO: this should be under a separate capability.
             print_error('nopermissions', 'error', '', 'modify the NMET access control list');
         }
         if (!($user = $DB->get_record('user', array('id' => $acl)))) {
             print_error('nousers', 'error');
         }
         if (!is_mnet_remote_user($user)) {
             print_error('usermustbemnet', 'error');
         }
         $accessctrl = strtolower(required_param('accessctrl', PARAM_ALPHA));
         if ($accessctrl != 'allow' and $accessctrl != 'deny') {