diff options
Diffstat (limited to 'settings/oauth.php')
-rw-r--r-- | settings/oauth.php | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/settings/oauth.php b/settings/oauth.php index 5fe21940b04..2592b926d17 100644 --- a/settings/oauth.php +++ b/settings/oauth.php @@ -23,13 +23,36 @@ switch($operation){ // Example $consumer = array( 'name' => 'Firefox Bookmark Sync', - 'scopes' => array('bookmarks'), + 'scopes' => array('ookmarks'), ); - $t = new OC_Template('settings', 'oauth', 'guest'); - OC_Util::addStyle('settings', 'oauth'); - $t->assign('consumer', $consumer); - $t->printPage(); + // Check that the scopes are real and installed + $apps = OC_App::getEnabledApps(); + $notfound = array(); + foreach($consumer['scopes'] as $requiredapp){ + if(!in_array($requiredapp, $apps)){ + $notfound[] = $requiredapp; + } + } + if(!empty($notfound)){ + // We need more apps :( Show error + if(count($notfound)==1){ + $message = 'requires that you have an extra app installed on your ownCloud. Please contact your ownCloud administrator and ask them to install the app below.'; + } else { + $message = 'requires that you have some extra apps installed on your ownCloud. Please contract your ownCloud administrator and ask them to install the apps below.'; + } + $t = new OC_Template('settings', 'oauth-required-apps', 'guest'); + OC_Util::addStyle('settings', 'oauth'); + $t->assign('requiredapps', $notfound); + $t->assign('consumer', $consumer); + $t->assign('message', $message); + $t->printPage(); + } else { + $t = new OC_Template('settings', 'oauth', 'guest'); + OC_Util::addStyle('settings', 'oauth'); + $t->assign('consumer', $consumer); + $t->printPage(); + } break; case 'access_token'; |