Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prohibit enabling encryption when S3 Object Storage is configured #487

Merged
merged 7 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ This extension is the successor of the [ownCloud Objectstore App](https://market
<command>OCA\Files_Primary_S3\Command\s3List</command>
<command>OCA\Files_Primary_S3\Command\createBucket</command>
</commands>
<settings>
<admin>OCA\Files_Primary_S3\Panels\Admin</admin>
</settings>
</info>
3 changes: 3 additions & 0 deletions css/settings.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#encryptionAPI .warning {
margin-bottom: 10px;
}
3 changes: 3 additions & 0 deletions js/settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$(document).ready(function () {
$(this).find('.warning').insertBefore('#enable');
});
54 changes: 54 additions & 0 deletions lib/Panels/Admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
/**
* @author Jannik Stehle <[email protected]>
* @author Jan Ackermann <[email protected]>
*
* @copyright Copyright (c) 2021, ownCloud GmbH
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OCA\Files_Primary_S3\Panels;

use OCP\Settings\ISettings;
use OCP\Template;
use OCP\IConfig;

class Admin implements ISettings {

/** @var IConfig */
protected $config;

public function __construct(IConfig $config) {
$this->config = $config;
}

public function getPriority() {
return 0;
}

public function getSectionID() {
return 'encryption';
}

public function getPanel() {
$objectstore = $this->config->getSystemValue('objectstore', null);
if ($objectstore) {
$tmpl = new Template('files_primary_s3', 'settings');
return $tmpl;
}

return null;
}
}
30 changes: 30 additions & 0 deletions templates/settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* @author Jannik Stehle <[email protected]>
* @author Jan Ackermann <[email protected]>
*
* @copyright Copyright (c) 2021, ownCloud GmbH
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
script('files_primary_s3', 'settings');
style('files_primary_s3', 'settings');
?>

<div class="section" id="encryptionAPI">
<div class="warning">
<?php p($l->t('S3 Object Storage is currently not compatible with encryption, enabling might cause data-loss.')); ?>
</div>
</div>