public static function method_getUser($data, &$status) { if (!isset($data["userid"])) { $status = 400; return ''; } $config = SimpleSAML_Configuration::getConfig('module_janus.php'); $user = new sspmod_janus_User($config->getValue('store')); $user->setUserid($data['userid']); $user->load(sspmod_janus_User::USERID_LOAD); $result = array(); $result['uid'] = $user->getUid(); $result['userid'] = $user->getUserid(); $result['active'] = $user->getActive(); $result['type'] = $user->getType(); $result['data'] = $user->getdata(); return $result; }
/** * Get User information * * @access protected (see isProtected) * @static * @param array $data Request parameters for getUser method, supports: * - string $data['userid']: UserID (login name) to get data for * @param int $statusCode HTTP Status code to use in response * @return array|string User information */ public static function method_getUser($data, &$statusCode) { if (!isset($data["userid"])) { $statusCode = 400; return ''; } $config = sspmod_janus_DiContainer::getInstance()->getConfig(); $user = new sspmod_janus_User(); $user->setUserid($data['userid']); $user->load(sspmod_janus_User::USERID_LOAD); $result = array(); $result['uid'] = $user->getUid(); $result['userid'] = $user->getUserid(); $result['active'] = $user->getActive(); $result['type'] = $user->getType(); $result['data'] = $user->getdata(); return $result; }
// Check if userid exists if (!isset($attributes[$useridattr])) { throw new Exception('User ID is missing'); } $userid = $attributes[$useridattr][0]; } else { $returnURL = $session->getData('string', 'refURL'); if (is_null($returnURL)) { $returnURL = SimpleSAML_Utilities::selfURL(); } else { $session->deleteData('string', 'refURL'); } SimpleSAML_Auth_Default::initLogin($authsource, $returnURL, NULL, $_GET); } $user = new sspmod_janus_User(); $user->setUserid($userid); if (!$user->load(sspmod_janus_User::USERID_LOAD)) { $autocreatenewuser = $janus_config->getValue('user.autocreate', false); if ($autocreatenewuser) { SimpleSAML_Utilities::redirectTrustedUrl(SimpleSAML_Module::getModuleURL('janus/newUser.php'), array('userid' => $userid)); } else { SimpleSAML_Utilities::redirectTrustedUrl(SimpleSAML_Module::getModuleURL('janus/noNewUser.php'), array('userid' => $userid)); } } else { if ($user->getActive() === 'yes') { SimpleSAML_Utilities::redirectTrustedUrl(SimpleSAML_Module::getModuleURL('janus/dashboard.php/entities')); } else { $session->doLogout(); SimpleSAML_Utilities::redirectTrustedUrl(SimpleSAML_Module::getModuleURL('janus/index.php?error=error_index_user_inactive')); } }