diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2015-01-14 20:39:23 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2015-03-26 20:56:51 +0100 |
commit | ff9c85ce60aac1098c741b7ea630d9fc545e3d96 (patch) | |
tree | b51ab4917630680beb0499fae4a1d7c0ae100e34 /settings | |
parent | a9b4f0d8429dbeb612e80b168b6146890bb7843e (diff) | |
download | nextcloud-server-ff9c85ce60aac1098c741b7ea630d9fc545e3d96.tar.gz nextcloud-server-ff9c85ce60aac1098c741b7ea630d9fc545e3d96.zip |
implement basic encryption functionallity in core to enable multiple encryption modules
Diffstat (limited to 'settings')
-rw-r--r-- | settings/admin.php | 18 | ||||
-rw-r--r-- | settings/css/settings.css | 9 | ||||
-rw-r--r-- | settings/js/admin.js | 16 | ||||
-rw-r--r-- | settings/templates/admin.php | 24 |
4 files changed, 67 insertions, 0 deletions
diff --git a/settings/admin.php b/settings/admin.php index 6ec4cef350d..34e26c60d86 100644 --- a/settings/admin.php +++ b/settings/admin.php @@ -57,6 +57,23 @@ $template->assign('shareExcludeGroups', $excludeGroups); $excludedGroupsList = $appConfig->getValue('core', 'shareapi_exclude_groups_list', ''); $excludedGroupsList = explode(',', $excludedGroupsList); // FIXME: this should be JSON! $template->assign('shareExcludedGroupsList', implode('|', $excludedGroupsList)); +$template->assign('encryptionEnabled', \OC::$server->getEncryptionManager()->isEnabled()); +$encryptionModules = \OC::$server->getEncryptionManager()->getEncryptionModules(); +try { + $defaultEncryptionModule = \OC::$server->getEncryptionManager()->getDefaultEncryptionModule(); + $defaultEncryptionModuleId = $defaultEncryptionModule->getId(); +} catch (Exception $e) { + $defaultEncryptionModule = null; +} +$encModulues = array(); +foreach ($encryptionModules as $module) { + $encModulues[$module->getId()]['displayName'] = $module->getDisplayName(); + $encModulues[$module->getId()]['default'] = false; + if ($defaultEncryptionModule && $module->getId() === $defaultEncryptionModuleId) { + $encModulues[$module->getId()]['default'] = true; + } +} +$template->assign('encryptionModules', $encModulues); // If the current web root is non-empty but the web root from the config is, // and system cron is used, the URL generator fails to build valid URLs. @@ -118,6 +135,7 @@ $formsAndMore = array_merge($formsAndMore, $formsMap); // add bottom hardcoded forms from the template $formsAndMore[] = array('anchor' => 'backgroundjobs', 'section-name' => $l->t('Cron')); $formsAndMore[] = array('anchor' => 'shareAPI', 'section-name' => $l->t('Sharing')); +$formsAndMore[] = array('anchor' => 'encryptionAPI', 'section-name' => $l->t('Server Side Encryption')); $formsAndMore[] = array('anchor' => 'mail_general_settings', 'section-name' => $l->t('Email Server')); $formsAndMore[] = array('anchor' => 'log-section', 'section-name' => $l->t('Log')); diff --git a/settings/css/settings.css b/settings/css/settings.css index 0716cd24938..75acaf5f727 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -386,3 +386,12 @@ doesnotexist:-o-prefocus, .strengthify-wrapper { font-weight: normal; margin-top: 5px; } + +#selectEncryptionModules { + margin-left: 30px; + padding: 10px; +} + +#encryptionModules { + padding: 10px; +}
\ No newline at end of file diff --git a/settings/js/admin.js b/settings/js/admin.js index a3c941f08a4..d16ab903063 100644 --- a/settings/js/admin.js +++ b/settings/js/admin.js @@ -54,6 +54,22 @@ $(document).ready(function(){ $('#shareAPI p:not(#enable)').toggleClass('hidden', !this.checked); }); + $('#encryptionEnabled').change(function() { + $('#encryptionAPI div#selectEncryptionModules').toggleClass('hidden'); + }); + + $('#encryptionAPI input').change(function() { + var value = $(this).val(); + if ($(this).attr('type') === 'checkbox') { + if (this.checked) { + value = 'yes'; + } else { + value = 'no'; + } + } + OC.AppConfig.setValue('core', $(this).attr('name'), value); + }); + $('#shareAPI input:not(#excludedGroups)').change(function() { var value = $(this).val(); if ($(this).attr('type') === 'checkbox') { diff --git a/settings/templates/admin.php b/settings/templates/admin.php index 23c3a36e28c..1e8221f043a 100644 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -356,6 +356,30 @@ if ($_['cronErrors']) { </p> </div> +<div class="section" id='encryptionAPI'> + <h2><?php p($l->t('Server Side Encryption'));?></h2> + <p id="enable"> + <input type="checkbox" name="encryption_enabled" id="encryptionEnabled" + value="1" <?php if ($_['encryptionEnabled']) print_unescaped('checked="checked"'); ?> /> + <label for="encryptionEnabled"><?php p($l->t('Enable Server-Side-Encryption'));?></label><br/> + </p> + <div id='selectEncryptionModules' class="<?php if (!$_['encryptionEnabled']) { p('hidden'); }?>"> + <?php if (empty($_['encryptionModules'])): p('No encryption module loaded, please load a encryption module in the app menu'); + else: ?> + <h3>Select default encryption module:</h3> + <fieldset id='encryptionModules'> + <?php foreach ($_['encryptionModules'] as $id => $module): ?> + <input type="radio" id="<?php p($id) ?>" + name="default_encryption_module" + value="<?php p($id) ?>" + <?php if($module['default']) { p('checked'); } ?>> + <label for="<?php p($id) ?>"><?php p($module['displayName']) ?></label><br /> + <?php endforeach;?> + </fieldset> + <?php endif; ?> + </div> +</div> + <div class="section"> <form id="mail_general_settings" class="mail_settings"> <h2><?php p($l->t('Email Server'));?></h2> |