mirror of
https://github.com/Kozea/Radicale.git
synced 2025-09-15 20:36:55 +00:00
Simplify Rights plugin interface
This commit is contained in:
parent
8ca01a4989
commit
f6a3a19680
11 changed files with 51 additions and 43 deletions
|
@ -22,20 +22,20 @@ calendars and address books.
|
|||
"""
|
||||
|
||||
import radicale.rights.authenticated as authenticated
|
||||
from radicale import pathutils, rights
|
||||
from radicale import pathutils
|
||||
|
||||
|
||||
class Rights(authenticated.Rights):
|
||||
def authorized(self, user, path, permissions):
|
||||
def authorization(self, user, path):
|
||||
if self._verify_user and not user:
|
||||
return ""
|
||||
sane_path = pathutils.strip_path(path)
|
||||
if not sane_path:
|
||||
return rights.intersect_permissions(permissions, "R")
|
||||
return "R"
|
||||
if self._verify_user and user != sane_path.split("/", maxsplit=1)[0]:
|
||||
return ""
|
||||
if "/" not in sane_path:
|
||||
return rights.intersect_permissions(permissions, "RW")
|
||||
return "RW"
|
||||
if sane_path.count("/") == 1:
|
||||
return rights.intersect_permissions(permissions, "rw")
|
||||
return "rw"
|
||||
return ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue