Merge pull request #553 from Kozea/config

Change default values for the config
This commit is contained in:
Guillaume Ayoub
2017-04-15 09:19:32 +02:00
committed by GitHub
4 changed files with 24 additions and 19 deletions

View File

@ -31,7 +31,7 @@ from configparser import RawConfigParser as ConfigParser
INITIAL_CONFIG = OrderedDict([
("server", OrderedDict([
("hosts", {
"value": "0.0.0.0:5232",
"value": "127.0.0.1:5232",
"help": "set server hostnames including ports",
"aliases": ["-H", "--hosts"]}),
("daemon", {
@ -58,15 +58,15 @@ INITIAL_CONFIG = OrderedDict([
"aliases": ["-s", "--ssl"],
"opposite": ["-S", "--no-ssl"]}),
("certificate", {
"value": "/etc/apache2/ssl/server.crt",
"value": "/etc/ssl/radicale.cert.pem",
"help": "set certificate file",
"aliases": ["-c", "--certificate"]}),
("key", {
"value": "/etc/apache2/ssl/server.key",
"value": "/etc/ssl/radicale.key.pem",
"help": "set private key file",
"aliases": ["-k", "--key"]}),
("protocol", {
"value": "PROTOCOL_SSLv23",
"value": "PROTOCOL_TLSv1_2",
"help": "SSL protocol used"}),
("ciphers", {
"value": "",
@ -92,14 +92,14 @@ INITIAL_CONFIG = OrderedDict([
"value": "/etc/radicale/users",
"help": "htpasswd filename"}),
("htpasswd_encryption", {
"value": "crypt",
"value": "bcrypt",
"help": "htpasswd encryption method"})])),
("rights", OrderedDict([
("type", {
"value": "None",
"value": "owner_only",
"help": "rights backend"}),
("file", {
"value": "~/.config/radicale/rights",
"value": "/etc/radicale/rights",
"help": "file for rights management from_file"})])),
("storage", OrderedDict([
("type", {
@ -107,7 +107,7 @@ INITIAL_CONFIG = OrderedDict([
"help": "storage backend"}),
("filesystem_folder", {
"value": os.path.expanduser(
"~/.config/radicale/collections"),
"/var/lib/radicale/collections"),
"help": "file for rights management from_file"}),
("filesystem_fsync", {
"value": "True",

View File

@ -48,8 +48,9 @@ from . import storage
def load(configuration, logger):
"""Load the rights manager chosen in configuration."""
auth_type = configuration.get("auth", "type")
rights_type = configuration.get("rights", "type")
if rights_type == "None":
if auth_type == "None" or rights_type == "None":
return lambda user, collection, permission: True
elif rights_type in DEFINED_RIGHTS or rights_type == "from_file":
return Rights(configuration, logger).authorized

View File

@ -768,6 +768,9 @@ class BaseRequestsMixIn:
def test_authentication(self):
"""Test if server sends authentication request."""
self.configuration.set("auth", "type", "htpasswd")
self.configuration.set("auth", "htpasswd_filename", os.devnull)
self.configuration.set("auth", "htpasswd_encryption", "plain")
self.configuration.set("rights", "type", "owner_only")
self.application = Application(self.configuration, self.logger)
status, headers, answer = self.request("MKCOL", "/user/")