diff options
author | Tom Needham <tom@owncloud.com> | 2012-07-30 16:41:07 +0000 |
---|---|---|
committer | Tom Needham <tom@owncloud.com> | 2012-07-30 16:41:07 +0000 |
commit | 91daf54d7c1ad009843d28a7791e67f4dc37f56d (patch) | |
tree | e0c3f11c6e707e07e256aa03878f62c6c642f5c0 /settings/oauth.php | |
parent | 2f84a8d74627cb20cfae1ac4c004af393b8b07de (diff) | |
download | nextcloud-server-91daf54d7c1ad009843d28a7791e67f4dc37f56d.tar.gz nextcloud-server-91daf54d7c1ad009843d28a7791e67f4dc37f56d.zip |
Check if required apps are installed
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'; |