Skip to content

Commit

Permalink
Merge pull request #22468 from owncloud/files_external-global
Browse files Browse the repository at this point in the history
remove global credentials
  • Loading branch information
DeepDiver1975 committed Feb 17, 2016
2 parents 904db15 + c2c6cae commit add696b
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 272 deletions.
1 change: 0 additions & 1 deletion apps/files_external/appinfo/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ protected function loadAuthMechanisms() {
// AuthMechanism::SCHEME_PASSWORD mechanisms
$container->query('OCA\Files_External\Lib\Auth\Password\Password'),
$container->query('OCA\Files_External\Lib\Auth\Password\SessionCredentials'),
$container->query('OCA\Files_External\Lib\Auth\Password\GlobalAuth'),

// AuthMechanism::SCHEME_OAUTH1 mechanisms
$container->query('OCA\Files_External\Lib\Auth\OAuth1\OAuth1'),
Expand Down
7 changes: 1 addition & 6 deletions apps/files_external/appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,7 @@
'url' => '/ajax/public_key.php',
'verb' => 'POST',
'requirements' => array()
),
[
'name' => 'Ajax#saveGlobalCredentials',
'url' => '/globalcredentials',
'verb' => 'POST'
]
)
)
)
);
Expand Down
11 changes: 1 addition & 10 deletions apps/files_external/controller/ajaxcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

namespace OCA\Files_External\Controller;

use OCA\Files_External\Lib\Auth\Password\GlobalAuth;
use OCP\AppFramework\Controller;
use OCP\IRequest;
use OCP\AppFramework\Http\JSONResponse;
Expand All @@ -32,13 +31,10 @@
class AjaxController extends Controller {
/** @var RSA */
private $rsaMechanism;
/** @var GlobalAuth */
private $globalAuth;

public function __construct($appName, IRequest $request, RSA $rsaMechanism, GlobalAuth $globalAuth) {
public function __construct($appName, IRequest $request, RSA $rsaMechanism) {
parent::__construct($appName, $request);
$this->rsaMechanism = $rsaMechanism;
$this->globalAuth = $globalAuth;
}

private function generateSshKeys() {
Expand All @@ -64,9 +60,4 @@ public function getSshKeys() {
'status' => 'success'
));
}

public function saveGlobalCredentials($uid, $user, $password) {
$this->globalAuth->saveAuth($uid, $user, $password);
return true;
}
}
27 changes: 0 additions & 27 deletions apps/files_external/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1338,33 +1338,6 @@ $(document).ready(function() {
}
});

$('#global_credentials').on('submit', function() {
var $form = $(this);
var uid = $form.find('[name=uid]').val();
var user = $form.find('[name=username]').val();
var password = $form.find('[name=password]').val();
var $submit = $form.find('[type=submit]');
$submit.val(t('files_external', 'Saving...'));
$.ajax({
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({
uid: uid,
user: user,
password: password
}),
url: OC.generateUrl('apps/files_external/globalcredentials'),
dataType: 'json',
success: function() {
$submit.val(t('files_external', 'Saved'));
setTimeout(function(){
$submit.val(t('files_external', 'Save'));
}, 2500);
}
});
return false;
});

// global instance
OCA.External.Settings.mountConfig = mountConfigListView;

Expand Down
88 changes: 0 additions & 88 deletions apps/files_external/lib/auth/password/globalauth.php

This file was deleted.

4 changes: 0 additions & 4 deletions apps/files_external/personal.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
$appContainer = \OC_Mount_Config::$app->getContainer();
$backendService = $appContainer->query('OCA\Files_External\Service\BackendService');
$userStoragesService = $appContainer->query('OCA\Files_external\Service\UserStoragesService');
$globalAuth = $appContainer->query('OCA\Files_External\Lib\Auth\Password\GlobalAuth');

$tmpl = new OCP\Template('files_external', 'settings');
$tmpl->assign('encryptionEnabled', \OC::$server->getEncryptionManager()->isEnabled());
Expand All @@ -39,7 +38,4 @@
$tmpl->assign('dependencies', OC_Mount_Config::dependencyMessage($backendService->getBackends()));
$tmpl->assign('backends', $backendService->getAvailableBackends());
$tmpl->assign('authMechanisms', $backendService->getAuthMechanisms());
$uid = \OC::$server->getUserSession()->getUser()->getUID();
$tmpl->assign('globalCredentials', $globalAuth->getAuth($uid));
$tmpl->assign('globalCredentialsUid', $uid);
return $tmpl->fetchPage();
3 changes: 0 additions & 3 deletions apps/files_external/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
$appContainer = \OC_Mount_Config::$app->getContainer();
$backendService = $appContainer->query('OCA\Files_External\Service\BackendService');
$globalStoragesService = $appContainer->query('OCA\Files_external\Service\GlobalStoragesService');
$globalAuth = $appContainer->query('OCA\Files_External\Lib\Auth\Password\GlobalAuth');

\OC_Util::addVendorScript('select2/select2');
\OC_Util::addVendorStyle('select2/select2');
Expand All @@ -46,6 +45,4 @@
$tmpl->assign('dependencies', OC_Mount_Config::dependencyMessage($backendService->getBackends()));
$tmpl->assign('allowUserMounting', $backendService->isUserMountingAllowed());
$tmpl->assign('allowUserMounting', $backendService->isUserMountingAllowed());
$tmpl->assign('globalCredentials', $globalAuth->getAuth(''));
$tmpl->assign('globalCredentialsUid', '');
return $tmpl->fetchPage();
17 changes: 1 addition & 16 deletions apps/files_external/templates/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,8 @@ function writeParameterInput($parameter, $options, $classes = []) {
}
}
?>
<form autocomplete="false" class="section" action="#"
id="global_credentials">
<h2><?php p($l->t('External Storage')); ?></h2>
<p><?php p($l->t('Global Credentials')); ?></p>
<input type="text" name="username"
autocomplete="false"
value="<?php p($_['globalCredentials']['user']); ?>"
placeholder="<?php p($l->t('Username')) ?>"/>
<input type="password" name="password"
autocomplete="false"
value="<?php p($_['globalCredentials']['password']); ?>"
placeholder="<?php p($l->t('Password')) ?>"/>
<input type="hidden" name="uid"
value="<?php p($_['globalCredentialsUid']); ?>"/>
<input type="submit" value="<?php p($l->t('Save')) ?>"/>
</form>
<form id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>">
<h2><?php p($l->t('External Storage')); ?></h2>
<?php if (isset($_['dependencies']) and ($_['dependencies']<>'')) print_unescaped(''.$_['dependencies'].''); ?>
<table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'>
<thead>
Expand Down
117 changes: 0 additions & 117 deletions apps/files_external/tests/auth/password/globalauth.php

This file was deleted.

0 comments on commit add696b

Please sign in to comment.