summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
Diffstat (limited to 'settings')
-rwxr-xr-xsettings/admin.php10
-rw-r--r--settings/ajax/disableapp.php1
-rw-r--r--settings/ajax/enableapp.php1
-rw-r--r--settings/ajax/setsecurity.php13
-rw-r--r--settings/js/admin.js4
-rw-r--r--settings/js/users.js5
-rw-r--r--settings/routes.php4
-rw-r--r--settings/templates/admin.php27
8 files changed, 60 insertions, 5 deletions
diff --git a/settings/admin.php b/settings/admin.php
index 04905391138..4d9685ab920 100755
--- a/settings/admin.php
+++ b/settings/admin.php
@@ -33,6 +33,16 @@ $tmpl->assign('internetconnectionworking', OC_Util::isinternetconnectionworking(
$tmpl->assign('islocaleworking', OC_Util::issetlocaleworking());
$tmpl->assign('backgroundjobs_mode', OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax'));
$tmpl->assign('shareAPIEnabled', OC_Appconfig::getValue('core', 'shareapi_enabled', 'yes'));
+
+// Check if connected using HTTPS
+if (OC_Request::serverProtocol() == 'https') {
+ $connectedHTTPS = true;
+} else {
+ $connectedHTTPS = false;
+}
+$tmpl->assign('isConnectedViaHTTPS', $connectedHTTPS);
+$tmpl->assign('enforceHTTPSEnabled', OC_Config::getValue( "forcessl", false));
+
$tmpl->assign('allowLinks', OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes'));
$tmpl->assign('allowResharing', OC_Appconfig::getValue('core', 'shareapi_allow_resharing', 'yes'));
$tmpl->assign('sharePolicy', OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global'));
diff --git a/settings/ajax/disableapp.php b/settings/ajax/disableapp.php
index a39b06b9c7d..e89de928eac 100644
--- a/settings/ajax/disableapp.php
+++ b/settings/ajax/disableapp.php
@@ -1,7 +1,6 @@
<?php
OC_JSON::checkAdminUser();
OCP\JSON::callCheck();
-OC_JSON::setContentTypeHeader();
OC_App::disable($_POST['appid']);
diff --git a/settings/ajax/enableapp.php b/settings/ajax/enableapp.php
index f4d5c53adef..18202dc39e9 100644
--- a/settings/ajax/enableapp.php
+++ b/settings/ajax/enableapp.php
@@ -2,7 +2,6 @@
OC_JSON::checkAdminUser();
OCP\JSON::callCheck();
-OC_JSON::setContentTypeHeader();
$appid = OC_App::enable($_POST['appid']);
if($appid !== false) {
diff --git a/settings/ajax/setsecurity.php b/settings/ajax/setsecurity.php
new file mode 100644
index 00000000000..16a85aade81
--- /dev/null
+++ b/settings/ajax/setsecurity.php
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Copyright (c) 2013, Lukas Reschke <lukas@statuscode.ch>
+ * This file is licensed under the Affero General Public License version 3 or later.
+ * See the COPYING-README file.
+ */
+
+OC_Util::checkAdminUser();
+OCP\JSON::callCheck();
+
+OC_Config::setValue( 'forcessl', filter_var($_POST['enforceHTTPS'], FILTER_VALIDATE_BOOLEAN));
+
+echo 'true'; \ No newline at end of file
diff --git a/settings/js/admin.js b/settings/js/admin.js
index 95b7a503c27..ab218377fb3 100644
--- a/settings/js/admin.js
+++ b/settings/js/admin.js
@@ -30,4 +30,8 @@ $(document).ready(function(){
}
OC.AppConfig.setValue('core', $(this).attr('name'), value);
});
+
+ $('#security').change(function(){
+ $.post(OC.filePath('settings','ajax','setsecurity.php'), { enforceHTTPS: $('#enforceHTTPSEnabled').val() },function(){} );
+ });
});
diff --git a/settings/js/users.js b/settings/js/users.js
index b0e30feb80c..fa6f058d923 100644
--- a/settings/js/users.js
+++ b/settings/js/users.js
@@ -177,9 +177,9 @@ var UserList = {
} else {
checkHandeler = false;
}
- var addGroup = function (group) {
+ var addGroup = function (select, group) {
$('select[multiple]').each(function (index, element) {
- if ($(element).find('option[value="' + group + '"]').length == 0) {
+ if ($(element).find('option[value="' + group + '"]').length === 0 && select.data('msid') !== $(element).data('msid')) {
$(element).append('<option value="' + group + '">' + group + '</option>');
}
})
@@ -193,6 +193,7 @@ var UserList = {
element.multiSelect({
createCallback:addGroup,
createText:label,
+ selectedFirst:true,
checked:checked,
oncheck:checkHandeler,
onuncheck:checkHandeler,
diff --git a/settings/routes.php b/settings/routes.php
index 60e01527105..9b5bf809230 100644
--- a/settings/routes.php
+++ b/settings/routes.php
@@ -57,4 +57,6 @@ $this->create('settings_ajax_navigationdetect', '/settings/ajax/navigationdetect
$this->create('settings_ajax_getlog', '/settings/ajax/getlog.php')
->actionInclude('settings/ajax/getlog.php');
$this->create('settings_ajax_setloglevel', '/settings/ajax/setloglevel.php')
- ->actionInclude('settings/ajax/setloglevel.php'); \ No newline at end of file
+ ->actionInclude('settings/ajax/setloglevel.php');
+$this->create('settings_ajax_setsecurity', '/settings/ajax/setsecurity.php')
+ ->actionInclude('settings/ajax/setsecurity.php');
diff --git a/settings/templates/admin.php b/settings/templates/admin.php
index 26335063d4b..5ee0147fbcb 100644
--- a/settings/templates/admin.php
+++ b/settings/templates/admin.php
@@ -132,6 +132,33 @@ if (!$_['internetconnectionworking']) {
</table>
</fieldset>
+<fieldset class="personalblock" id="security">
+ <legend><strong><?php echo $l->t('Security');?></strong></legend>
+ <table class="nostyle">
+ <tr>
+ <td id="enable">
+ <input type="checkbox" name="forcessl" id="enforceHTTPSEnabled"
+ <?php if ($_['enforceHTTPSEnabled']) {
+ echo 'checked="checked" ';
+ echo 'value="false"';
+ } else {
+ echo 'value="true"';
+ }
+ ?>
+ <?php if (!$_['isConnectedViaHTTPS']) echo 'disabled'; ?> />
+ <label for="forcessl"><?php echo $l->t('Enforce HTTPS');?></label><br/>
+ <em><?php echo $l->t('Enforces the clients to connect to ownCloud via an encrypted connection.'); ?></em>
+ <?php if (!$_['isConnectedViaHTTPS']) {
+ echo "<br/><em>";
+ echo $l->t('Please connect to this ownCloud instance via HTTPS to enable or disable the SSL enforcement.');
+ echo "</em>";
+ }
+ ?>
+ </td>
+ </tr>
+ </table>
+</fieldset>
+
<fieldset class="personalblock">
<legend><strong><?php echo $l->t('Log');?></strong></legend>
<?php echo $l->t('Log level');?> <select name='loglevel' id='loglevel'>