Skip to content
Snippets Groups Projects
Commit 91daf54d authored by Tom Needham's avatar Tom Needham
Browse files

Check if required apps are installed

parent 2f84a8d7
Branches
No related tags found
No related merge requests found
.guest-container{ width:35%; margin: 2em auto 0 auto; } .guest-container{ width:35%; margin: 2em auto 0 auto; }
#oauth-request button{ float: right; } #oauth-request a.button{ float: right; }
\ No newline at end of file #oauth-request ul li{ list-style: disc; }
#oauth-request ul { margin-left: 2em; margin-top: 1em; }
...@@ -23,13 +23,36 @@ switch($operation){ ...@@ -23,13 +23,36 @@ switch($operation){
// Example // Example
$consumer = array( $consumer = array(
'name' => 'Firefox Bookmark Sync', 'name' => 'Firefox Bookmark Sync',
'scopes' => array('bookmarks'), 'scopes' => array('ookmarks'),
); );
// 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'); $t = new OC_Template('settings', 'oauth', 'guest');
OC_Util::addStyle('settings', 'oauth'); OC_Util::addStyle('settings', 'oauth');
$t->assign('consumer', $consumer); $t->assign('consumer', $consumer);
$t->printPage(); $t->printPage();
}
break; break;
case 'access_token'; case 'access_token';
......
<?php
/**
* Copyright (c) 2012, Tom Needham <tom@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
*/
?>
<div id="oauth-request" class="guest-container">
<p><strong><?php echo $_['consumer']['name'].'</strong> '.$_['message']; ?></p>
<ul>
<?php
// Foreach requested scope
foreach($_['requiredapps'] as $requiredapp){
echo '<li>'.$requiredapp.'</li>';
}
?>
</ul>
<a href="<?php echo OC::$WEBROOT; ?>" id="back-home" class="button">Back to ownCloud</a>
</div>
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
?> ?>
<div id="oauth-request" class="guest-container"> <div id="oauth-request" class="guest-container">
<p><strong><?php echo $_['consumer']['name']; ?></strong> is requesting permission to read, write, modify and delete data from the following apps:</p> <p><strong><?php echo $_['consumer']['name']; ?></strong> is requesting your permission to read, write, modify and delete data from the following apps:</p>
<ul> <ul>
<?php <?php
// Foreach requested scope // Foreach requested scope
...@@ -15,6 +15,6 @@ ...@@ -15,6 +15,6 @@
} }
?> ?>
</ul> </ul>
<button>Allow</button> <a href="#" class="button">Allow</a>
<button>Disallow</button> <a href="#" class="button">Disallow</a>
</div> </div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment