1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-09-12 20:30:57 +00:00

Minimize accesses to rights backend

This commit is contained in:
Unrud 2020-04-22 19:20:07 +02:00
parent 99adeb19c1
commit aef58bd55c
9 changed files with 92 additions and 74 deletions

View file

@ -21,7 +21,7 @@ import posixpath
from http import client
from urllib.parse import quote
from radicale import httputils, pathutils, storage, xmlutils
from radicale import app, httputils, pathutils, storage, xmlutils
from radicale.log import logger
@ -70,13 +70,14 @@ class ApplicationGetMixin:
# Dispatch .web URL to web module
if path == "/.web" or path.startswith("/.web/"):
return self._web.get(environ, base_prefix, path, user)
if not self._access(user, path, "r"):
access = app.Access(self._rights, user, path)
if not access.check("r"):
return httputils.NOT_ALLOWED
with self._storage.acquire_lock("r", user):
item = next(self._storage.discover(path), None)
if not item:
return httputils.NOT_FOUND
if not self._access(user, path, "r", item):
if not access.check("r", item):
return httputils.NOT_ALLOWED
if isinstance(item, storage.BaseCollection):
tag = item.get_meta("tag")