From 275205a169afb53516f6066f08fcbf6ffdf2ba65 Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Wed, 9 May 2018 18:25:27 +0200 Subject: [PATCH] [ADD]Radicale Odoo right and debug storage plugins --- debug_storage/__init__.py | 29 +++++++++++++++++++++++++++++ radicale_odoo_right/__init__.py | 31 +++++++++++++++++++++++++++++++ setup.py | 3 ++- 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 debug_storage/__init__.py create mode 100644 radicale_odoo_right/__init__.py diff --git a/debug_storage/__init__.py b/debug_storage/__init__.py new file mode 100644 index 0000000..84ba9da --- /dev/null +++ b/debug_storage/__init__.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Fabien Bourgeois +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 +# along with this program. If not, see . + +""" Radicale Debug Storage Plugin """ + +import contextlib +from radicale.storage import Collection as RadicaleCollection + +class Collection(RadicaleCollection): + """ Debugging purpose """ + + def __init__(self, path, principal=None, folder=None, filesystem_path=None): + self.logger.warning('Init : %s (path), %s (principal), %s (foler), %s (filesystem_path)' % + (path, principal, folder, filesystem_path)) + super(Collection, self).__init__(path, principal, folder, filesystem_path=None) diff --git a/radicale_odoo_right/__init__.py b/radicale_odoo_right/__init__.py new file mode 100644 index 0000000..ece5c20 --- /dev/null +++ b/radicale_odoo_right/__init__.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Fabien Bourgeois +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 +# along with this program. If not, see . + +""" Odoo Radicale Rights Plugin """ + +from configparser import Error +from radicale.rights import BaseRights + + +class Rights(BaseRights): + """ BaseRights implementation for Odoo Radicale """ + + def authorized(self, user, path, permission): + return True + + def authorized_item(self, user, path, permission): + return True diff --git a/setup.py b/setup.py index babdc57..445e6ce 100644 --- a/setup.py +++ b/setup.py @@ -2,4 +2,5 @@ from distutils.core import setup -setup(name='radicale_odoo', packages=['radicale_odoo_auth', 'radicale_odoo_storage']) +setup(name='radicale_odoo', packages=['radicale_odoo_auth', 'radicale_odoo_right', + 'radicale_odoo_storage', 'debug_storage'])