コード例 #1
0
ファイル: from_file.py プロジェクト: matthiasjordan/Radicale
def write_authorized(user, collection):
    """Check if the user is allowed to write the collection."""
    if owner_only.read_authorized(user, collection):
        return True

    curl = _normalize_trail_slash(collection.url)

    return _dict_knows(WRITE_AUTHORIZED, curl, user)
コード例 #2
0
def read_authorized(user, collection):
    """Check if the user is allowed to read the collection."""
    is_group_collection, allowed = group_collection(user, collection)
    if is_group_collection == True:
        return allowed
    return (
            owner_only.read_authorized(user, collection) or
            "r" in RIGHTS.get(collection.url.rstrip("/") or "/", user))
コード例 #3
0
ファイル: from_file.py プロジェクト: Leon1108/Radicale
def write_authorized(user, collection):
    """Check if the user is allowed to write the collection."""
    if owner_only.read_authorized(user, collection):
        return True
    else:
        try:
            return "w" in RIGHTS.get(collection.url.rstrip("/") or "/", user)
        except (NoSectionError, NoOptionError):
            return False
コード例 #4
0
ファイル: from_file.py プロジェクト: ryansb/Radicale
def read_authorized(user, collection):
    """Check if the user is allowed to read the collection."""
    if user is None:
        return False
    elif owner_only.read_authorized(user, collection):
        return True
    else:
        try:
            return "r" in _read_rights().get(
                collection.url.rstrip("/") or "/", user)
        except (NoSectionError, NoOptionError):
            return False
コード例 #5
0
ファイル: from_file.py プロジェクト: satoruk/Radicale
def read_authorized(user, collection):
    """Check if the user is allowed to read the collection."""
    return (
        owner_only.read_authorized(user, collection) or
        "r" in RIGHTS.get(collection.url.rstrip("/") or "/", user))