Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/files_external/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<id>files_external</id>
<name>External storage support</name>
<description>
This application enables administrators to configure connections to external storage providers, such as FTP servers, S3 or SWIFT object stores, Google Drive, Dropbox, other ownCloud servers, WebDAV servers, and more. Administrators can choose which types of storage to enable and can mount these storage locations for a user, a group, or the entire system. Users will see a new folder appear in their root ownCloud directory, which they can access and use like any other ownCloud folder. External Storage also allows users to share files stored in these external locations. In these cases, the credentials for the owner of the file are used when the recipient requests the file from external storage, thereby ensuring that the recipient can access the shared file.
This application enables administrators to configure connections to external storage providers, such as FTP servers, S3 or SWIFT object stores, Google Drive, Dropbox, other ownCloud servers, WebDAV servers, and more. Administrators can choose which types of storage to enable and can mount these storage locations for a user, a group, or the entire system. Users will see a new folder appear in their root ownCloud directory, which they can access and use like any other ownCloud folder. External storage also allows users to share files stored in these external locations. In these cases, the credentials for the owner of the file are used when the recipient requests the file from external storage, thereby ensuring that the recipient can access the shared file.

External Storage can be configured using the GUI or at the command line. This second option provides the advanced user with more flexibility for configuring bulk external storage mounts and setting mount priorities. More information is available in the External Storage GUI documentation and the External Storage Configuration File documentation.
External storage can be configured using the GUI or at the command line. This second option provides the advanced user with more flexibility for configuring bulk external storage mounts and setting mount priorities. More information is available in the external storage GUI documentation and the external storage Configuration File documentation.
</description>
<licence>AGPL</licence>
<author>Robin Appelman, Michael Gapczynski, Vincent Petry</author>
Expand Down
13 changes: 13 additions & 0 deletions apps/files_external/css/settings.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
#global_credentials {
padding: 0 30px;
margin-bottom: 0px;
}

#files_external {
margin-bottom: 0px;
}

#externalStorage {
margin: 15px 0 20px 0;
}

#externalStorage td.status {
/* overwrite conflicting core styles */
display: table-cell;
Expand Down
5 changes: 5 additions & 0 deletions apps/files_external/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,11 @@ MountConfigListView.prototype = _.extend({
$tr.find('.configuration').text(t('files_external', 'Admin defined'));
}
});
var mainForm = $('#files_external');
if (result.length === 0 && mainForm.attr('data-can-create') === 'false') {
mainForm.hide();
$('a[href="#external-storage"]').parent().hide();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works but is a little bit ugly because the time that loading takes is around 0.5 seconds here and then the navigation bar on the left magically removes one item.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not much we can easily do about it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a idea by @nickvergessen, shouldn't it be possible to already decide on PHP level if we want to show the settings or not and don't return a settings page here https://github.com/nextcloud/server/blob/master/apps/files_external/personal.php if we don't want to show the settings?

}
onCompletion.resolve();
}
});
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(IL10N $l, ICredentialsManager $credentialsManager) {
->setIdentifier('password::global')
->setVisibility(BackendService::VISIBILITY_DEFAULT)
->setScheme(self::SCHEME_PASSWORD)
->setText($l->t('Global Credentials'));
->setText($l->t('Global credentials'));
}

public function getAuth($uid) {
Expand Down
12 changes: 6 additions & 6 deletions apps/files_external/lib/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public static function dependencyMessage($backends) {
foreach ($backends as $backend) {
foreach ($backend->checkDependencies() as $dependency) {
if ($message = $dependency->getMessage()) {
$message .= '<br />' . $l->t('<b>Note:</b> ') . $message;
$message .= '<p>' . $message . '</p>';
} else {
$dependencyGroups[$dependency->getDependency()][] = $backend;
}
Expand All @@ -294,9 +294,9 @@ public static function dependencyMessage($backends) {

foreach ($dependencyGroups as $module => $dependants) {
$backends = implode(', ', array_map(function($backend) {
return '<i>' . $backend->getText() . '</i>';
return '"' . $backend->getText() . '"';
}, $dependants));
$message .= '<br />' . OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends);
$message .= '<p>' . OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends) . '</p>';
}

return $message;
Expand All @@ -313,11 +313,11 @@ public static function dependencyMessage($backends) {
private static function getSingleDependencyMessage(\OCP\IL10N $l, $module, $backend) {
switch (strtolower($module)) {
case 'curl':
return (string)$l->t('<b>Note:</b> The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', $backend);
return (string)$l->t('The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', $backend);
case 'ftp':
return (string)$l->t('<b>Note:</b> The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', $backend);
return (string)$l->t('The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', $backend);
default:
return (string)$l->t('<b>Note:</b> "%s" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it.', array($module, $backend));
return (string)$l->t('"%s" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it.', array($module, $backend));
}
}

Expand Down
45 changes: 24 additions & 21 deletions apps/files_external/templates/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
use \OCA\Files_External\Lib\DefinitionParameter;
use \OCA\Files_External\Service\BackendService;

$canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || $_['allowUserMounting'];

$l->t("Enable encryption");
$l->t("Enable previews");
$l->t("Enable sharing");
Expand Down Expand Up @@ -84,25 +86,10 @@ 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'; ?>">
<?php if (isset($_['dependencies']) and ($_['dependencies']<>'')) print_unescaped(''.$_['dependencies'].''); ?>
<form data-can-create="<?php echo $canCreateMounts?'true':'false' ?>" 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']<>'') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?>
<table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'>
<thead>
<tr>
Expand All @@ -118,7 +105,7 @@ function writeParameterInput($parameter, $options, $classes = []) {
</thead>
<tbody>
<tr id="addMountPoint"
<?php if ($_['visibilityType'] === BackendService::VISIBILITY_PERSONAL && $_['allowUserMounting'] === false): ?>
<?php if (!$canCreateMounts): ?>
style="display: none;"
<?php endif; ?>
>
Expand Down Expand Up @@ -173,10 +160,8 @@ function writeParameterInput($parameter, $options, $classes = []) {
</tr>
</tbody>
</table>
<br />

<?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN): ?>
<br />
<input type="checkbox" name="allowUserMounting" id="allowUserMounting" class="checkbox"
value="1" <?php if ($_['allowUserMounting'] == 'yes') print_unescaped(' checked="checked"'); ?> />
<label for="allowUserMounting"><?php p($l->t('Allow users to mount external storage')); ?></label> <span id="userMountingMsg" class="msg"></span>
Expand All @@ -200,3 +185,21 @@ function writeParameterInput($parameter, $options, $classes = []) {
</p>
<?php endif; ?>
</form>

<?php if ($canCreateMounts): ?>
<form autocomplete="false" class="section" action="#"
id="global_credentials">
<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>
<?php endif; ?>