/** * **/ public function authorize_action() { global $user, $auth; $auth->login_if($user->id == 'nobody'); $user_id = OAuthUser::getMappedId($user->id); // Fetch the oauth store and the oauth server. $store = OAuthStore::instance(); $server = new OAuthServer(); try { // Check if there is a valid request token in the current request // Returns an array with the consumer key, consumer secret, token, token secret and token type. $rs = $server->authorizeVerify(); if (isset($_POST['allow'])) { // See if the user clicked the 'allow' submit button (or whatever you choose) $authorized = array_key_exists('allow', $_POST); // Set the request token to be authorized or not authorized // When there was a oauth_callback then this will redirect to the consumer $server->authorizeFinish($authorized, $user_id); // No oauth_callback, show the user the result of the authorization // ** your code here ** PageLayout::postMessage(Messagebox::success(_('Sie haben der Applikation Zugriff auf Ihre Daten gewährt.'))); $this->redirect('user#' . $rs['consumer_key']); } } catch (OAuthException $e) { // No token to be verified in the request, show a page where the user can enter the token to be verified // **your code here** die('invalid'); } PageLayout::disableHeader(); $this->set_layout($GLOBALS['template_factory']->open('layouts/base_without_infobox')); $this->rs = $rs; }
/** * **/ public function authorize_action() { global $user, $auth; $auth_plugin = Config::get()->API_OAUTH_AUTH_PLUGIN; if ($GLOBALS['user']->id === 'nobody' && $auth_plugin !== 'Standard' && !Request::option('sso')) { $params = $_GET; $params['sso'] = $auth_plugin; $this->redirect($this->url_for('api/oauth/authorize?' . http_build_query($params))); return; } else { $auth->login_if($user->id === 'nobody'); } $user_id = RESTAPI\Consumer\OAuth::getOAuthId($GLOBALS['user']->id); try { $consumer = RESTAPI\Consumer\Base::detectConsumer('oauth', 'request'); if (Request::submitted('allow')) { $result = $consumer->grantAccess($GLOBALS['user']->id); $redirect_uri = Request::get('oauth_callback', $consumer->callback); if ($redirect_uri) { $this->redirect($redirect_uri); } else { // No oauth_callback, show the user the result of the authorization // ** your code here ** PageLayout::postMessage(MessageBox::success(_('Sie haben der Applikation Zugriff auf Ihre Daten gewährt.'))); $this->redirect('api/authorizations#' . $consumer->auth_key); } return; } } catch (OAuthException $e) { // No token to be verified in the request, show a page where the user can enter the token to be verified // **your code here** die('invalid'); } PageLayout::disableHeader(); PageLayout::setTitle(sprintf(_('"%s" bittet um Zugriff'), $consumer->title)); $this->set_layout($GLOBALS['template_factory']->open('layouts/base.php')); $this->consumer = $consumer; $this->token = Request::option('oauth_token'); $this->oauth_callback = Request::get('oauth_callback'); }
/***************************************************************************** Seite abschliessen und Infofenster aufbauen /*****************************************************************************/ ?> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <? if ($quick_view_mode === 'no_nav' || Request::get('print_view')) { PageLayout::disableHeader(); } if (Request::get('print_view')){ PageLayout::removeStylesheet('style.css'); PageLayout::addStylesheet('print.css'); // use special stylesheet for printing } Sidebar::get()->setImage('sidebar/resources-sidebar.png'); // Add clipboard if neccessary (another hack meets the core) if (is_object($clipObj)) { $form = $clipObj->getFormObject(); $action = $quick_view ? URLHelper::getLink('', compact('quick_view', 'quick_view_mode')) : URLHelper::getLink('', compact('view', 'quick_view_mode'));