public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) { global $USER; parent::__construct($repositoryid, $context, $options); // TODO: I wish there was somewhere we could explicitly put this outside of constructor.. $googletoken = optional_param('token', false, PARAM_RAW); if($googletoken){ $gauth = new google_authsub(false, $googletoken); // will throw exception if fails google_docs::set_sesskey($gauth->get_sessiontoken(), $USER->id); } $this->check_login(); }
public function post_control($stage, $params) { if ($stage != PORTFOLIO_STAGE_CONFIG) { return; } if (!array_key_exists('token', $params)) { throw new portfolio_plugin_exception('noauthtoken', 'portfolio_googledocs'); } // we now have our auth token, get a session token.. $gauth = new google_authsub(false, $params['token']); $this->sessiontoken = $gauth->get_sessiontoken(); google_docs::set_sesskey($this->sessiontoken, $this->get('user')->id); }