当前位置: 首页>>代码示例>>PHP>>正文


PHP webservice::delete_user_ws_token方法代码示例

本文整理汇总了PHP中webservice::delete_user_ws_token方法的典型用法代码示例。如果您正苦于以下问题:PHP webservice::delete_user_ws_token方法的具体用法?PHP webservice::delete_user_ws_token怎么用?PHP webservice::delete_user_ws_token使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在webservice的用法示例。


在下文中一共展示了webservice::delete_user_ws_token方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: redirect

            }
        }
        //OUTPUT: create token form
        echo $OUTPUT->header();
        echo $OUTPUT->heading(get_string('createtoken', 'webservice'));
        if (!empty($errormsg)) {
            echo $errormsg;
        }
        $mform->display();
        echo $OUTPUT->footer();
        die;
        break;
    case 'delete':
        $token = $webservicemanager->get_created_by_user_ws_token($USER->id, $tokenid);
        //Delete the token
        if ($confirm and confirm_sesskey()) {
            $webservicemanager->delete_user_ws_token($token->id);
            redirect($tokenlisturl);
        }
        ////OUTPUT: display delete token confirmation box
        echo $OUTPUT->header();
        $renderer = $PAGE->get_renderer('core', 'webservice');
        echo $renderer->admin_delete_token_confirmation($token);
        echo $OUTPUT->footer();
        die;
        break;
    default:
        //wrong url access
        redirect($tokenlisturl);
        break;
}
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:31,代码来源:tokens.php

示例2: array

        $params = array();
        $serverurl = HUB_HUBDIRECTORYURL . "/local/hubdirectory/webservice/webservices.php";
        require_once $CFG->dirroot . "/webservice/xmlrpc/lib.php";
        $xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hubtodirectorycommunication->token);
        try {
            $result = $xmlrpcclient->call($function, $params);
        } catch (Exception $e) {
            $error = get_string('errorunregistration', 'local_hub', $e->getMessage());
        }
    }
    if (empty($error)) {
        if (!empty($directorytohubcommunication)) {
            //delete the web service token
            $webservice_manager = new webservice();
            $tokentodelete = $webservice_manager->get_user_ws_token($directorytohubcommunication->token);
            $webservice_manager->delete_user_ws_token($tokentodelete->id);
            //delete the communication
            $hub->delete_communication($directorytohubcommunication);
        }
        if (!empty($hubtodirectorycommunication)) {
            $hub->delete_communication($hubtodirectorycommunication);
        }
    }
    redirect(new moodle_url('/local/hub/admin/register.php', array('sesskey' => sesskey(), 'error' => $error)));
}
/////// UPDATE ACTION ////////
// update the hub registration (in fact it is a new registration)
$update = optional_param('update', 0, PARAM_INT);
if ($update && confirm_sesskey()) {
    //update the registration
    $function = 'hubdirectory_update_hub_info';
开发者ID:scyrma,项目名称:moodle-local_hub,代码行数:31,代码来源:register.php

示例3: webservice

if (!is_siteadmin($USER->id) && !empty($CFG->enablewebservices) && has_capability('moodle/webservice:createtoken', $usercontext)) {
    require $CFG->dirroot . '/webservice/lib.php';
    $action = optional_param('action', '', PARAM_ALPHANUMEXT);
    $tokenid = optional_param('tokenid', '', PARAM_SAFEDIR);
    $confirm = optional_param('confirm', 0, PARAM_BOOL);
    $webservice = new webservice();
    // Load the webservice library.
    $wsrenderer = $PAGE->get_renderer('core', 'webservice');
    if ($action == 'resetwstoken') {
        $token = $webservice->get_created_by_user_ws_token($USER->id, $tokenid);
        // Display confirmation page to Reset the token.
        if (!$confirm) {
            $resetconfirmation = $wsrenderer->user_reset_token_confirmation($token);
        } else {
            // Delete the token that need to be regenerated.
            $webservice->delete_user_ws_token($tokenid);
        }
    }
    // No point creating the table is we're just displaying a confirmation screen.
    if (empty($resetconfirmation)) {
        $webservice->generate_user_ws_tokens($USER->id);
        // Generate all token that need to be generated.
        $tokens = $webservice->get_user_ws_tokens($USER->id);
        foreach ($tokens as $token) {
            if ($token->restrictedusers) {
                $authlist = $webservice->get_ws_authorised_user($token->wsid, $USER->id);
                if (empty($authlist)) {
                    $token->enabled = false;
                }
            }
        }
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:managetoken.php

示例4: webservice

 function delete_site($id, $unregistercourses = false)
 {
     global $CFG;
     require_once $CFG->dirroot . '/local/hub/locallib.php';
     $sitetodelete = $this->get_site($id);
     //unregister the courses first
     if (!empty($unregistercourses)) {
         $this->delete_courses($sitetodelete->id);
     }
     $sitetohubcommunication = $this->get_communication(WSSERVER, REGISTEREDSITE, $sitetodelete->url);
     if (!empty($sitetohubcommunication)) {
         //delete the token for this site
         require_once $CFG->dirroot . '/webservice/lib.php';
         $webservice_manager = new webservice();
         $tokentodelete = $webservice_manager->get_user_ws_token($sitetohubcommunication->token);
         $webservice_manager->delete_user_ws_token($tokentodelete->id);
         //delete the communications to this hub
         $this->delete_communication($sitetohubcommunication);
     }
     // Send email to the site administrator.
     $contactuser = local_hub_create_contact_user($sitetodelete->contactemail ? $sitetodelete->contactemail : $CFG->noreplyaddress, $sitetodelete->contactname ? $sitetodelete->contactname : get_string('noreplyname'));
     $emailinfo = new stdClass();
     $hubinfo = $this->get_info();
     $emailinfo->hubname = $hubinfo['name'];
     $emailinfo->huburl = $hubinfo['url'];
     $emailinfo->sitename = $sitetodelete->name;
     $emailinfo->siteurl = $sitetodelete->url;
     $emailinfo->unregisterpagelink = $sitetodelete->url . '/admin/registration/index.php?huburl=' . $hubinfo['url'] . '&force=1&unregistration=1';
     email_to_user($contactuser, get_admin(), get_string('emailtitlesitedeleted', 'local_hub', $emailinfo), get_string('emailmessagesitedeleted', 'local_hub', $emailinfo));
     $this->unregister_site($sitetodelete);
 }
开发者ID:k-holland,项目名称:moodle-local_hub,代码行数:31,代码来源:lib.php

示例5: unregister_site

 /**
  * Unregister site
  * @return bool 1 if unregistration was successfull
  */
 public static function unregister_site()
 {
     global $DB, $CFG;
     // Ensure the current user is allowed to run this function
     $context = context_system::instance();
     self::validate_context($context);
     require_capability('local/hub:updateinfo', $context);
     //clean params
     $params = self::validate_parameters(self::unregister_site_parameters(), array());
     //retieve the site communication
     $token = optional_param('wstoken', '', PARAM_ALPHANUM);
     $hub = new local_hub();
     $communication = $hub->get_communication(WSSERVER, REGISTEREDSITE, null, $token);
     //retrieve the site
     $siteurl = $communication->remoteurl;
     $site = $hub->get_site_by_url($siteurl);
     //unregister the site
     if (!empty($site)) {
         $hub->unregister_site($site);
     }
     //delete the web service token
     require_once $CFG->dirroot . '/webservice/lib.php';
     $webservice_manager = new webservice();
     $tokentodelete = $webservice_manager->get_user_ws_token($communication->token);
     $webservice_manager->delete_user_ws_token($tokentodelete->id);
     //delete the site communication
     $hub->delete_communication($communication);
     return true;
 }
开发者ID:scyrma,项目名称:moodle-local_hub,代码行数:33,代码来源:externallib.php


注:本文中的webservice::delete_user_ws_token方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。