public function authUser($accessToken)
 {
     list($appAccessToken, $dropboxUserId) = $webAuth->finish($accessTokenFromUser);
     $dropboxUserAccess = DropboxUserAccess::findByAttributes(['user_id' => Yii::$app->components->user->id]);
     $dropboxUserAccess->appAccessToken = $appAccessToken;
     $dropboxUserAccess->dropboxUserId = $dropboxUserId;
     return $dropboxUserAccess->save();
 }
 public function __construct($initUserInYiiApp = false)
 {
     parent::__construct(true);
     $dropboxUserAccess = DropboxUserAccess::findByAttributes(['user_id' => $this->user->id]);
     if (!$dropboxUserAccess) {
         $dropboxUserAccess = new DropboxUserAccess();
         $dropboxUserAccess->setAttributes(['user_id' => $this->user->id, 'access_token' => self::TEST_USER_ACCESS_TOKEN, 'dropbox_user_id' => self::TEST_USER_ID]);
         $dropboxUserAccess->save();
         $dropboxUserAccess = DropboxUserAccess::findByAttributes(['user_id' => $this->user->id]);
     }
     $this->dropboxUserAccess = $dropboxUserAccess;
 }