[ADD]Odoo Right plugin : allow write on contacts

This commit is contained in:
Fabien BOURGEOIS 2020-04-09 15:07:11 +02:00
parent d3a2fa903a
commit 2587cfa999
1 changed files with 6 additions and 1 deletions

View File

@ -17,8 +17,10 @@
""" Odoo Radicale Rights Plugin """
import logging
from configparser import Error
from radicale.rights import BaseRights
_logger = logging.getLogger(__name__)
class Rights(BaseRights):
@ -33,4 +35,7 @@ class Rights(BaseRights):
path = path.strip('/').split('/')
if user != path[0]:
return False
return permission == 'r'
# Authorize if readonly or read-write for odoo-contact
is_main = (len(path) == 1 and user == path[0])
is_odoo_contact = (len(path) > 1 and path[1] == 'odoo-contact')
return is_main or is_odoo_contact or permission == 'r'