2016-12-12 6 views
0

私は同じサーバー上で2つのWebサイトを稼働させています。最初は独自のクラウドサーバーで、2番目のサイトは最初から構築されています。 2番目のサイトは、現在自分のクラウドアカウントにログインしているユーザーのみがアクセスできますが、私は公共のlibを手に入れようとしています。これまで私が持っていたもの。外部からユーザーのクラウドセッションを検出する

結果は常にそうではありませんが、「ログインしていません」です。 2番目のサイトでユーザーの独自のクラウドセッションを検出するにはどうすればよいですか?

答えて

0

https://github.com/pbek/qownnotesapi/blob/develop/controller/noteapicontroller.phpのようなコメントを追加する必要があります。方法上記のコメントで

/** 
* Returns information about the ownCloud server 
* 
* @NoAdminRequired 
* @NoCSRFRequired 
* @CORS 
* 
* @return string 
*/ 
public function getAppInfo() { 
    $appManager = \OC::$server->getAppManager(); 
    $versionsAppEnabled = $appManager->isEnabledForUser('files_versions'); 
    $trashAppEnabled = $appManager->isEnabledForUser('files_trashbin'); 
    $notesPathExists = false; 
    $notesPath = $this->request->getParam("notes_path", ""); 
    // check if notes path exists 
    if ($notesPath !== "") 
    { 
     $notesPath = "/files" . (string)$notesPath; 
     $view = new \OC\Files\View('/' . $this->user); 
     $notesPathExists = $view->is_dir($notesPath); 
    } 
    return [ 
     "versions_app" => $versionsAppEnabled, 
     "trash_app" => $trashAppEnabled, 
     "versioning" => true, 
     "app_version" => \OC::$server->getConfig()->getAppValue('qownnotesapi', 'installed_version'), 
     "server_version" => \OC::$server->getSystemConfig()->getValue('version'), 
     "notes_path_exists" => $notesPathExists, 
    ]; 
} 

@NoAdminRequired@NoCSRFRequiredセキュリティチェックをオフにします。 (https://doc.owncloud.org/server/9.0/developer_manual/app/tutorial.htmlを参照)

これで簡単な認証でリクエストすると、うまくいくはずです。 例:https://user:[email protected]/path/to/your/controller

私がコメントで追加https://github.com/pbek/QOwnNotes/blob/develop/src/services/owncloudservice.cpp#L322

+0

OwnCloudService::checkAppInfoで例えば – dsol828

+0

は、あなたがポスト/あなたがdsol828 @、両方のサイトで使用しているコードを表示してくださいすることができ、同じ結果を返したことを行います。 –

+0

これは私が持っているすべてのコードです。上に掲示されたコードは外部サイトにあり、私はowncloud9インストールで何も触れていません。 – dsol828

関連する問題