Check if required apps are installed

remotes/origin/stable5
Tom Needham 13 years ago
parent 2f84a8d746
commit 91daf54d7c
  1. 4
      settings/css/oauth.css
  2. 33
      settings/oauth.php
  3. 19
      settings/templates/oauth-required-apps.php
  4. 6
      settings/templates/oauth.php

@ -1,2 +1,4 @@
.guest-container{ width:35%; margin: 2em auto 0 auto; }
#oauth-request button{ float: right; }
#oauth-request a.button{ float: right; }
#oauth-request ul li{ list-style: disc; }
#oauth-request ul { margin-left: 2em; margin-top: 1em; }

@ -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';

@ -0,0 +1,19 @@
<?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 @@
*/
?>
<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>
<?php
// Foreach requested scope
@ -15,6 +15,6 @@
}
?>
</ul>
<button>Allow</button>
<button>Disallow</button>
<a href="#" class="button">Allow</a>
<a href="#" class="button">Disallow</a>
</div>

Loading…
Cancel
Save