/** * CLAROLINE * * @version 0.1 * * @copyright (c) 2014 Quentin Devos * * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE * * @package OAUTH * * @author Quentin Devos <*****@*****.**> * */ // We load the Autoloader for all the classes of the OAuth library. We can't use the loader included into Claroline, // because there are some dependencies inside the library and so, the loading order is important. From::module('OAUTH')->uses('OAuth2/Autoloader'); OAuth2\Autoloader::register(); // For the same reason, we load the Claroline-specific storage after the Autoloader. This way, all the dependencies are // resolved in the correct order. From::module('OAUTH')->uses('ClarolineStorage'); $storage = new OAuth2\Storage\ClarolineStorage(); // If we need to customize the configuration of the server, we can just do it here. $config = array(); // We can now create the OAuth server with the Claroline-specific Storage class. $server = new OAuth2\Server($storage, $config); // Finally, we define the type of Grant that are allowed by the server. // AuthorizationCode is the base of OAuth 2.0 (three-pass access) $server->addGrantType(new OAuth2\GrantType\AuthorizationCode($storage)); // RefreshToken allows the regeneration of the Access Tokens without re-asking permission from the user. $server->addGrantType(new OAuth2\GrantType\RefreshToken($storage));
/* * Check that the class and method are provided and exist */ if (!isset($_REQUEST['module']) || empty($_REQUEST['module'])) { header('Missing Argument', true, 400); die; } if (!isset($_REQUEST['method']) || empty($_REQUEST['method'])) { header('Missing Argument', true, 400); die; } try { /* * Load the needed lib */ From::module($tlabelReq)->uses('pluginloader.lib'); $pl = new PluginLoader('./plugins/'); if ($class = $pl->load(isset($_REQUEST['forceGeneric']) ? 'GENERIC' : $_REQUEST['module'])) { if (method_exists($class, $_REQUEST['method'])) { $method = $_REQUEST['method']; $args = array(); foreach ($allowedArgs as $allowed) { if (isset($_REQUEST[$allowed])) { $args[$allowed] = $_REQUEST[$allowed]; } } $args['module'] = $_REQUEST['module']; $result = $class->{$method}($args); } else { header('Not Implemented', true, 501); die;
require '../inc/claro_init_global.inc.php'; // Security check if (!claro_is_in_a_course() || !claro_is_course_allowed()) { claro_disp_auth_form(true); } $can_add_single_user = (bool) (claro_is_course_manager() && get_conf('is_coursemanager_allowed_to_enroll_single_user')) || claro_is_platform_admin(); if (!$can_add_single_user) { claro_die(get_lang('Not allowed')); } // include configuration file include claro_get_conf_repository() . 'user_profile.conf.php'; // include libraries require_once get_path('incRepositorySys') . '/lib/user.lib.php'; require_once get_path('incRepositorySys') . '/lib/course_user.lib.php'; require_once get_path('incRepositorySys') . '/lib/sendmail.lib.php'; From::module('CLUSR')->uses('profileselector.lib'); // Initialise variables $nameTools = get_lang('Add a user'); ClaroBreadCrumbs::getInstance()->prepend(get_lang('Users'), 'user.php'); $dialogBox = new DialogBox(); $platformRegSucceed = false; $courseRegSucceed = false; /*===================================================================== MAIN SECTION =====================================================================*/ // Initialise field variable from subscription form $userData = user_initialise(); $cmd = isset($_REQUEST['cmd']) ? $cmd = $_REQUEST['cmd'] : null; if (isset($_REQUEST['applySearch']) && $_REQUEST['applySearch'] != '') { $cmd = 'applySearch'; }