[ADD]Odoo Right plugin : allow write on contacts
This commit is contained in:
parent
d3a2fa903a
commit
2587cfa999
@ -17,8 +17,10 @@
|
|||||||
|
|
||||||
""" Odoo Radicale Rights Plugin """
|
""" Odoo Radicale Rights Plugin """
|
||||||
|
|
||||||
|
import logging
|
||||||
from configparser import Error
|
from configparser import Error
|
||||||
from radicale.rights import BaseRights
|
from radicale.rights import BaseRights
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Rights(BaseRights):
|
class Rights(BaseRights):
|
||||||
@ -33,4 +35,7 @@ class Rights(BaseRights):
|
|||||||
path = path.strip('/').split('/')
|
path = path.strip('/').split('/')
|
||||||
if user != path[0]:
|
if user != path[0]:
|
||||||
return False
|
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'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user