27 lines
884 B
Python
27 lines
884 B
Python
from radicale.rights import BaseRights
|
|
from radicale.
|
|
import urllib.request
|
|
import json
|
|
import hashlib
|
|
|
|
|
|
class Rights(BaseRights):
|
|
def __init__(self, configuration, logger):
|
|
self.configuration = configuration
|
|
self.logger = logger
|
|
|
|
def authorized(self, user, path, permission):
|
|
"""Check if the user is allowed to read or write the collection.
|
|
If ``user`` is empty, check for anonymous rights.
|
|
``path`` is sanitized.
|
|
``permission`` is "r" or "w".
|
|
"""
|
|
raise NotImplementedError
|
|
|
|
def authorized_item(self, user, path, permission):
|
|
"""Check if the user is allowed to read or write the item."""
|
|
path = storage.sanitize_path(path)
|
|
parent_path = storage.sanitize_path(
|
|
"/%s/" % posixpath.dirname(path.strip("/")))
|
|
return self.authorized(user, parent_path, permission)
|